step5_controller.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. var App = require('app');
  19. var numberUtils = require('utils/number_utils');
  20. App.WizardStep5Controller = Em.Controller.extend({
  21. name: "wizardStep5Controller",
  22. /**
  23. * Step title
  24. * Custom if <code>App.ReassignMasterController</code> is used
  25. * @type {string}
  26. */
  27. title: function () {
  28. if (this.get('content.controllerName') == 'reassignMasterController') {
  29. return Em.I18n.t('installer.step5.reassign.header');
  30. }
  31. return Em.I18n.t('installer.step5.header');
  32. }.property('content.controllerName'),
  33. /**
  34. * Is ReassignWizard used
  35. * @type {bool}
  36. */
  37. isReassignWizard: function () {
  38. return this.get('content.controllerName') == 'reassignMasterController';
  39. }.property('content.controllerName'),
  40. /**
  41. * Is AddServiceWizard used
  42. * @type {bool}
  43. */
  44. isAddServiceWizard: function () {
  45. return this.get('content.controllerName') == 'addServiceController';
  46. }.property('content.controllerName'),
  47. /**
  48. * Is Hive reassigning
  49. * @type {bool}
  50. */
  51. isReassignHive: function () {
  52. return this.get('servicesMasters').objectAt(0) && this.get('servicesMasters').objectAt(0).component_name == 'HIVE_SERVER' && this.get('isReassignWizard');
  53. }.property('isReassignWizard', 'servicesMasters'),
  54. /**
  55. * Master components which could be assigned to multiple hosts
  56. * @type {string[]}
  57. */
  58. multipleComponents: ['ZOOKEEPER_SERVER', 'HBASE_MASTER'],
  59. /**
  60. * Define state for submit button. Return true only for Reassign Master Wizard and if more than one master component was reassigned.
  61. * @type {bool}
  62. */
  63. isSubmitDisabled: function () {
  64. if (!this.get('isReassignWizard')) {
  65. return false;
  66. }
  67. var reassigned = 0;
  68. var arr1 = App.HostComponent.find().filterProperty('componentName', this.get('content.reassign.component_name')).mapProperty('host.hostName');
  69. var arr2 = this.get('servicesMasters').mapProperty('selectedHost');
  70. arr1.forEach(function (host) {
  71. if (!arr2.contains(host)) {
  72. reassigned++;
  73. }
  74. }, this);
  75. return reassigned !== 1;
  76. }.property('servicesMasters.@each.selectedHost'),
  77. /**
  78. * List of hosts
  79. * @type {Array}
  80. */
  81. hosts: [],
  82. /**
  83. * @type {Object|null}
  84. */
  85. componentToRebalance: null,
  86. /**
  87. * @type {number}
  88. */
  89. rebalanceComponentHostsCounter: 0,
  90. /**
  91. * @type {Ember.Enumerable}
  92. */
  93. servicesMasters: [],
  94. /**
  95. * @type {Ember.Enumerable}
  96. */
  97. selectedServicesMasters: [],
  98. /**
  99. * Check if HIVE_SERVER component exist (also checks if this is not reassign)
  100. * @type {bool}
  101. */
  102. hasHiveServer: function () {
  103. return this.get('selectedServicesMasters').someProperty('component_name', 'HIVE_SERVER') && !this.get('isReassignWizard');
  104. }.property('selectedServicesMasters'),
  105. /**
  106. * List of host with assigned masters
  107. * Format:
  108. * <code>
  109. * [
  110. * {
  111. * host_name: '',
  112. * hostInfo: {},
  113. * masterServices: []
  114. * },
  115. * ....
  116. * ]
  117. * </code>
  118. * @type {Ember.Enumerable}
  119. */
  120. masterHostMapping: function () {
  121. var mapping = [], mappingObject, mappedHosts, hostObj;
  122. //get the unique assigned hosts and find the master services assigned to them
  123. mappedHosts = this.get("selectedServicesMasters").mapProperty("selectedHost").uniq();
  124. mappedHosts.forEach(function (item) {
  125. hostObj = this.get("hosts").findProperty("host_name", item);
  126. mappingObject = Em.Object.create({
  127. host_name: item,
  128. hostInfo: hostObj.host_info,
  129. masterServices: this.get("selectedServicesMasters").filterProperty("selectedHost", item)
  130. });
  131. mapping.pushObject(mappingObject);
  132. }, this);
  133. return mapping.sortProperty('host_name');
  134. }.property("selectedServicesMasters.@each.selectedHost"),
  135. /**
  136. * Count of hosts without masters
  137. * @type {number}
  138. */
  139. remainingHosts: function () {
  140. return (this.get("hosts.length") - this.get("masterHostMapping.length"));
  141. }.property("selectedServicesMasters.@each.selectedHost"),
  142. /**
  143. * Clear controller data (hosts, masters etc)
  144. * @method clearStep
  145. */
  146. clearStep: function () {
  147. this.set('hosts', []);
  148. this.set('selectedServicesMasters', []);
  149. this.set('servicesMasters', []);
  150. },
  151. /**
  152. * Load controller data (hosts, host components etc)
  153. * @method loadStep
  154. */
  155. loadStep: function () {
  156. console.log("WizardStep5Controller: Loading step5: Assign Masters");
  157. this.clearStep();
  158. this.renderHostInfo();
  159. this.renderComponents(this.loadComponents());
  160. this.updateComponent('ZOOKEEPER_SERVER');
  161. if (App.supports.multipleHBaseMasters) {
  162. this.updateComponent('HBASE_MASTER');
  163. }
  164. if (!this.get("selectedServicesMasters").filterProperty('isInstalled', false).length) {
  165. console.log('no master components to add');
  166. App.router.send('next');
  167. }
  168. },
  169. /**
  170. * Used to set showAddControl flag for ZOOKEEPER_SERVER and HBASE_SERVER
  171. * @method updateComponent
  172. */
  173. updateComponent: function (componentName) {
  174. var component = this.last(componentName);
  175. if(!component) {
  176. return;
  177. }
  178. var services = this.get('content.services').filterProperty('isInstalled', true).mapProperty('serviceName');
  179. var currentService = componentName.split('_')[0];
  180. var showControl = !services.contains(currentService);
  181. if (showControl) {
  182. if (this.get("selectedServicesMasters").filterProperty("component_name", componentName).length < this.get("hosts.length") && !this.get('isReassignWizard')) {
  183. component.set('showAddControl', true);
  184. } else {
  185. component.set('showRemoveControl', false);
  186. }
  187. }
  188. },
  189. /**
  190. * Load active host list to <code>hosts</code> variable
  191. * @method renderHostInfo
  192. */
  193. renderHostInfo: function () {
  194. var hostInfo = this.get('content.hosts');
  195. var result = [];
  196. for (var index in hostInfo) {
  197. var _host = hostInfo[index];
  198. if (_host.bootStatus === 'REGISTERED') {
  199. result.push(Em.Object.create({
  200. host_name: _host.name,
  201. cpu: _host.cpu,
  202. memory: _host.memory,
  203. disk_info: _host.disk_info,
  204. host_info: Em.I18n.t('installer.step5.hostInfo').fmt(_host.name, numberUtils.bytesToSize(_host.memory, 1, 'parseFloat', 1024), _host.cpu)
  205. }));
  206. }
  207. }
  208. this.set("hosts", result);
  209. this.sortHosts(this.get('hosts'));
  210. },
  211. /**
  212. * Sort list of host-objects by properties (memory - desc, cpu - desc, hostname - asc)
  213. * @param {object[]} hosts
  214. */
  215. sortHosts: function (hosts) {
  216. hosts.sort(function (a, b) {
  217. if (a.get('memory') == b.get('memory')) {
  218. if (a.get('cpu') == b.get('cpu')) {
  219. return a.get('host_name').localeCompare(b.get('host_name')); // hostname asc
  220. }
  221. return b.get('cpu') - a.get('cpu'); // cores desc
  222. }
  223. return b.get('memory') - a.get('memory'); // ram desc
  224. });
  225. },
  226. /**
  227. * Load services info to appropriate variable and return masterComponentHosts
  228. * @return {Object[]}
  229. */
  230. loadComponents: function () {
  231. var services = this.get('content.services').filterProperty('isSelected', true).mapProperty('serviceName'); //list of shown services
  232. var masterComponents = App.StackServiceComponent.find().filterProperty('isShownOnInstallerAssignMasterPage', true); //get full list from mock data
  233. var masterHosts = this.get('content.masterComponentHosts'); //saved to local storage info
  234. var resultComponents = [];
  235. var servicesLength = services.length;
  236. for (var index = 0; index < servicesLength; index++) {
  237. var componentInfo = masterComponents.filterProperty('serviceName', services[index]);
  238. componentInfo.forEach(function (_componentInfo) {
  239. if (_componentInfo.get('componentName') == 'ZOOKEEPER_SERVER' || _componentInfo.get('componentName') == 'HBASE_MASTER') {
  240. var savedComponents = masterHosts.filterProperty('component', _componentInfo.get('componentName'));
  241. if (savedComponents.length) {
  242. savedComponents.forEach(function (item) {
  243. var multipleMasterHost = {};
  244. multipleMasterHost.display_name = _componentInfo.get('displayName');
  245. multipleMasterHost.component_name = _componentInfo.get('componentName');
  246. multipleMasterHost.selectedHost = item.hostName;
  247. multipleMasterHost.serviceId = services[index];
  248. multipleMasterHost.isInstalled = item.isInstalled;
  249. multipleMasterHost.isHiveCoHost = false;
  250. resultComponents.push(multipleMasterHost);
  251. })
  252. } else {
  253. var zooHosts = this.selectHost(_componentInfo.get('componentName'));
  254. zooHosts.forEach(function (_host) {
  255. var multipleMasterHost = {};
  256. multipleMasterHost.display_name = _componentInfo.get('displayName');
  257. multipleMasterHost.component_name = _componentInfo.get('componentName');
  258. multipleMasterHost.selectedHost = _host;
  259. multipleMasterHost.serviceId = services[index];
  260. multipleMasterHost.isInstalled = false;
  261. multipleMasterHost.isHiveCoHost = false;
  262. resultComponents.push(multipleMasterHost);
  263. });
  264. }
  265. } else {
  266. var savedComponent = masterHosts.findProperty('component', _componentInfo.get('componentName'));
  267. var componentObj = {};
  268. componentObj.component_name = _componentInfo.get('componentName');
  269. componentObj.display_name = _componentInfo.get('displayName');
  270. componentObj.selectedHost = savedComponent ? savedComponent.hostName : this.selectHost(_componentInfo.get('componentName')); // call the method that plays selectNode algorithm or fetches from server
  271. componentObj.isInstalled = savedComponent ? savedComponent.isInstalled : false;
  272. componentObj.serviceId = services[index];
  273. componentObj.isHiveCoHost = this._isHiveCoHost(_componentInfo.get('componentName'));
  274. resultComponents.push(componentObj);
  275. }
  276. }, this);
  277. }
  278. return resultComponents;
  279. },
  280. /**
  281. * @param {string} componentName
  282. * @returns {bool}
  283. * @private
  284. * @method _isHiveCoHost
  285. */
  286. _isHiveCoHost: function(componentName) {
  287. return ['HIVE_METASTORE', 'WEBHCAT_SERVER'].contains(componentName) && !this.get('isReassignWizard');
  288. },
  289. /**
  290. * Put master components to <code>selectedServicesMasters</code>, which will be automatically rendered in template
  291. * @param {Ember.Enumerable} masterComponents
  292. * @method renderComponents
  293. */
  294. renderComponents: function (masterComponents) {
  295. var services = this.get('content.services').filterProperty('isInstalled', true).mapProperty('serviceName'); //list of shown services
  296. var showRemoveControlZk = !services.contains('ZOOKEEPER') && masterComponents.filterProperty('component_name', 'ZOOKEEPER_SERVER').length > 1;
  297. var showRemoveControlHb = !services.contains('HBASE') && masterComponents.filterProperty('component_name', 'HBASE_MASTER').length > 1;
  298. var zid = 1, hid = 1, nid = 1, result = [], self = this;
  299. masterComponents.forEach(function (item) {
  300. if (item.component_name == 'SECONDARY_NAMENODE') {
  301. if (self.get('isAddServiceWizard')) {
  302. if (App.get('isHaEnabled')) {
  303. return;
  304. }
  305. }
  306. }
  307. var componentObj = Em.Object.create(item);
  308. console.log("TRACE: render master component name is: " + item.component_name);
  309. if (item.component_name === "ZOOKEEPER_SERVER") {
  310. componentObj.set('zId', zid++);
  311. componentObj.set("showRemoveControl", showRemoveControlZk);
  312. }
  313. else {
  314. if (App.supports.multipleHBaseMasters && item.component_name === "HBASE_MASTER") {
  315. componentObj.set('zId', hid++);
  316. componentObj.set("showRemoveControl", showRemoveControlHb);
  317. }
  318. else {
  319. if (item.component_name === "NAMENODE") {
  320. componentObj.set('zId', nid++);
  321. }
  322. }
  323. }
  324. result.push(componentObj);
  325. }, this);
  326. this.set("selectedServicesMasters", result);
  327. if (this.get('isReassignWizard')) {
  328. var components = result.filterProperty('component_name', this.get('content.reassign.component_name'));
  329. components.setEach('isInstalled', false);
  330. this.set('servicesMasters', components);
  331. }
  332. else {
  333. this.set('servicesMasters', result);
  334. }
  335. },
  336. /**
  337. * Update host for components HIVE_METASTORE and WEBHCAT_SERVER according to host with HIVE_SERVER
  338. * @method updateHiveCoHosts
  339. */
  340. updateHiveCoHosts: function () {
  341. var hiveServer = this.get('selectedServicesMasters').findProperty('component_name', 'HIVE_SERVER'),
  342. hiveMetastore = this.get('selectedServicesMasters').findProperty('component_name', 'HIVE_METASTORE'),
  343. webHCatServer = this.get('selectedServicesMasters').findProperty('component_name', 'WEBHCAT_SERVER');
  344. if (hiveServer && hiveMetastore && webHCatServer) {
  345. if (!this.get('isReassignHive') && this.get('servicesMasters').objectAt(0) && !(this.get('servicesMasters').objectAt(0).component_name == 'HIVE_METASTORE')) {
  346. hiveMetastore.set('selectedHost', hiveServer.get('selectedHost'))
  347. }
  348. webHCatServer.set('selectedHost', hiveServer.get('selectedHost'));
  349. }
  350. }.observes('selectedServicesMasters.@each.selectedHost'),
  351. /**
  352. * select and return host for component by scheme
  353. * Scheme is an object that has keys which compared to number of hosts,
  354. * if key more that number of hosts, then return value of that key.
  355. * Value is index of host in hosts array.
  356. *
  357. * @param {number} noOfHosts
  358. * @param {object} selectionScheme
  359. * @return {string}
  360. * @method getHostForComponent
  361. */
  362. getHostForComponent: function (noOfHosts, selectionScheme) {
  363. var hosts = this.get('hosts');
  364. if (hosts.length === 1 || $.isEmptyObject(selectionScheme)) {
  365. return hosts[0];
  366. } else {
  367. for (var i in selectionScheme) {
  368. if (window.isFinite(i)) {
  369. if (noOfHosts < window.parseInt(i)) {
  370. return hosts[selectionScheme[i]];
  371. }
  372. }
  373. }
  374. return hosts[selectionScheme['else']]
  375. }
  376. },
  377. /**
  378. * Get list of hostnames for ZK Server
  379. * @param {number} noOfHosts
  380. * @returns {string[]}
  381. * @method getZooKeeperServer
  382. */
  383. getZooKeeperServer: function (noOfHosts) {
  384. var hosts = this.get('hosts');
  385. if (noOfHosts < 3) {
  386. return [hosts[0].host_name];
  387. } else {
  388. return [hosts[0].host_name, hosts[1].host_name, hosts[2].host_name];
  389. }
  390. },
  391. /**
  392. * Get hostname based on number of available hosts
  393. * @param {number} noOfHosts
  394. * @returns {string}
  395. * @method getServerHost
  396. */
  397. getServerHost: function (noOfHosts) {
  398. var hostNames = this.get('hosts').mapProperty('host_name');
  399. var hostExcAmbari = hostNames.without(location.hostname);
  400. if (noOfHosts > 1) {
  401. return hostExcAmbari[0];
  402. } else {
  403. return hostNames[0];
  404. }
  405. },
  406. /**
  407. * Return hostName of masterNode for specified service
  408. * @param componentName
  409. * @return {string|string[]}
  410. * @method selectHost
  411. */
  412. selectHost: function (componentName) {
  413. var noOfHosts = this.get('hosts').length;
  414. if (componentName === 'KERBEROS_SERVER')
  415. return this.getHostForComponent(noOfHosts, {"3": 1, "6": 1, "31": 3, "else": 5}).host_name;
  416. if (componentName === 'NAMENODE')
  417. return this.getHostForComponent(noOfHosts, {"else": 0}).host_name;
  418. if (componentName === 'SECONDARY_NAMENODE')
  419. return this.getHostForComponent(noOfHosts, {"else": 1}).host_name;
  420. if (componentName === 'HBASE_MASTER')
  421. return [this.getHostForComponent(noOfHosts, {"3": 0, "6": 0, "31": 2, "else": 3}).host_name];
  422. if (componentName === 'ZOOKEEPER_SERVER')
  423. return this.getZooKeeperServer(noOfHosts);
  424. if (['JOBTRACKER', 'HISTORYSERVER', 'RESOURCEMANAGER', 'APP_TIMELINE_SERVER'].contains(componentName))
  425. return this.getHostForComponent(noOfHosts, {"3": 1, "6": 1, "31": 1, "else": 2}).host_name;
  426. if (['OOZIE_SERVER', 'FALCON_SERVER'].contains(componentName))
  427. return this.getHostForComponent(noOfHosts, {"3": 1, "6": 1, "31": 2, "else": 3}).host_name;
  428. if (['HIVE_SERVER', 'HIVE_METASTORE', 'WEBHCAT_SERVER'].contains(componentName))
  429. return this.getHostForComponent(noOfHosts, {"3": 1, "6": 1, "31": 2, "else": 4}).host_name;
  430. if (['STORM_UI_SERVER', 'DRPC_SERVER', 'STORM_REST_API', 'NIMBUS', 'GANGLIA_SERVER', 'NAGIOS_SERVER', 'HUE_SERVER'].contains(componentName))
  431. return this.getServerHost(noOfHosts);
  432. return '';
  433. },
  434. /**
  435. * On change callback for selects
  436. * @param {string} componentName
  437. * @param {string} selectedHost
  438. * @param {number} zId
  439. * @method assignHostToMaster
  440. */
  441. assignHostToMaster: function (componentName, selectedHost, zId) {
  442. if (selectedHost && componentName) {
  443. if (zId) {
  444. this.get('selectedServicesMasters').filterProperty('component_name', componentName).findProperty("zId", zId).set("selectedHost", selectedHost);
  445. } else {
  446. this.get('selectedServicesMasters').findProperty("component_name", componentName).set("selectedHost", selectedHost);
  447. }
  448. }
  449. },
  450. /**
  451. * Returns last component of selected type
  452. * @param {string} componentName
  453. * @return {Em.Object|null}
  454. * @method last
  455. */
  456. last: function (componentName) {
  457. return this.get("selectedServicesMasters").filterProperty("component_name", componentName).get("lastObject");
  458. },
  459. /**
  460. * Add new component to ZooKeeper Server and Hbase master
  461. * @param {string} componentName
  462. * @return {bool} true - added, false - not added
  463. * @method addComponent
  464. */
  465. addComponent: function (componentName) {
  466. /*
  467. * Logic: If ZooKeeper or Hbase service is selected then there can be
  468. * minimum 1 ZooKeeper or Hbase master in total, and
  469. * maximum 1 ZooKeeper or Hbase on every host
  470. */
  471. var maxNumMasters = this.get("hosts.length"),
  472. currentMasters = this.get("selectedServicesMasters").filterProperty("component_name", componentName),
  473. newMaster = null,
  474. masterHosts = null,
  475. suggestedHost = null,
  476. i = 0,
  477. lastMaster = null;
  478. if (!currentMasters.length) {
  479. console.log('ALERT: Zookeeper service was not selected');
  480. return false;
  481. }
  482. if (currentMasters.get("length") < maxNumMasters) {
  483. currentMasters.set("lastObject.showAddControl", false);
  484. currentMasters.set("lastObject.showRemoveControl", true);
  485. //create a new zookeeper based on an existing one
  486. newMaster = Em.Object.create({});
  487. lastMaster = currentMasters.get("lastObject");
  488. newMaster.set("display_name", lastMaster.get("display_name"));
  489. newMaster.set("component_name", lastMaster.get("component_name"));
  490. newMaster.set("selectedHost", lastMaster.get("selectedHost"));
  491. newMaster.set("isInstalled", false);
  492. if (currentMasters.get("length") === (maxNumMasters - 1)) {
  493. newMaster.set("showAddControl", false);
  494. } else {
  495. newMaster.set("showAddControl", true);
  496. }
  497. newMaster.set("showRemoveControl", true);
  498. //get recommended host for the new Zookeeper server
  499. masterHosts = currentMasters.mapProperty("selectedHost").uniq();
  500. for (i = 0; i < this.get("hosts.length"); i++) {
  501. if (!(masterHosts.contains(this.get("hosts")[i].get("host_name")))) {
  502. suggestedHost = this.get("hosts")[i].get("host_name");
  503. break;
  504. }
  505. }
  506. newMaster.set("selectedHost", suggestedHost);
  507. newMaster.set("zId", (currentMasters.get("lastObject.zId") + 1));
  508. this.get("selectedServicesMasters").insertAt(this.get("selectedServicesMasters").indexOf(lastMaster) + 1, newMaster);
  509. this.set('componentToRebalance', componentName);
  510. this.incrementProperty('rebalanceComponentHostsCounter');
  511. return true;
  512. }
  513. return false;//if no more zookeepers can be added
  514. },
  515. /**
  516. * Remove component from ZooKeeper server or Hbase Master
  517. * @param {string} componentName
  518. * @param {number} zId
  519. * @return {bool} true - removed, false - no
  520. * @method removeComponent
  521. */
  522. removeComponent: function (componentName, zId) {
  523. var currentMasters = this.get("selectedServicesMasters").filterProperty("component_name", componentName);
  524. //work only if the Zookeeper service is selected in previous step
  525. if (currentMasters.length <= 1) {
  526. return false;
  527. }
  528. this.get("selectedServicesMasters").removeAt(this.get("selectedServicesMasters").indexOf(currentMasters.findProperty("zId", zId)));
  529. currentMasters = this.get("selectedServicesMasters").filterProperty("component_name", componentName);
  530. if (currentMasters.get("length") < this.get("hosts.length")) {
  531. currentMasters.set("lastObject.showAddControl", true);
  532. }
  533. if (currentMasters.get("length") === 1) {
  534. currentMasters.set("lastObject.showRemoveControl", false);
  535. }
  536. this.set('componentToRebalance', componentName);
  537. this.incrementProperty('rebalanceComponentHostsCounter');
  538. return true;
  539. },
  540. /**
  541. * Submit button click handler
  542. * @metohd submit
  543. */
  544. submit: function () {
  545. if (!this.get('isSubmitDisabled')) {
  546. App.router.send('next');
  547. }
  548. }
  549. });