Browse Source

AMBARI-4041. Host list changing order in Move wizard. (Mikhail Bayuk via alexantonenko)

Alex Antonenko 11 years ago
parent
commit
c54e6cd333

+ 4 - 0
ambari-web/app/controllers/main/service/reassign/step2_controller.js

@@ -20,14 +20,18 @@ var App = require('app');
 
 App.ReassignMasterWizardStep2Controller = App.WizardStep5Controller.extend({
 
+  currentHostId: null,
+
   loadStep: function() {
     this._super();
     this.rebalanceComponentHosts('NAMENODE');
+    this.rebalanceComponentHosts('SECONDARY_NAMENODE');
   },
 
   loadComponents: function () {
     var components = this.get('components').filterProperty('isMaster', true);
     var masterComponents = this.get('content.masterComponentHosts');
+    this.set('currentHostId', this.get('content').get('reassign').host_id);
     var componentNameToReassign = this.get('content').get('reassign').component_name;
     var result = [];
     masterComponents.forEach(function (master) {

+ 9 - 2
ambari-web/app/controllers/wizard/step5_controller.js

@@ -629,8 +629,15 @@ App.WizardStep5Controller = Em.Controller.extend({
 
     currentComponents.forEach(function (item) {
       preparedAvailableHosts = availableComponentHosts.slice(0);
-      preparedAvailableHosts.pushObject(this.get("hosts").findProperty("host_name", item.get("selectedHost")))
-      preparedAvailableHosts.sort(this.sortHostsByConfig, this);
+      if (this.get('content.controllerName') != 'reassignMasterController') {
+        preparedAvailableHosts.pushObject(this.get("hosts").findProperty("host_name", item.get("selectedHost")));
+      } else {
+        if(item.get("host_name") != this.get('content.currentHostId')) {
+          preparedAvailableHosts.pushObject(this.get("hosts").findProperty("host_name", item.get("host_name")));
+        }
+        item.set("selectedHost", preparedAvailableHosts.objectAt(0).host_name);
+      }
+      preparedAvailableHosts.sort(this.sortHostsByName, this);
       item.set("availableHosts", preparedAvailableHosts);
     }, this);
   },

+ 1 - 0
ambari-web/app/messages.js

@@ -1158,6 +1158,7 @@ Em.I18n.translations = {
     'for cluster downtime when moving {0}.</b>',
 
   'services.reassign.step2.header':'Assign Master',
+  'services.reassign.step2.currentHost':'Current:',
   'services.reassign.step2.body':'Assign {0} to new host.',
   'services.reassign.step2.body.namenodeHA':'Move {0} to new host. You can move only one master component at a time.',
   'services.reassign.step3.header':'Review',

+ 5 - 0
ambari-web/app/templates/wizard/step5.hbs

@@ -26,6 +26,11 @@
 </div>
 <div class="assign-masters">
   <div class="select-hosts">
+    {{#if currentHostId}}
+      <div class="control-group offset1">{{t services.reassign.step2.currentHost}}
+        <span>{{currentHostId}}</span>
+      </div>
+    {{/if}}
     <form class="form-horizontal" autocomplete="off">
       <!-- View for array controller -->
       {{#each servicesMasters}}