Skip to content

Commit

Permalink
Editor: Publish modal button needs loading status (#2324)
Browse files Browse the repository at this point in the history
* Editor: Publish modal button needs loading status
relates to xibosignage/xibo#3296

* Remove cog when request fails from dialog
relates to xibosignage/xibo#3296
  • Loading branch information
maurofmferrao committed Jan 24, 2024
1 parent 83bab28 commit ab734f2
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
21 changes: 15 additions & 6 deletions ui/src/layout-editor/layout.js
Expand Up @@ -468,8 +468,11 @@ Layout.prototype.publish = function() {
} else {
toastr.error(res.message);

// Close dialog
bootbox.hideAll();
// Remove loading icon from publish dialog
$(
'[data-test="publishFormLayoutForm"] ' +
'.btn-bb-Publish i.fa-cog',
).remove();
}
}
}).fail(function(jqXHR, textStatus, errorThrown) {
Expand Down Expand Up @@ -517,8 +520,11 @@ Layout.prototype.discard = function() {
} else {
toastr.error(res.message);

// Close dialog
bootbox.hideAll();
// Remove loading icon from publish dialog
$(
'[data-test="discardFormLayoutForm"] ' +
'.btn-bb-Discard i.fa-cog',
).remove();
}
}

Expand Down Expand Up @@ -568,8 +574,11 @@ Layout.prototype.delete = function() {
} else {
toastr.error(res.message);

// Close dialog
bootbox.hideAll();
// Remove loading icon from publish dialog
$(
'[data-test="deleteFormLayoutForm"] ' +
'.btn-bb-Yes i.fa-cog',
).remove();
}
}

Expand Down
7 changes: 6 additions & 1 deletion ui/src/layout-editor/main.js
Expand Up @@ -1035,7 +1035,12 @@ lD.loadFormFromAPI = function(
generatedButtons[button] = {
label: button,
className: buttonType + ' btn-bb-' + button,
callback: function() {
callback: function(ev) {
// Show loading cog
$(ev.currentTarget).append(
'&nbsp;<i class="fa fa-cog fa-spin"></i>',
);

// Call global function by the function name
if (mainActionCallback != null && mainButtonAction) {
eval(mainActionCallback);
Expand Down

0 comments on commit ab734f2

Please sign in to comment.