Skip to content

Commit

Permalink
Merge pull request archesproject#9846 from archesproject/9845_spinner…
Browse files Browse the repository at this point in the history
…_on_preview_button

spinner on preview button, archesproject#9845
  • Loading branch information
apeters authored Jul 28, 2023
2 parents 5b682c8 + f7ffb0c commit 2ec3ef4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ define([
this.alert = params.alert;
this.moduleId = params.etlmoduleid;
this.loading(true);
this.previewing = ko.observable();
this.languages = ko.observable(arches.languages);
this.selectedLanguage = ko.observable();
this.graphs = ko.observable();
Expand Down Expand Up @@ -83,6 +84,7 @@ define([
this.ready = ko.computed(() => {
const ready = !!self.selectedGraph() &&
!!self.selectedNode() &&
!self.previewing() &&
((self.operation() == 'replace' && !!self.oldText() && !!self.newText() || self.operation() != 'replace'));
return ready;
});
Expand Down Expand Up @@ -147,6 +149,11 @@ define([
if (!self.ready()) {
return;
}

self.previewing(true);
self.showPreview(false);
self.previewValue([]);

if (self.operation() === 'replace' && (!self.oldText() || !self.newText())){
self.alert(
new AlertViewModel(
Expand All @@ -169,6 +176,7 @@ define([
}).fail(function(err) {
console.log(err);
}).always(function() {
self.previewing(false);
self.deleteAllFormData();
});
};
Expand All @@ -194,7 +202,6 @@ define([
self.loading(true);
self.submit('write').then(data => {
params.activeTab("import");
console.log(data.result);
}).fail( function(err) {
self.alert(
new JsonErrorAlertViewModel(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ <h3>
</div>
<button data-bind="click: preview, css: {disabled: !ready()}" class="btn btn-success">
<span data-bind="text: $root.translations.preview"></span>
<i class="fa fa-spin fa-spinner" data-bind="visible: previewing()"></i>
</button>
</section>
<!-- ko if: showPreview-->
Expand Down

0 comments on commit 2ec3ef4

Please sign in to comment.