Repository: ambari Updated Branches: refs/heads/trunk 69dafbc93 -> c3fb6ca29
AMBARI-5083 Takes 2 minutes to enable Next button, Installer wizard step 3. (atkach) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/c3fb6ca2 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/c3fb6ca2 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/c3fb6ca2 Branch: refs/heads/trunk Commit: c3fb6ca297b1b4bc5cae1e33c1b3d96a0abda21b Parents: 69dafbc Author: atkach <[email protected]> Authored: Fri Mar 14 15:04:54 2014 +0200 Committer: atkach <[email protected]> Committed: Fri Mar 14 15:04:54 2014 +0200 ---------------------------------------------------------------------- .../app/controllers/wizard/step3_controller.js | 8 +++++++- ambari-web/app/messages.js | 1 + ambari-web/app/styles/application.less | 13 ++++++++----- ambari-web/app/templates/wizard/step3.hbs | 7 ++++--- ambari-web/app/views/common/modal_popup.js | 2 +- ambari-web/app/views/wizard/step3_view.js | 18 +++++++++--------- 6 files changed, 30 insertions(+), 19 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/c3fb6ca2/ambari-web/app/controllers/wizard/step3_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/wizard/step3_controller.js b/ambari-web/app/controllers/wizard/step3_controller.js index caf0bc3..f5b2fa6 100644 --- a/ambari-web/app/controllers/wizard/step3_controller.js +++ b/ambari-web/app/controllers/wizard/step3_controller.js @@ -26,6 +26,8 @@ App.WizardStep3Controller = Em.Controller.extend({ content: [], bootHosts: [], registeredHosts: [], + repoCategoryWarnings: [], + diskCategoryWarnings: [], registrationStartedAt: null, registrationTimeoutSecs: function(){ if(this.get('content.installOptions.manualInstall')){ @@ -526,6 +528,7 @@ App.WizardStep3Controller = Em.Controller.extend({ * Get disk info and cpu count of booted hosts from server */ getHostInfo: function () { + this.set('isWarningsLoaded', false); App.ajax.send({ name: 'wizard.step3.host_info', sender: this, @@ -600,6 +603,7 @@ App.WizardStep3Controller = Em.Controller.extend({ getHostInfoErrorCallback: function () { console.log('INFO: Getting host information(cpu_count and total_mem) from the server failed'); + this.set('isWarningsLoaded', true); this.registerErrPopup(Em.I18n.t('installer.step3.hostInformation.popup.header'), Em.I18n.t('installer.step3.hostInformation.popup.body')); }, @@ -780,6 +784,7 @@ App.WizardStep3Controller = Em.Controller.extend({ warnings: [], warningsByHost: [], warningsTimeInterval: 60000, + isWarningsLoaded: false, /** * check are hosts have any warnings */ @@ -847,7 +852,7 @@ App.WizardStep3Controller = Em.Controller.extend({ //parse all directories and files warnings for host //todo: to be removed after check in new API - var stackFoldersAndFiles = _host.Hosts.last_agent_env.stackFoldersAndFiles; + var stackFoldersAndFiles = _host.Hosts.last_agent_env.stackFoldersAndFiles || []; stackFoldersAndFiles.forEach(function (path) { warning = warningCategories.fileFoldersWarnings[path.name]; if (warning) { @@ -1013,6 +1018,7 @@ App.WizardStep3Controller = Em.Controller.extend({ }); this.set('warnings', warnings); this.set('warningsByHost', hosts); + this.set('isWarningsLoaded', true); }, /** * open popup that contain hosts' warnings http://git-wip-us.apache.org/repos/asf/ambari/blob/c3fb6ca2/ambari-web/app/messages.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js index 7efd0a0..f727271 100644 --- a/ambari-web/app/messages.js +++ b/ambari-web/app/messages.js @@ -502,6 +502,7 @@ Em.I18n.translations = { 'installer.step3.warnings.updateChecks.failed':'Host Checks update failed', 'installer.step3.warnings.missingHosts':'There is no registered host', 'installer.step3.warning.registeredHosts': '{0} Other Registered Hosts', + 'installer.step3.warning.loading':'Please wait while the hosts are being checked for potential problems...', 'installer.step3.registeredHostsPopup': 'These are the hosts that have registered with the server, but do not appear in the list of hosts that you are adding.', 'installer.step3.removeSelected':'Remove Selected', 'installer.step3.retryFailed':'Retry Failed', http://git-wip-us.apache.org/repos/asf/ambari/blob/c3fb6ca2/ambari-web/app/styles/application.less ---------------------------------------------------------------------- diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less index 9c42137..7d9c241 100644 --- a/ambari-web/app/styles/application.less +++ b/ambari-web/app/styles/application.less @@ -4827,11 +4827,6 @@ li.break { border-color: #D2D9DD; color: #4E575B; text-shadow: none; - .spinner { - padding: 8px 35px 0px 42px; - width: auto; - background: url(/img/spinner.gif) no-repeat; - } .link { padding: 0 15px; } @@ -4840,6 +4835,14 @@ li.break { } } +#reload_popup { + .spinner { + padding: 8px 35px 0px 42px; + width: auto; + background: url(/img/spinner.gif) no-repeat; + } +} + /* .progress-striped .bar { background-color: #A5A5A5; http://git-wip-us.apache.org/repos/asf/ambari/blob/c3fb6ca2/ambari-web/app/templates/wizard/step3.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/wizard/step3.hbs b/ambari-web/app/templates/wizard/step3.hbs index 896689d..2b6fb18 100644 --- a/ambari-web/app/templates/wizard/step3.hbs +++ b/ambari-web/app/templates/wizard/step3.hbs @@ -118,12 +118,13 @@ <a href="#" {{action registeredHostsPopup target="controller"}}>{{view.registeredHostsMessage}}</a> </div> {{/if}} - {{#if isWarningsBoxVisible}} - <div {{bindAttr class=":alert view.status"}}> + <div {{bindAttr class=":alert view.status isWarningsBoxVisible::hidden"}}> {{view.message}} <a href="#" {{action hostWarningsPopup warnings target="controller"}}>{{view.linkText}}</a> + {{#unless isWarningsLoaded}} + <div class="spinner"></div> + {{/unless}} </div> - {{/if}} <div class="btn-area"> <a class="btn pull-left" {{bindAttr disabled="isRegistrationInProgress"}} {{action back target="controller"}}>← {{t common.back}}</a> <a class="btn btn-success pull-right" {{bindAttr disabled="isSubmitDisabled"}} {{action submit target="controller"}}>{{t common.next}} →</a> http://git-wip-us.apache.org/repos/asf/ambari/blob/c3fb6ca2/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 1789c39..3724ab7 100644 --- a/ambari-web/app/views/common/modal_popup.js +++ b/ambari-web/app/views/common/modal_popup.js @@ -105,7 +105,7 @@ App.showReloadPopup = function () { secondary: null, showFooter: false, header: this.t('app.reloadPopup.header'), - body: "<div class='alert alert-info'><div class='spinner'><span>" + this.t('app.reloadPopup.text') + "</span></div></div><div><a href='#' onclick='location.reload();'>" + this.t('app.reloadPopup.link') + "</a></div>", + body: "<div id='reload_popup' class='alert alert-info'><div class='spinner'><span>" + this.t('app.reloadPopup.text') + "</span></div></div><div><a href='#' onclick='location.reload();'>" + this.t('app.reloadPopup.link') + "</a></div>", encodeBody: false }); }; http://git-wip-us.apache.org/repos/asf/ambari/blob/c3fb6ca2/ambari-web/app/views/wizard/step3_view.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/wizard/step3_view.js b/ambari-web/app/views/wizard/step3_view.js index 323fbba..3211e6d 100644 --- a/ambari-web/app/views/wizard/step3_view.js +++ b/ambari-web/app/views/wizard/step3_view.js @@ -39,17 +39,17 @@ App.WizardStep3View = Em.View.extend({ }.observes('controller.registeredHosts'), monitorStatuses: function() { - var failedHosts = 0; var hosts = this.get('controller.bootHosts'); - hosts.forEach(function(host) { - if (host.get('bootStatus') == 'FAILED') { - failedHosts++; - } - }); - if (hosts.length==0) { + var failedHosts = hosts.filterProperty('bootStatus', 'FAILED').length; + + if (hosts.length === 0) { this.set('status', 'alert-warn'); this.set('linkText', ''); this.set('message', Em.I18n.t('installer.step3.warnings.missingHosts')); + } else if (!this.get('controller.isWarningsLoaded')) { + this.set('status', 'alert-info'); + this.set('linkText', ''); + this.set('message', Em.I18n.t('installer.step3.warning.loading')); } else if (this.get('controller.isHostHaveWarnings') || this.get('controller.repoCategoryWarnings.length') || this.get('controller.diskCategoryWarnings.length')) { this.set('status', 'alert-warn'); this.set('linkText', Em.I18n.t('installer.step3.warnings.linkText')); @@ -67,10 +67,10 @@ App.WizardStep3View = Em.View.extend({ this.set('message', Em.I18n.t('installer.step3.warnings.allFailed').format(failedHosts)); } else { // some failed - this.set('message', Em.I18n.t('installer.step3.warnings.someWarnings').format((hosts.length-failedHosts), failedHosts)); + this.set('message', Em.I18n.t('installer.step3.warnings.someWarnings').format((hosts.length - failedHosts), failedHosts)); } } - }.observes('controller.isHostHaveWarnings', '[email protected]', 'controller.repoCategoryWarnings', 'controller.diskCategoryWarnings') + }.observes('controller.isWarningsLoaded', 'controller.isHostHaveWarnings', '[email protected]', 'controller.repoCategoryWarnings', 'controller.diskCategoryWarnings') }); //todo: move it inside WizardStep3View
