AMBARI-19907. On certain actions, there's no feedback from the UI when API takes a long time to respond <fix1> (rzang)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/626d4348 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/626d4348 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/626d4348 Branch: refs/heads/branch-feature-BUG-74026 Commit: 626d4348eb3ca1fc4fb17f00124288794c252fa7 Parents: c77ca2e Author: Richard Zang <[email protected]> Authored: Thu Feb 16 13:36:07 2017 -0800 Committer: Richard Zang <[email protected]> Committed: Thu Feb 16 13:36:07 2017 -0800 ---------------------------------------------------------------------- ambari-web/app/utils/ajax/ajax.js | 23 +++++++++++++++-------- ambari-web/app/views/common/modal_popup.js | 9 +++++++++ 2 files changed, 24 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/626d4348/ambari-web/app/utils/ajax/ajax.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/utils/ajax/ajax.js b/ambari-web/app/utils/ajax/ajax.js index 82fa34f..842b8d8 100644 --- a/ambari-web/app/utils/ajax/ajax.js +++ b/ambari-web/app/utils/ajax/ajax.js @@ -3104,15 +3104,19 @@ var ajax = Em.Object.extend({ } var loadingPopup = null; + var loadingPopupTimeout = null; if(config.hasOwnProperty("showLoadingPopup") && config.showLoadingPopup === true) { - loadingPopup = App.ModalPopup.show({ - header: Em.I18n.t('jobs.loadingTasks'), - primary: false, - secondary: false, - bodyClass: Em.View.extend({ - template: Em.Handlebars.compile('{{view App.SpinnerView}}') - }) - }); + loadingPopupTimeout = setTimeout(function() { + loadingPopup = App.ModalPopup.show({ + header: Em.I18n.t('jobs.loadingTasks'), + backdrop: false, + primary: false, + secondary: false, + bodyClass: Em.View.extend({ + template: Em.Handlebars.compile('{{view App.SpinnerView}}') + }) + }); + }, 1000); } // default parameters @@ -3164,6 +3168,9 @@ var ajax = Em.Object.extend({ } }; opt.complete = function () { + if (loadingPopupTimeout) { + clearTimeout(loadingPopupTimeout); + } if(loadingPopup) { Em.tryInvoke(loadingPopup, 'hide'); } http://git-wip-us.apache.org/repos/asf/ambari/blob/626d4348/ambari-web/app/views/common/modal_popup.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/common/modal_popup.js b/ambari-web/app/views/common/modal_popup.js index c6361fb..8bbdeed 100644 --- a/ambari-web/app/views/common/modal_popup.js +++ b/ambari-web/app/views/common/modal_popup.js @@ -72,11 +72,20 @@ App.ModalPopup = Ember.View.extend({ .on('enter-key-pressed', this.enterKeyPressed.bind(this)) .on('escape-key-pressed', this.escapeKeyPressed.bind(this)); this.fitZIndex(); + this.handleBackDrop(); var firstInputElement = this.$('#modal').find(':input').not(':disabled, .no-autofocus').first(); this.focusElement(firstInputElement); this.subscribeResize(); }, + handleBackDrop: function () { + if (this.get('backdrop') === false) { + $('.modal-backdrop').css('visibility', 'hidden'); + } else { + $('.modal-backdrop').css('visibility', 'visible'); + } + }, + subscribeResize: function() { if (this.get('autoHeight') && !$.mocho) { this.fitHeight();
