You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by on...@apache.org on 2015/05/27 17:49:29 UTC
ambari git commit: AMBARI-11432. Incorrect placing of ZooKeeper
Servers' comboboxes (onechiporenko)
Repository: ambari
Updated Branches:
refs/heads/trunk 30cb201dd -> 34bffa8a5
AMBARI-11432. Incorrect placing of ZooKeeper Servers' comboboxes (onechiporenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/34bffa8a
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/34bffa8a
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/34bffa8a
Branch: refs/heads/trunk
Commit: 34bffa8a538360c3fa0bb53d1e50888e09b607e2
Parents: 30cb201
Author: Oleg Nechiporenko <on...@apache.org>
Authored: Wed May 27 18:44:19 2015 +0300
Committer: Oleg Nechiporenko <on...@apache.org>
Committed: Wed May 27 18:44:19 2015 +0300
----------------------------------------------------------------------
.../mixins/wizard/assign_master_components.js | 22 +++++++++++-----
.../test/controllers/wizard/step5_test.js | 27 ++++++++++++++++++++
2 files changed, 43 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/34bffa8a/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 69a21d5..d3d674a 100644
--- a/ambari-web/app/mixins/wizard/assign_master_components.js
+++ b/ambari-web/app/mixins/wizard/assign_master_components.js
@@ -475,9 +475,11 @@ App.AssignMasterComponents = Em.Mixin.create({
* @method clearStep
*/
clearStep: function () {
- this.set('hosts', []);
- this.set('selectedServicesMasters', []);
- this.set('servicesMasters', []);
+ this.setProperties({
+ hosts: [],
+ selectedServicesMasters: [],
+ servicesMasters: []
+ });
App.StackServiceComponent.find().forEach(function (stackComponent) {
stackComponent.set('serviceComponentId', 1);
}, this);
@@ -836,11 +838,19 @@ App.AssignMasterComponents = Em.Mixin.create({
return App.StackServiceComponent.find().findProperty('componentName', master).get('serviceName');
},
+ /**
+ * Sort components by their service (using <code>App.StackService.displayOrder</code>)
+ * Services not in App.StackService.displayOrder are moved to the end of the list
+ *
+ * @param components
+ * @returns {*}
+ */
sortComponentsByServiceName: function(components) {
var displayOrder = App.StackService.displayOrder;
+ var indexForUnordered = Math.max(displayOrder.length, components.length);
return components.sort(function (a, b) {
- var aValue = displayOrder.indexOf(a.serviceId) != -1 ? displayOrder.indexOf(a.serviceId) : components.length;
- var bValue = displayOrder.indexOf(b.serviceId) != -1 ? displayOrder.indexOf(b.serviceId) : components.length;
+ 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;
});
},
@@ -852,7 +862,7 @@ App.AssignMasterComponents = Em.Mixin.create({
var components = App.StackServiceComponent.find().filterProperty('isOtherComponentCoHosted');
var selectedServicesMasters = this.get('selectedServicesMasters');
components.forEach(function (component) {
- var componentName = component.get('componentName')
+ var componentName = component.get('componentName');
var hostComponent = selectedServicesMasters.findProperty('component_name', componentName);
var dependentCoHosts = component.get('coHostedComponents');
dependentCoHosts.forEach(function (coHostedComponent) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/34bffa8a/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 1f25fe7..b5e0ddb 100644
--- a/ambari-web/test/controllers/wizard/step5_test.js
+++ b/ambari-web/test/controllers/wizard/step5_test.js
@@ -1165,4 +1165,31 @@ 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;
+ });
+
+
+ });
+
});