1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

improve detail page refresh after editing

This commit is contained in:
Luke Pulverenti 2016-06-29 00:05:16 -04:00
parent 9b8cb284fb
commit df2609fab6
3 changed files with 35 additions and 27 deletions

View file

@ -1,8 +1,6 @@
define(['dialogHelper', 'css!css/metadataeditor.css', 'emby-button', 'paper-icon-button-light'], function (dialogHelper) {
var currentItem;
var currentResolve;
var currentReject;
var hasChanges = false;
function getBaseRemoteOptions() {
@ -241,7 +239,7 @@
});
}
function showEditor(itemId, options) {
function showEditor(itemId, options, resolve, reject) {
options = options || {};
@ -282,7 +280,16 @@
initEditor(dlg, options);
// Has to be assigned a z-index after the call to .open()
dlg.addEventListener('close', onDialogClosed);
dlg.addEventListener('close', function () {
Dashboard.hideLoadingMsg();
if (hasChanges) {
resolve();
} else {
reject();
}
});
dialogHelper.open(dlg);
@ -299,27 +306,14 @@
xhr.send();
}
function onDialogClosed() {
Dashboard.hideLoadingMsg();
if (hasChanges) {
currentResolve();
} else {
currentReject();
}
}
return {
show: function (itemId, options) {
return new Promise(function (resolve, reject) {
currentResolve = resolve;
currentReject = reject;
hasChanges = false;
showEditor(itemId, options);
showEditor(itemId, options, resolve, reject);
});
}
};