Browse Source

AMBARI-6737. Layout assign master components by Service. (Denys Buzhor via akovalenko)

Aleksandr Kovalenko 11 years ago
parent
commit
a431c7588b
1 changed files with 10 additions and 0 deletions
  1. 10 0
      ambari-web/app/controllers/wizard/step5_controller.js

+ 10 - 0
ambari-web/app/controllers/wizard/step5_controller.js

@@ -555,6 +555,7 @@ App.WizardStep5Controller = Em.Controller.extend({
       componentObj.set('isHostNameValid', true);
       componentObj.set('isHostNameValid', true);
       result.push(componentObj);
       result.push(componentObj);
     }, this);
     }, this);
+    result = this.sortComponentsByServiceName(result);
     this.set("selectedServicesMasters", result);
     this.set("selectedServicesMasters", result);
     if (this.get('isReassignWizard')) {
     if (this.get('isReassignWizard')) {
       var components = result.filterProperty('component_name', this.get('content.reassign.component_name'));
       var components = result.filterProperty('component_name', this.get('content.reassign.component_name'));
@@ -565,6 +566,15 @@ App.WizardStep5Controller = Em.Controller.extend({
     }
     }
   },
   },
 
 
+  sortComponentsByServiceName: function(components) {
+    var _components = components.sortPropertyLight('selectedHost');
+    var displayOrder = App.StackService.displayOrder;
+    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;
+      return aValue - bValue;
+    });
+  },
   /**
   /**
    * Update dependent co-hosted components according to the change in the component host
    * Update dependent co-hosted components according to the change in the component host
    * @method updateCoHosts
    * @method updateCoHosts