Browse Source

AMBARI-5083 Takes 2 minutes to enable Next button, Installer wizard step 3. (atkach)

atkach 11 years ago
parent
commit
c3fb6ca297

+ 7 - 1
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

+ 1 - 0
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',

+ 8 - 5
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;

+ 4 - 3
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"}}>&larr; {{t common.back}}</a>
     <a class="btn btn-success pull-right" {{bindAttr disabled="isSubmitDisabled"}} {{action submit target="controller"}}>{{t common.next}} &rarr;</a>

+ 1 - 1
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
   });
 };

+ 9 - 9
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', 'controller.bootHosts.@each.bootStatus', 'controller.repoCategoryWarnings', 'controller.diskCategoryWarnings')
+  }.observes('controller.isWarningsLoaded', 'controller.isHostHaveWarnings', 'controller.bootHosts.@each.bootStatus', 'controller.repoCategoryWarnings', 'controller.diskCategoryWarnings')
 });
 
 //todo: move it inside WizardStep3View