ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ja...@apache.org
Subject ambari git commit: AMBARI-15227: Move HAWQMASTER above HAWQSTANDBY in Assign Masters page (mithmatt via jaoki)
Date Wed, 02 Mar 2016 00:33:00 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 874d4d577 -> fa38d29a1


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/fa38d29a
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/fa38d29a
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/fa38d29a

Branch: refs/heads/trunk
Commit: fa38d29a13fe26625f7225d249f72d05e997fa3b
Parents: 874d4d5
Author: Jun Aoki <jaoki@apache.org>
Authored: Tue Mar 1 16:32:49 2016 -0800
Committer: Jun Aoki <jaoki@apache.org>
Committed: Tue Mar 1 16:32:49 2016 -0800

----------------------------------------------------------------------
 .../mixins/wizard/assign_master_components.js   |  3 ++
 ambari-web/app/models/stack_service.js          |  4 ++
 .../test/controllers/wizard/step5_test.js       | 27 ----------
 .../wizard/assign_master_components_test.js     | 56 ++++++++++++++++++++
 4 files changed, 63 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/fa38d29a/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 c1c4d0e..0500014 100644
--- a/ambari-web/app/mixins/wizard/assign_master_components.js
+++ b/ambari-web/app/mixins/wizard/assign_master_components.js
@@ -897,8 +897,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/fa38d29a/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 a8ce241..dbfabc0 100644
--- a/ambari-web/app/models/stack_service.js
+++ b/ambari-web/app/models/stack_service.js
@@ -204,6 +204,10 @@ 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']

http://git-wip-us.apache.org/repos/asf/ambari/blob/fa38d29a/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 a2bc687..4140210 100644
--- a/ambari-web/test/controllers/wizard/step5_test.js
+++ b/ambari-web/test/controllers/wizard/step5_test.js
@@ -1261,33 +1261,6 @@ 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;
-    });
-
-
-  });
-
   describe('#submit',function(){
     it('if Next button is clicked multiple times before the next step renders, it must not
be processed',function(){
       c.reopen({isSubmitDisabled:false, submitDisabled:false, useServerValidation:false});

http://git-wip-us.apache.org/repos/asf/ambari/blob/fa38d29a/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..ecdb456 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,60 @@ 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


Mime
View raw message