Repository: ambari Updated Branches: refs/heads/branch-2.2 21a4ed434 -> 8c3d3d6a0
AMBARI-14406. Display A Dialog When Beginning An Upgrade.(xiwang) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/190e05e9 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/190e05e9 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/190e05e9 Branch: refs/heads/branch-2.2 Commit: 190e05e95ce45a459c88fc348262640eb9942690 Parents: 21a4ed4 Author: Xi Wang <xiw...@apache.org> Authored: Mon Jan 4 16:36:47 2016 -0800 Committer: Xi Wang <xiw...@apache.org> Committed: Tue Jan 5 11:12:09 2016 -0800 ---------------------------------------------------------------------- .../main/admin/stack_and_upgrade_controller.js | 46 ++++++++++++++++++++ .../app/controllers/wizard/step8_controller.js | 1 + ambari-web/app/messages.js | 1 + .../templates/wizard/step8/step8_log_popup.hbs | 2 +- 4 files changed, 49 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/190e05e9/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js b/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js index 483d90e..f58f384 100644 --- a/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js +++ b/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js @@ -588,6 +588,7 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage, * @param {object} version */ upgrade: function (version) { + var self = this; this.set('requestInProgress', true); App.ajax.send({ name: 'admin.upgrade.start', @@ -600,6 +601,51 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage, } }); this.setDBProperty('currentVersion', this.get('currentVersion')); + + // Show a "preparing the upgrade..." dialog in case the api call returns too slow + if (App.router.get('currentState.name') != 'stackUpgrade') { + self.showPreparingUpgradeIndicator(); + } + }, + + /** + * Should progress bar be displayed when preparing upgrade, + * should show after Upgrade Options window and before Upgrade Wizard + * @method showPreparingUpgradeIndicator + */ + showPreparingUpgradeIndicator: function () { + return App.ModalPopup.show({ + header: '', + showFooter: false, + showCloseButton: false, + bodyClass: Em.View.extend({ + templateName: require('templates/wizard/step8/step8_log_popup'), + controllerBinding: 'App.router.mainAdminStackAndUpgradeController', + + /** + * Css-property for progress-bar + * @type {string} + */ + barWidth: 'width: 100%;', + progressBarClass: 'progress progress-striped active log_popup', + + /** + * Popup-message + * @type {string} + */ + message: Em.I18n.t('admin.stackUpgrade.dialog.prepareUpgrade.header'), + + /** + * Hide popup when upgrade wizard is open + * @method autoHide + */ + autoHide: function () { + if (!this.get('controller.requestInProgress')) { + this.get('parentView').hide(); + } + }.observes('controller.requestInProgress') + }) + }); }, /** http://git-wip-us.apache.org/repos/asf/ambari/blob/190e05e9/ambari-web/app/controllers/wizard/step8_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/wizard/step8_controller.js b/ambari-web/app/controllers/wizard/step8_controller.js index c644328..a843f65 100644 --- a/ambari-web/app/controllers/wizard/step8_controller.js +++ b/ambari-web/app/controllers/wizard/step8_controller.js @@ -1705,6 +1705,7 @@ App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs, App.wiz * @type {string} */ barWidth: '', + progressBarClass: 'progress log_popup', /** * Popup-message http://git-wip-us.apache.org/repos/asf/ambari/blob/190e05e9/ambari-web/app/messages.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js index 72db077..3a7f570 100644 --- a/ambari-web/app/messages.js +++ b/ambari-web/app/messages.js @@ -1588,6 +1588,7 @@ Em.I18n.translations = { 'admin.stackUpgrade.dialog.details.open': "show details", 'admin.stackUpgrade.dialog.details.hide': "hide details", 'admin.stackUpgrade.dialog.notActive': "Waiting to execute the next task...", + 'admin.stackUpgrade.dialog.prepareUpgrade.header': "Preparing the Upgrade...", 'services.service.start':'Start', 'services.service.stop':'Stop', 'services.service.metrics':'Metrics', http://git-wip-us.apache.org/repos/asf/ambari/blob/190e05e9/ambari-web/app/templates/wizard/step8/step8_log_popup.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/wizard/step8/step8_log_popup.hbs b/ambari-web/app/templates/wizard/step8/step8_log_popup.hbs index fafb0b3..6d3e5c2 100644 --- a/ambari-web/app/templates/wizard/step8/step8_log_popup.hbs +++ b/ambari-web/app/templates/wizard/step8/step8_log_popup.hbs @@ -16,7 +16,7 @@ * limitations under the License. }} <p>{{view.message}}</p> -<div class="progress log_popup"> +<div {{bindAttr class="view.progressBarClass"}}> <div class="bar" {{bindAttr style="view.barWidth"}}> </div> </div> \ No newline at end of file