Repository: ambari
Updated Branches:
  refs/heads/branch-2.2 8d9495455 -> 93aba403c


AMBARI-15227: Move HAWQMASTER above HAWQSTANDBY in Assign Masters page 
(mithmatt via jaoki)


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

Branch: refs/heads/branch-2.2
Commit: 93aba403cbbfbdb9830cb13cbc7bc80decc10704
Parents: 8d94954
Author: Jun Aoki <ja...@apache.org>
Authored: Tue Mar 1 16:34:10 2016 -0800
Committer: Jun Aoki <ja...@apache.org>
Committed: Tue Mar 1 16:34:10 2016 -0800

----------------------------------------------------------------------
 .../mixins/wizard/assign_master_components.js   |  3 ++
 ambari-web/app/models/stack_service.js          |  5 +-
 .../test/controllers/wizard/step5_test.js       | 28 ----------
 .../wizard/assign_master_components_test.js     | 55 ++++++++++++++++++++
 4 files changed, 62 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/93aba403/ambari-web/app/mixins/wizard/assign_master_components.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/wizard/assign_master_components.js 
b/ambari-web/app/mixins/wizard/assign_master_components.js
index efcb02e..6fcf335 100644
--- a/ambari-web/app/mixins/wizard/assign_master_components.js
+++ b/ambari-web/app/mixins/wizard/assign_master_components.js
@@ -900,8 +900,11 @@ App.AssignMasterComponents = Em.Mixin.create({
    */
   sortComponentsByServiceName: function(components) {
     var displayOrder = App.StackService.displayOrder;
+    var componentsOrderForService = App.StackService.componentsOrderForService;
     var indexForUnordered = Math.max(displayOrder.length, components.length);
     return components.sort(function (a, b) {
+      if(a.serviceId === b.serviceId && a.serviceId in 
componentsOrderForService)
+        return 
componentsOrderForService[a.serviceId].indexOf(a.component_name) - 
componentsOrderForService[b.serviceId].indexOf(b.component_name);
       var aValue = displayOrder.indexOf(a.serviceId) != -1 ? 
displayOrder.indexOf(a.serviceId) : indexForUnordered;
       var bValue = displayOrder.indexOf(b.serviceId) != -1 ? 
displayOrder.indexOf(b.serviceId) : indexForUnordered;
       return aValue - bValue;

http://git-wip-us.apache.org/repos/asf/ambari/blob/93aba403/ambari-web/app/models/stack_service.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/stack_service.js 
b/ambari-web/app/models/stack_service.js
index 2453514..1580b67 100644
--- a/ambari-web/app/models/stack_service.js
+++ b/ambari-web/app/models/stack_service.js
@@ -214,12 +214,15 @@ App.StackService.displayOrder = [
   'FLUME'
 ];
 
+App.StackService.componentsOrderForService = {
+  'HAWQ': ['HAWQMASTER', 'HAWQSTANDBY']
+};
+
 //@TODO: Write unit test for no two keys in the object should have any 
intersecting elements in their values
 App.StackService.coSelected = {
   'YARN': ['MAPREDUCE2']
 };
 
-
 App.StackService.reviewPageHandlers = {
   'HIVE': {
     'Database': 'loadHiveDbValue'

http://git-wip-us.apache.org/repos/asf/ambari/blob/93aba403/ambari-web/test/controllers/wizard/step5_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step5_test.js 
b/ambari-web/test/controllers/wizard/step5_test.js
index b5e0ddb..995f19c 100644
--- a/ambari-web/test/controllers/wizard/step5_test.js
+++ b/ambari-web/test/controllers/wizard/step5_test.js
@@ -1164,32 +1164,4 @@ describe('App.WizardStep5Controller', function () {
     });
 
   });
-
-  describe('#sortComponentsByServiceName', function () {
-
-    var components = [{
-      "component_name": "METRICS_COLLECTOR",
-      "serviceId": "AMBARI_METRICS"
-    }, {"component_name": "ZOOKEEPER_SERVER", "serviceId": "ZOOKEEPER"}, {
-      "component_name": "NAMENODE",
-      "serviceId": "HDFS"
-    }, {"component_name": "DRPC_SERVER", "serviceId": "STORM"}, {
-      "component_name": "APP_TIMELINE_SERVER",
-      "serviceId": "YARN"
-    }, {"component_name": "RESOURCEMANAGER", "serviceId": "YARN"}, {
-      "component_name": "SECONDARY_NAMENODE",
-      "serviceId": "HDFS"
-    }, {"component_name": "ZOOKEEPER_SERVER", "serviceId": "ZOOKEEPER"}, {
-      "component_name": "HISTORYSERVER",
-      "serviceId": "MAPREDUCE2"
-    }, {"component_name": "NIMBUS", "serviceId": "STORM"}, {"component_name": 
"STORM_UI_SERVER", "serviceId": "STORM"}];
-
-    it('ZKS should be one after anothert', function () {
-      var sorted = c.sortComponentsByServiceName(components);
-      
expect(sorted.mapProperty('component_name').join('|').contains('ZOOKEEPER_SERVER|ZOOKEEPER_SERVER')).to.be.true;
-    });
-
-
-  });
-
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/93aba403/ambari-web/test/mixins/wizard/assign_master_components_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mixins/wizard/assign_master_components_test.js 
b/ambari-web/test/mixins/wizard/assign_master_components_test.js
index d8ccd66..d027343 100644
--- a/ambari-web/test/mixins/wizard/assign_master_components_test.js
+++ b/ambari-web/test/mixins/wizard/assign_master_components_test.js
@@ -151,4 +151,59 @@ describe('App.AssignMasterComponents', function () {
     });
 
   });
+
+  describe('#sortComponentsByServiceName', function () {
+
+    var components = [{
+      "component_name": "METRICS_COLLECTOR",
+      "serviceId": "AMBARI_METRICS"
+    }, {
+      "component_name": "ZOOKEEPER_SERVER",
+      "serviceId": "ZOOKEEPER"
+    }, {
+      "component_name": "NAMENODE",
+      "serviceId": "HDFS"
+    }, {
+      "component_name": "DRPC_SERVER",
+      "serviceId": "STORM"
+    }, {
+      "component_name": "APP_TIMELINE_SERVER",
+      "serviceId": "YARN"
+    }, {
+      "component_name": "RESOURCEMANAGER",
+      "serviceId": "YARN"
+    }, {
+      "component_name": "SECONDARY_NAMENODE",
+      "serviceId": "HDFS"
+    }, {
+      "component_name": "ZOOKEEPER_SERVER",
+      "serviceId": "ZOOKEEPER"
+    }, {
+      "component_name": "HISTORYSERVER",
+      "serviceId": "MAPREDUCE2"
+    }, {
+      "component_name": "HAWQSTANDBY",
+      "serviceId": "HAWQ"
+    }, {
+      "component_name": "NIMBUS",
+      "serviceId": "STORM"
+    }, {
+      "component_name": "HAWQMASTER",
+      "serviceId": "HAWQ"
+    }, {
+      "component_name": "STORM_UI_SERVER",
+      "serviceId": "STORM"
+    }];
+
+    it('should place ZOOKEEPER_SERVER one after another', function () {
+      var sorted = c.sortComponentsByServiceName(components);
+      
expect(sorted.mapProperty('component_name').join('|').contains('ZOOKEEPER_SERVER|ZOOKEEPER_SERVER')).to.be.true;
+    });
+
+    it('should place HAWQMASTER just before HAWQSTANDBY', function () {
+      var sorted = c.sortComponentsByServiceName(components);
+      
expect(sorted.mapProperty('component_name').join('|').contains('HAWQMASTER|HAWQSTANDBY')).to.be.true;
+    });
+
+  });
 });
\ No newline at end of file

Reply via email to