ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From atk...@apache.org
Subject git commit: AMBARI-5026 Assigning hosts to Config group takes a minute and Ok button is not greyed out. (atkach)
Date Tue, 11 Mar 2014 15:56:27 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 97cff09d2 -> 4edcf069a


AMBARI-5026 Assigning hosts to Config group takes a minute and Ok button is not greyed out.
(atkach)


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

Branch: refs/heads/trunk
Commit: 4edcf069a150657b6d1b6e19ead33f79c7a01d35
Parents: 97cff09
Author: atkach <atkach@hortonworks.com>
Authored: Tue Mar 11 17:50:45 2014 +0200
Committer: atkach <atkach@hortonworks.com>
Committed: Tue Mar 11 17:50:45 2014 +0200

----------------------------------------------------------------------
 .../main/service/manage_config_groups_controller.js       |  6 ++++--
 ambari-web/app/models/config_group.js                     |  5 +++--
 ambari-web/app/utils/hosts.js                             | 10 +++-------
 3 files changed, 10 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/4edcf069/ambari-web/app/controllers/main/service/manage_config_groups_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/manage_config_groups_controller.js b/ambari-web/app/controllers/main/service/manage_config_groups_controller.js
index ff0bca1..58e5d1d 100644
--- a/ambari-web/app/controllers/main/service/manage_config_groups_controller.js
+++ b/ambari-web/app/controllers/main/service/manage_config_groups_controller.js
@@ -203,12 +203,13 @@ App.ManageConfigGroupsController = Em.Controller.extend({
   addHostsCallback: function (selectedHosts) {
     var group = this.get('selectedConfigGroup');
     if (selectedHosts) {
-      var defaultHosts = group.get('parentConfigGroup.hosts');
+      var defaultHosts = group.get('parentConfigGroup.hosts').slice();
       var configGroupHosts = group.get('hosts');
       selectedHosts.forEach(function (hostName) {
         configGroupHosts.pushObject(hostName);
         defaultHosts.removeObject(hostName);
       });
+      group.set('parentConfigGroup.hosts', defaultHosts);
     }
   },
 
@@ -220,11 +221,12 @@ App.ManageConfigGroupsController = Em.Controller.extend({
       return;
     }
     var groupHosts = this.get('selectedConfigGroup.hosts');
-    var defaultGroupHosts = this.get('selectedConfigGroup.parentConfigGroup.hosts');
+    var defaultGroupHosts = this.get('selectedConfigGroup.parentConfigGroup.hosts').slice();
     this.get('selectedHosts').slice().forEach(function (hostName) {
       defaultGroupHosts.pushObject(hostName);
       groupHosts.removeObject(hostName);
     });
+    this.set('selectedConfigGroup.parentConfigGroup.hosts', defaultGroupHosts);
     this.set('selectedHosts', []);
   },
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/4edcf069/ambari-web/app/models/config_group.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/config_group.js b/ambari-web/app/models/config_group.js
index 0c19507..bd5a8e2 100644
--- a/ambari-web/app/models/config_group.js
+++ b/ambari-web/app/models/config_group.js
@@ -117,11 +117,12 @@ App.ConfigGroup = Ember.Object.extend({
     this.get('parentConfigGroup.hosts').forEach(function (hostName) {
       unusedHostsMap[hostName] = true;
     });
-    App.Host.find().filter(function (host) {
+    App.Host.find().forEach(function (host) {
       if(unusedHostsMap[host.get('id')]) {
         availableHosts.pushObject(Ember.Object.create({
           selected: false,
-          host: host
+          host: host,
+          hostComponentNames: host.get('hostComponents').mapProperty('componentName')
         }));
       }
     });

http://git-wip-us.apache.org/repos/asf/ambari/blob/4edcf069/ambari-web/app/utils/hosts.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/hosts.js b/ambari-web/app/utils/hosts.js
index a532fda..2a3d513 100644
--- a/ambari-web/app/utils/hosts.js
+++ b/ambari-web/app/utils/hosts.js
@@ -50,12 +50,8 @@ module.exports = {
       warningMessage: null,
       onPrimary: function () {
         this.set('warningMessage', null);
-        var arrayOfSelectedHosts = [];
-        var selectedHosts = availableHosts.filterProperty('selected', true);
-        selectedHosts.forEach(function (host) {
-          arrayOfSelectedHosts.push(host.get('host.id'));
-        });
-        if (selectAtleastOneHost && arrayOfSelectedHosts.length<1) {
+        var arrayOfSelectedHosts = availableHosts.filterProperty('selected', true).mapProperty('host.id');
+        if (selectAtleastOneHost && arrayOfSelectedHosts.length < 1) {
           this.set('warningMessage', Em.I18n.t('hosts.selectHostsDialog.message.warning'));
           return;
         }
@@ -99,7 +95,7 @@ module.exports = {
           this.get('availableHosts').forEach(function (host) {
             var skip = showOnlySelectedHosts && !host.get('selected');
             var value = host.get('host').get(filterColumn.id);
-            var hostComponentNames = host.get('host.hostComponents').mapProperty('componentName');
+            var hostComponentNames = host.get('hostComponentNames');
 
             host.set('filterColumnValue', value);
 


Mime
View raw message