ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From atk...@apache.org
Subject git commit: AMBARI-5243 Confirm Hosts step: perfomance optimization in order to support large number of hosts. (atkach)
Date Thu, 27 Mar 2014 16:01:27 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 4eec338e3 -> 6d865b76e


AMBARI-5243 Confirm Hosts step: perfomance optimization in order to support large number 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/6d865b76
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/6d865b76
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/6d865b76

Branch: refs/heads/trunk
Commit: 6d865b76ec93983de1699f77738082837b08c4d9
Parents: 4eec338
Author: atkach <atkach@hortonworks.com>
Authored: Thu Mar 27 17:58:28 2014 +0200
Committer: atkach <atkach@hortonworks.com>
Committed: Thu Mar 27 17:58:45 2014 +0200

----------------------------------------------------------------------
 .../app/controllers/wizard/step2_controller.js  | 14 ++++++++-
 .../app/controllers/wizard/step3_controller.js  | 30 +++++++++++++++-----
 .../app/templates/common/items_list_popup.hbs   |  2 +-
 ambari-web/app/views/wizard/step3_view.js       | 18 ++++++++----
 ambari-web/test/installer/step3_test.js         | 23 ---------------
 5 files changed, 49 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/6d865b76/ambari-web/app/controllers/wizard/step2_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step2_controller.js b/ambari-web/app/controllers/wizard/step2_controller.js
index e2eec44..babdf31 100644
--- a/ambari-web/app/controllers/wizard/step2_controller.js
+++ b/ambari-web/app/controllers/wizard/step2_controller.js
@@ -18,6 +18,7 @@
 
 var App = require('app');
 var validator = require('utils/validator');
+var lazyloading = require('utils/lazy_loading');
 
 App.WizardStep2Controller = Em.Controller.extend({
   name: 'wizardStep2Controller',
@@ -310,7 +311,18 @@ App.WizardStep2Controller = Em.Controller.extend({
       },
       bodyClass: Ember.View.extend({
         templateName: require('templates/common/items_list_popup'),
-        items: hostNames
+        items: hostNames,
+        insertedItems: [],
+        didInsertElement: function() {
+          lazyloading.run({
+            destination: this.get('insertedItems'),
+            source: this.get('items'),
+            context: this,
+            initSize: 100,
+            chunkSize: 500,
+            delay: 100
+          });
+        }
       })
     });
   },

http://git-wip-us.apache.org/repos/asf/ambari/blob/6d865b76/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 b3720a3..f1796f5 100644
--- a/ambari-web/app/controllers/wizard/step3_controller.js
+++ b/ambari-web/app/controllers/wizard/step3_controller.js
@@ -43,7 +43,7 @@ App.WizardStep3Controller = Em.Controller.extend({
 
   navigateStep: function () {
     if(this.get('isLoaded')){
-      if (this.get('content.installOptions.manualInstall') !== true) {
+      if (!this.get('content.installOptions.manualInstall')) {
         if (!this.get('wizardController').getDBProperty('bootStatus')) {
           this.startBootstrap();
         }
@@ -51,13 +51,11 @@ App.WizardStep3Controller = Em.Controller.extend({
         this.set('bootHosts', this.get('hosts'));
         if (App.testMode) {
           this.getHostInfo();
-          this.get('bootHosts').setEach('bootStatus', 'REGISTERED');
           this.get('bootHosts').setEach('cpu', '2');
           this.get('bootHosts').setEach('memory', '2000000');
           this.set('isSubmitDisabled', false);
         } else {
           this.set('registrationStartedAt', null);
-          this.get('bootHosts').setEach('bootStatus', 'DONE');
           this.startRegistration();
         }
       }
@@ -88,11 +86,15 @@ App.WizardStep3Controller = Em.Controller.extend({
   loadHosts: function () {
     var hostsInfo = this.get('content.hosts');
     var hosts = [];
+    var bootStatus = (this.get('content.installOptions.manualInstall')) ? 'DONE' : 'PENDING';
+    if (App.testMode) {
+      bootStatus = 'REGISTERED';
+    }
 
     for (var index in hostsInfo) {
       var hostInfo = App.HostInfo.create({
         name: hostsInfo[index].name,
-        bootStatus: hostsInfo[index].bootStatus,
+        bootStatus: bootStatus,
         isChecked: false
       });
 
@@ -159,8 +161,19 @@ App.WizardStep3Controller = Em.Controller.extend({
       },
       secondary: null,
       bodyClass: Ember.View.extend({
+        templateName: require('templates/common/items_list_popup'),
         items: selectedHosts,
-        templateName: require('templates/common/items_list_popup')
+        insertedItems: [],
+        didInsertElement: function() {
+          lazyloading.run({
+            destination: this.get('insertedItems'),
+            source: this.get('items'),
+            context: this,
+            initSize: 100,
+            chunkSize: 500,
+            delay: 100
+          });
+        }
       })
     });
   },
@@ -206,12 +219,15 @@ App.WizardStep3Controller = Em.Controller.extend({
     this.numPolls = 0;
     this.set('registrationStartedAt', null);
     this.set('bootHosts', this.get('hosts'));
-    this.get('bootHosts').setEach('bootStatus', 'PENDING');
     this.doBootstrap();
   },
 
   isRegistrationInProgress: true,
 
+  setRegistrationInProgressOnce: function () {
+    Ember.run.once(this, 'setRegistrationInProgress');
+  }.observes('bootHosts.@each.bootStatus'),
+
   setRegistrationInProgress: function () {
     var bootHosts = this.get('bootHosts');
     //if hosts aren't loaded yet then registration should be in progress
@@ -223,7 +239,7 @@ App.WizardStep3Controller = Em.Controller.extend({
       }
     }
     this.set('isRegistrationInProgress', result);
-  }.observes('bootHosts.@each.bootStatus'),
+  },
 
   disablePreviousSteps: function () {
     App.router.get('installerController.isStepDisabled').filter(function (step) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/6d865b76/ambari-web/app/templates/common/items_list_popup.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/items_list_popup.hbs b/ambari-web/app/templates/common/items_list_popup.hbs
index 6544a1b..214a297 100644
--- a/ambari-web/app/templates/common/items_list_popup.hbs
+++ b/ambari-web/app/templates/common/items_list_popup.hbs
@@ -16,6 +16,6 @@
 * limitations under the License.
 }}
 
-{{#each item in view.items}}
+{{#each item in view.insertedItems}}
     <p>{{item}}</p>
 {{/each}}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/6d865b76/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 f953e68..38c8843 100644
--- a/ambari-web/app/views/wizard/step3_view.js
+++ b/ambari-web/app/views/wizard/step3_view.js
@@ -67,12 +67,12 @@ App.WizardStep3View = App.TableView.extend({
     this.get('content').setEach('isChecked', false);
   },
 
-  watchSelectionOnce: function(){
+  watchSelectionOnce: function () {
     Em.run.once(this, 'watchSelection');
-  }.observes('content.@each.isChecked'),
+  }.observes('content.@each.isChecked', 'pageContent'),
 
   /**
-   * watch selection and calculate flags as:
+   * watch selection and calculate such flags as:
    * - noHostsSelected
    * - selectedHostsCount
    * - pageChecked
@@ -116,6 +116,12 @@ App.WizardStep3View = App.TableView.extend({
     ];
   }.property(),
 
+  hostBootStatusObserver: function(){
+    Ember.run.once(this, 'countCategoryHosts');
+    Ember.run.once(this, 'filter');
+    Ember.run.once(this, 'monitorStatuses');
+  }.observes('content.@each.bootStatus'),
+
   countCategoryHosts: function () {
     var counters = {
       "RUNNING": 0,
@@ -132,7 +138,7 @@ App.WizardStep3View = App.TableView.extend({
     this.get('categories').forEach(function(category) {
       category.set('hostsCount', counters[category.get('hostsBootStatus')]);
     }, this);
-  }.observes('content.@each.bootStatus'),
+  },
 
 
   /**
@@ -147,7 +153,7 @@ App.WizardStep3View = App.TableView.extend({
       result = this.get('content').filterProperty('bootStatus', this.get('selectedCategory.hostsBootStatus'));
     }
     this.set('filteredContent', result);
-  }.observes('content.@each.bootStatus', 'selectedCategory'),
+  }.observes('selectedCategory'),
   /**
    * Trigger on Category click
    * @param {Object} event
@@ -193,7 +199,7 @@ App.WizardStep3View = App.TableView.extend({
         this.set('message', Em.I18n.t('installer.step3.warnings.someWarnings').format((hosts.length
- failedHosts), failedHosts));
       }
     }
-  }.observes('controller.isWarningsLoaded', 'controller.isHostHaveWarnings', 'controller.bootHosts.@each.bootStatus',
'controller.repoCategoryWarnings', 'controller.diskCategoryWarnings')
+  }.observes('controller.isWarningsLoaded', 'controller.isHostHaveWarnings', 'controller.repoCategoryWarnings',
'controller.diskCategoryWarnings')
 });
 
 //todo: move it inside WizardStep3View

http://git-wip-us.apache.org/repos/asf/ambari/blob/6d865b76/ambari-web/test/installer/step3_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/installer/step3_test.js b/ambari-web/test/installer/step3_test.js
index 071f0d3..9818f40 100644
--- a/ambari-web/test/installer/step3_test.js
+++ b/ambari-web/test/installer/step3_test.js
@@ -281,27 +281,4 @@ describe('App.WizardStep3Controller', function () {
       });
     });
   });
-
-  describe('#noHostsSelected', function() {
-    tests.forEach(function(test) {
-      it(test.m + ' - nothing checked', function() {
-        var controller = App.WizardStep3Controller.create({
-          hosts: test.bootHosts
-        });
-        controller.get('hosts').setEach('isChecked', false);
-        console.log(controller.hosts);
-        expect(controller.get('noHostsSelected')).to.equal(true);
-      });
-      it(test.m + ' - one checked', function() {
-        var controller = App.WizardStep3Controller.create({
-          hosts: test.bootHosts
-        });
-        controller.get('hosts').setEach('isChecked', true);
-        expect(controller.get('noHostsSelected')).to.equal(false);
-      });
-    });
-  });
-
-
-
 });
\ No newline at end of file


Mime
View raw message