You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by al...@apache.org on 2013/11/28 22:31:13 UTC

[1/2] git commit: AMBARI-3850. Config-groups should be sorted in manage config-groups dialog (alexantonenko)

Updated Branches:
  refs/heads/trunk 929647d93 -> e86e013ea


AMBARI-3850. Config-groups should be sorted in manage config-groups dialog (alexantonenko)


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

Branch: refs/heads/trunk
Commit: 60bbb1d53b1f605096aeab0e1842eb949e60f470
Parents: 929647d
Author: Alex Antonenko <hi...@gmail.com>
Authored: Thu Nov 28 23:18:06 2013 +0200
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Thu Nov 28 23:18:06 2013 +0200

----------------------------------------------------------------------
 .../controllers/main/service/info/configs.js    | 10 +++----
 .../service/manage_config_groups_controller.js  | 29 ++++++++++++++------
 2 files changed, 25 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/60bbb1d5/ambari-web/app/controllers/main/service/info/configs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/info/configs.js b/ambari-web/app/controllers/main/service/info/configs.js
index 8e7403b..516b362 100644
--- a/ambari-web/app/controllers/main/service/info/configs.js
+++ b/ambari-web/app/controllers/main/service/info/configs.js
@@ -323,13 +323,11 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
     if (!selectedConfigGroup) {
       selectedConfigGroup = defaultConfigGroup;
     }
-    this.get('configGroups').push(defaultConfigGroup);
-    this.get('configGroups').sort(function(configGroup){
-      if(configGroup.isDefault){
-        return false;
-      }
-      return true;
+
+    this.get('configGroups').sort(function(configGroupA, configGroupB){
+      return (configGroupA.name > configGroupB.name);
     });
+    this.get('configGroups').unshift(defaultConfigGroup);
     this.set('selectedConfigGroup', selectedConfigGroup);
   },
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/60bbb1d5/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 2729bed..9e9d361 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
@@ -38,6 +38,23 @@ App.ManageConfigGroupsController = Em.Controller.extend({
 
   usedConfigGroupNames: [],
 
+  resortConfigGroup: function() {
+    var configGroups = Ember.copy(this.get('configGroups'));
+    if(configGroups.length < 2){
+      return;
+    }
+    var defaultConfigGroup = configGroups.findProperty('isDefault');
+    configGroups.removeObject(defaultConfigGroup);
+    var sorted = configGroups.sort(function(configGroupA, configGroupB){
+      return String(configGroupA.get('name')) >= String(configGroupB.get('name'));
+    });
+    sorted = [defaultConfigGroup].concat(sorted);
+
+    this.removeObserver('configGroups.@each.name', this, 'resortConfigGroup');
+    this.set('configGroups', sorted);
+    this.addObserver('configGroups.@each.name', this, 'resortConfigGroup');
+  }.observes('configGroups.@each.name'),
+
   loadConfigGroups: function (serviceName) {
     this.set('serviceName', serviceName);
     App.ajax.send({
@@ -107,12 +124,6 @@ App.ManageConfigGroupsController = Em.Controller.extend({
       defaultConfigGroup.set('childConfigGroups', configGroups);
       defaultConfigGroup.set('hosts', unusedHosts);
       this.set('configGroups', [defaultConfigGroup].concat(configGroups));
-      this.get('configGroups').sort(function(configGroup){
-        if(configGroup.isDefault){
-          return false;
-        }
-        return true;
-      });
       this.loadProperties(groupToTypeToTagMap);
       this.set('isLoaded', true);
     }
@@ -454,8 +465,10 @@ App.ManageConfigGroupsController = Em.Controller.extend({
   },
 
   successLoadingConfigGroup: function (data) {
-    var confGroup = this.get('configGroups').findProperty('id', data.ConfigGroup.id);
-    confGroup.set('apiResponse', data.ConfigGroup);
+    if(data.ConfigGroup) {
+      var confGroup = this.get('configGroups').findProperty('id', data.ConfigGroup.id);
+      confGroup.set('apiResponse', data.ConfigGroup);
+    }
   },
 
   /**


[2/2] git commit: AMBARI-3925. Adding host to multiple groups at the same time fails (alexantonenko)

Posted by al...@apache.org.
AMBARI-3925. Adding host to multiple groups at the same time fails (alexantonenko)


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

Branch: refs/heads/trunk
Commit: e86e013eab5f0dc98b78811ea810f5eee4d3bbaa
Parents: 60bbb1d
Author: Alex Antonenko <hi...@gmail.com>
Authored: Thu Nov 28 23:23:42 2013 +0200
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Thu Nov 28 23:23:42 2013 +0200

----------------------------------------------------------------------
 .../main/service/manage_config_groups_controller.js           | 7 +++++++
 1 file changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/e86e013e/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 9e9d361..1e846ba 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
@@ -314,10 +314,14 @@ App.ManageConfigGroupsController = Em.Controller.extend({
         if (!this.get('enablePrimary')) {
           return false;
         }
+        var copyHsots = this.get('content.loadedHostsToGroupMap')[this.get('content.selectedConfigGroup.name')];
+        delete this.get('content.loadedHostsToGroupMap')[this.get('content.selectedConfigGroup.name')];
+        this.get('content.loadedHostsToGroupMap')[this.get('configGroupName')] = copyHsots;
         this.get('content.selectedConfigGroup').set('name', this.get('configGroupName'));
         this.get('content.selectedConfigGroup').set('description', this.get('configGroupDesc'));
         this.get('content.selectedConfigGroup.apiResponse').group_name = this.get('configGroupName');
         this.get('content.selectedConfigGroup.apiResponse').description = this.get('configGroupDesc');
+
         var configGroup = {
           ConfigGroup: this.get('content.selectedConfigGroup.apiResponse')
         };
@@ -594,6 +598,9 @@ App.InstallerManageConfigGroupsController = App.ManageConfigGroupsController.ext
         if (!this.get('enablePrimary')) {
           return false;
         }
+        var copyHsots = self.get('loadedHostsToGroupMap')[self.get('selectedConfigGroup.name')];
+        delete self.get('loadedHostsToGroupMap')[self.get('selectedConfigGroup.name')];
+        self.get('loadedHostsToGroupMap')[this.get('configGroupName')] = copyHsots;
         self.set('selectedConfigGroup.name', this.get('configGroupName'));
         self.set('selectedConfigGroup.description', this.get('configGroupDesc'));
         this.hide();