Skip to content

Commit

Permalink
fix mask blinking
Browse files Browse the repository at this point in the history
  • Loading branch information
nekufa committed Feb 9, 2020
1 parent c93ad83 commit 36ffbb9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions public/admin/js/Viewport.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Ext.define('Admin.Viewport', {
dispatch(job, params) {
params = params || {};
var el = (Ext.WindowManager.getActive() || this).el;
el.mask('Please, wait');
var timeout = setTimeout(function() { el.mask('Please, wait'); }, 100);
return new Promise(function(resolve, reject) {
Ext.Ajax.request({
method: 'post',
Expand All @@ -52,6 +52,7 @@ Ext.define('Admin.Viewport', {
}),
},
success: response => {
clearTimeout(timeout);
try {
var result = Ext.JSON.decode(response.responseText);
} catch(e) {
Expand All @@ -60,7 +61,9 @@ Ext.define('Admin.Viewport', {
message: e
}
}
el.unmask();
if (el.isMasked()) {
setTimeout(function() {el.unmask();}, 250);
}
if(!result.success) {
Ext.MessageBox.alert('Error', result.message);
reject(result.message);
Expand Down

0 comments on commit 36ffbb9

Please sign in to comment.