ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From atk...@apache.org
Subject git commit: AMBARI-4093 Installer:Confirm Hosts - improve responsiveness on filtering of hosts. (atkach)
Date Tue, 17 Dec 2013 16:49:39 GMT
Updated Branches:
  refs/heads/trunk 5229fb1be -> 185b11ab5


AMBARI-4093 Installer:Confirm Hosts - improve responsiveness on filtering of hosts. (atkach)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/185b11ab
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/185b11ab
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/185b11ab

Branch: refs/heads/trunk
Commit: 185b11ab59374540577c468457e7aa5c0ac7dfc1
Parents: 5229fb1
Author: atkach <atkach@hortonworks.com>
Authored: Tue Dec 17 18:49:33 2013 +0200
Committer: atkach <atkach@hortonworks.com>
Committed: Tue Dec 17 18:49:33 2013 +0200

----------------------------------------------------------------------
 .../app/controllers/wizard/step3_controller.js  | 72 +++++++++++---------
 .../app/controllers/wizard/step6_controller.js  |  7 +-
 ambari-web/app/templates/wizard/step3.hbs       |  7 +-
 ambari-web/app/views/wizard/step3_view.js       |  2 +-
 ambari-web/app/views/wizard/step5_view.js       |  4 +-
 5 files changed, 48 insertions(+), 44 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/185b11ab/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 0881316..95c2b0c 100644
--- a/ambari-web/app/controllers/wizard/step3_controller.js
+++ b/ambari-web/app/controllers/wizard/step3_controller.js
@@ -136,6 +136,7 @@ App.WizardStep3Controller = Em.Controller.extend({
     console.log("TRACE: Loading step3: Confirm Hosts");
     this.set('registrationStartedAt', null);
     this.set('isLoaded', false);
+    this.disablePreviousSteps();
 
     this.clearStep();
     this.loadHosts();
@@ -158,14 +159,14 @@ App.WizardStep3Controller = Em.Controller.extend({
       hosts.pushObject(hostInfo);
     }
 
-    if(hosts.length > 100) {
+    if(hosts.length > 200) {
       lazyloading.run({
         destination: this.get('hosts'),
         source: hosts,
         context: this,
-        initSize: 20,
-        chunkSize: 100,
-        delay: 300
+        initSize: 100,
+        chunkSize: 150,
+        delay: 50
       });
     } else {
       this.set('hosts', hosts);
@@ -192,14 +193,21 @@ App.WizardStep3Controller = Em.Controller.extend({
     return this.get('bootHosts').length != 0 && this.get('bootHosts').someProperty('bootStatus',
'RUNNING');
   },
 
-  /* Returns the current set of visible hosts on view (All, Succeeded, Failed) */
-  visibleHosts: function () {
-    if (this.get('category.hostsBootStatus')) {
-      return this.hosts.filterProperty('bootStatus', this.get('category.hostsBootStatus'));
+  filterByCategory: function () {
+    var category = this.get('category.hostsBootStatus');
+    if (category) {
+      this.get('hosts').forEach(function (host) {
+        host.set('isVisible', (category === host.get('bootStatus')));
+      });
     } else { // if (this.get('category') === 'All Hosts')
-      return this.hosts;
+      this.get('hosts').setEach('isVisible', true);
     }
-  }.property('category', 'hosts.@each.bootStatus'),
+  }.observes('category', 'hosts.@each.bootStatus'),
+
+  /* Returns the current set of visible hosts on view (All, Succeeded, Failed) */
+  visibleHosts: function () {
+    return this.get('hosts').filterProperty('isVisible');
+  }.property('hosts.@each.isVisible'),
 
   removeHosts: function (hosts) {
     var self = this;
@@ -272,33 +280,29 @@ App.WizardStep3Controller = Em.Controller.extend({
     this.doBootstrap();
   },
 
-  installationProcess: function() {
-    Ember.run.once(this, 'setInstallationInProgress');
-  }.observes('bootHosts.@each.bootStatus'),
+  isRegistrationInProgress: true,
 
-  isInstallInProgress: true,
-
-  setInstallationInProgress: function() {
-    var result = false;
-    this.get('bootHosts').forEach(function(host) {
-      var status = host.get('bootStatus');
-      if (status != 'REGISTERED' && status != 'FAILED') {
+  setRegistrationInProgress: function () {
+    var bootHosts = this.get('bootHosts');
+    //if hosts aren't loaded yet then registration should be in progress
+    var result = (bootHosts.length === 0);
+    for (var i = 0, l = bootHosts.length; i < l; i++) {
+      if (bootHosts[i].get('bootStatus') !== 'REGISTERED' && bootHosts[i].get('bootStatus')
!== 'FAILED') {
         result = true;
+        break;
       }
-    });
-    this.set('isInstallInProgress',result);
-  },
+    }
+    this.set('isRegistrationInProgress', result);
+  }.observes('bootHosts.@each.bootStatus'),
 
-  disablePreviousSteps: function(){
-    if(this.get('isInstallInProgress')){
-      App.router.get('installerController').setLowerStepsDisable(3);
+  disablePreviousSteps: function () {
+    App.router.get('installerController.isStepDisabled').filter(function (step) {
+      if (step.step >= 0 && step.step <= 2) return true;
+    }).setEach('value', this.get('isRegistrationInProgress'));
+    if (this.get('isRegistrationInProgress')) {
       this.set('isSubmitDisabled', true);
-    } else {
-      App.router.get('installerController.isStepDisabled').filter(function(step){
-        if(step.step >= 0 && step.step <= 2) return true;
-      }).setEach('value', false);
     }
-  }.observes('isInstallInProgress','isLoaded'),
+  }.observes('isRegistrationInProgress'),
 
   doBootstrap: function () {
     if (this.get('stopBootstrap')) {
@@ -735,8 +739,8 @@ App.WizardStep3Controller = Em.Controller.extend({
   }.property('warnings'),
 
   isWarningsBoxVisible: function(){
-    return (App.testMode) ? true : !this.get('isInstallInProgress');
-  }.property('isInstallInProgress'),
+    return (App.testMode) ? true : !this.get('isRegistrationInProgress');
+  }.property('isRegistrationInProgress'),
 
   checksUpdateProgress:0,
   checksUpdateStatus: null,
@@ -1216,7 +1220,7 @@ App.WizardStep3Controller = Em.Controller.extend({
   },
 
   back: function () {
-    if (this.get('isInstallInProgress')) {
+    if (this.get('isRegistrationInProgress')) {
       return;
     }
     App.router.send('back');

http://git-wip-us.apache.org/repos/asf/ambari/blob/185b11ab/ambari-web/app/controllers/wizard/step6_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step6_controller.js b/ambari-web/app/controllers/wizard/step6_controller.js
index e11f4ce..aabf899 100644
--- a/ambari-web/app/controllers/wizard/step6_controller.js
+++ b/ambari-web/app/controllers/wizard/step6_controller.js
@@ -314,14 +314,15 @@ App.WizardStep6Controller = Em.Controller.extend({
         destination: this.get('hosts'),
         source: hostsObj,
         context: this,
-        initSize: 20,
-        chunkSize: 50,
-        delay: 300
+        initSize: 50,
+        chunkSize: 100,
+        delay: 100
       });
     } else {
       hostsObj.forEach(function (host) {
         this.get('hosts').pushObject(host);
       }, this);
+      this.set('isLoaded', true);
     }
     this.get('headers').forEach(function (header) {
       self.checkCallback(header.get('label'));

http://git-wip-us.apache.org/repos/asf/ambari/blob/185b11ab/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 0fec41f..50848c6 100644
--- a/ambari-web/app/templates/wizard/step3.hbs
+++ b/ambari-web/app/templates/wizard/step3.hbs
@@ -71,8 +71,7 @@
         </thead>
 
         <tbody>
-        {{#if visibleHosts.length}}
-        {{#each host in visibleHosts}}
+        {{#each host in hosts}}
         {{#view App.WizardHostView categoryBinding="controller.category" hostInfoBinding="host"}}
         <td>
           {{view Ember.Checkbox checkedBinding="host.isChecked"}}
@@ -98,11 +97,11 @@
         </td>
         {{/view}}
         {{/each}}
-        {{else}}
+        {{#unless visibleHosts.length}}
         <tr>
             <td colspan="5"><p>{{t installer.step3.hosts.noHosts}}</p></td>
         </tr>
-        {{/if}}
+        {{/unless}}
 
         </tbody>
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/185b11ab/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 2684506..051acee 100644
--- a/ambari-web/app/views/wizard/step3_view.js
+++ b/ambari-web/app/views/wizard/step3_view.js
@@ -77,7 +77,7 @@ App.WizardStep3View = Em.View.extend({
 App.WizardHostView = Em.View.extend({
 
   tagName: 'tr',
-  classNameBindings: ['hostInfo.bootStatus'],
+  classNameBindings: ['hostInfo.bootStatus', 'hostInfo.isVisible::hidden'],
   hostInfo: null,
 
   remove: function () {

http://git-wip-us.apache.org/repos/asf/ambari/blob/185b11ab/ambari-web/app/views/wizard/step5_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/wizard/step5_view.js b/ambari-web/app/views/wizard/step5_view.js
index 8fe1894..ee3d4f5 100644
--- a/ambari-web/app/views/wizard/step5_view.js
+++ b/ambari-web/app/views/wizard/step5_view.js
@@ -57,8 +57,8 @@ App.SelectHostView = Em.Select.extend({
         source: source,
         context: this,
         initSize: 30,
-        chunkSize: 50,
-        delay: 200
+        chunkSize: 200,
+        delay: 50
       });
     }
   },


Mime
View raw message