installer.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745
  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. App.InstallerController = App.WizardController.extend({
  20. name: 'installerController',
  21. totalSteps: 11,
  22. content: Em.Object.create({
  23. cluster: null,
  24. installOptions: null,
  25. hosts: null,
  26. services: null,
  27. slaveComponentHosts: null,
  28. masterComponentHosts: null,
  29. serviceConfigProperties: null,
  30. advancedServiceConfig: null,
  31. configGroups: [],
  32. slaveGroupProperties: null,
  33. stacks: null,
  34. clients:[],
  35. controllerName: 'installerController'
  36. }),
  37. /**
  38. * Wizard properties in local storage, which should be cleaned right after wizard has been finished
  39. */
  40. dbPropertiesToClean: [
  41. 'service',
  42. 'hosts',
  43. 'masterComponentHosts',
  44. 'slaveComponentHosts',
  45. 'cluster',
  46. 'allHostNames',
  47. 'installOptions',
  48. 'allHostNamesPattern',
  49. 'serviceComponents',
  50. 'advancedServiceConfig',
  51. 'clientInfo',
  52. 'selectedServiceNames',
  53. 'serviceConfigGroups',
  54. 'serviceConfigProperties',
  55. 'fileNamesToUpdate',
  56. 'bootStatus',
  57. 'stacksVersions',
  58. 'currentStep',
  59. 'serviceInfo',
  60. 'hostInfo'
  61. ],
  62. init: function () {
  63. this._super();
  64. this.get('isStepDisabled').setEach('value', true);
  65. this.get('isStepDisabled').pushObject(Ember.Object.create({
  66. step: 0,
  67. value: false
  68. }));
  69. },
  70. /**
  71. * redefined connectOutlet method to avoid view loading by unauthorized user
  72. * @param view
  73. * @param content
  74. */
  75. connectOutlet: function (view, content) {
  76. if (App.db.getAuthenticated()) {
  77. this._super(view, content);
  78. }
  79. },
  80. getCluster: function () {
  81. return jQuery.extend({}, this.get('clusterStatusTemplate'));
  82. },
  83. getInstallOptions: function () {
  84. return jQuery.extend({}, this.get('installOptionsTemplate'));
  85. },
  86. getHosts: function () {
  87. return [];
  88. },
  89. /**
  90. * Remove host from model. Used at <code>Confirm hosts(step2)</code> step
  91. * @param hosts Array of hosts, which we want to delete
  92. */
  93. removeHosts: function (hosts) {
  94. var dbHosts = this.getDBProperty('hosts');
  95. hosts.forEach(function (_hostInfo) {
  96. var host = _hostInfo.hostName;
  97. delete dbHosts[host];
  98. });
  99. this.setDBProperty('hosts', dbHosts);
  100. },
  101. /**
  102. * Load confirmed hosts.
  103. * Will be used at <code>Assign Masters(step5)</code> step
  104. */
  105. loadConfirmedHosts: function () {
  106. this.set('content.hosts', this.getDBProperty('hosts') || {});
  107. },
  108. /**
  109. * Load services data. Will be used at <code>Select services(step4)</code> step
  110. */
  111. loadServices: function () {
  112. var dfd = $.Deferred();
  113. var self = this;
  114. var stackServices = App.StackService.find().mapProperty('serviceName');
  115. if (!(stackServices && !!stackServices.length && App.StackService.find().objectAt(0).get('stackVersion') == App.get('currentStackVersionNumber'))) {
  116. this.loadServiceComponents().complete(function () {
  117. self.set('content.services', App.StackService.find());
  118. dfd.resolve();
  119. });
  120. } else {
  121. dfd.resolve();
  122. }
  123. return dfd.promise();
  124. },
  125. /**
  126. * total set of hosts registered to cluster, analog of App.Host model,
  127. * used in Installer wizard until hosts are installed
  128. */
  129. allHosts: function () {
  130. var rawHosts = this.get('content.hosts');
  131. var masterComponents = this.get('content.masterComponentHosts');
  132. var slaveComponents = this.get('content.slaveComponentHosts');
  133. var hosts = [];
  134. masterComponents.forEach(function (component) {
  135. var host = rawHosts[component.hostName];
  136. if (host.hostComponents) {
  137. host.hostComponents.push(Em.Object.create({
  138. componentName: component.component,
  139. displayName: component.display_name
  140. }));
  141. } else {
  142. rawHosts[component.hostName].hostComponents = [
  143. Em.Object.create({
  144. componentName: component.component,
  145. displayName: component.display_name
  146. })
  147. ]
  148. }
  149. });
  150. slaveComponents.forEach(function (component) {
  151. component.hosts.forEach(function (rawHost) {
  152. var host = rawHosts[rawHost.hostName];
  153. if (host.hostComponents) {
  154. host.hostComponents.push(Em.Object.create({
  155. componentName: component.componentName,
  156. displayName: component.displayName
  157. }));
  158. } else {
  159. rawHosts[rawHost.hostName].hostComponents = [
  160. Em.Object.create({
  161. componentName: component.componentName,
  162. displayName: component.displayName
  163. })
  164. ]
  165. }
  166. });
  167. });
  168. for (var hostName in rawHosts) {
  169. var host = rawHosts[hostName];
  170. var disksOverallCapacity = 0;
  171. var diskFree = 0;
  172. host.disk_info.forEach(function (disk) {
  173. disksOverallCapacity += parseFloat(disk.size);
  174. diskFree += parseFloat(disk.available);
  175. });
  176. hosts.pushObject(Em.Object.create({
  177. id: host.name,
  178. ip: host.ip,
  179. osType: host.os_type,
  180. osArch: host.os_arch,
  181. hostName: host.name,
  182. publicHostName: host.name,
  183. cpu: host.cpu,
  184. memory: host.memory,
  185. diskInfo: host.disk_info,
  186. diskTotal: disksOverallCapacity / (1024 * 1024),
  187. diskFree: diskFree / (1024 * 1024),
  188. hostComponents: host.hostComponents
  189. }
  190. ))
  191. }
  192. return hosts;
  193. }.property('content.hosts'),
  194. stacks: [],
  195. /**
  196. * stack names used as auxiliary data to query stacks by name
  197. */
  198. stackNames: [],
  199. /**
  200. * Load stacks data from server or take exist data from local db
  201. */
  202. loadStacks: function () {
  203. var stacks = App.db.getStacks();
  204. var dfd = $.Deferred();
  205. if (stacks && stacks.length) {
  206. var convertedStacks = [];
  207. stacks.forEach(function (stack) {
  208. convertedStacks.pushObject(Ember.Object.create(stack));
  209. });
  210. App.set('currentStackVersion', convertedStacks.findProperty('isSelected').get('name'));
  211. this.set('content.stacks', convertedStacks);
  212. dfd.resolve(true);
  213. } else {
  214. App.ajax.send({
  215. name: 'wizard.stacks',
  216. sender: this,
  217. success: 'loadStacksSuccessCallback',
  218. error: 'loadStacksErrorCallback'
  219. }).complete(function () {
  220. dfd.resolve(false);
  221. });
  222. }
  223. return dfd.promise();
  224. },
  225. /**
  226. * Send queries to load versions for each stack
  227. */
  228. loadStacksSuccessCallback: function (data) {
  229. this.get('stacks').clear();
  230. this.set('stackNames', data.items.mapProperty('Stacks.stack_name'));
  231. },
  232. /**
  233. * set stacks from server to content and local DB
  234. */
  235. setStacks: function() {
  236. var result = this.get('stacks');
  237. if (!result.length) {
  238. console.log('Error: there are no active stacks');
  239. } else {
  240. var defaultStackVersion = result.findProperty('name', App.defaultStackVersion);
  241. if (defaultStackVersion) {
  242. defaultStackVersion.set('isSelected', true)
  243. } else {
  244. result.objectAt(0).set('isSelected', true);
  245. }
  246. }
  247. App.db.setStacks(result);
  248. this.set('content.stacks', result);
  249. },
  250. /**
  251. * onError callback for loading stacks data
  252. */
  253. loadStacksErrorCallback: function () {
  254. console.log('Error in loading stacks');
  255. },
  256. /**
  257. * query every stack names from server
  258. * @return {Array}
  259. */
  260. loadStacksVersions: function () {
  261. var requests = [];
  262. this.get('stackNames').forEach(function (stackName) {
  263. requests.push(App.ajax.send({
  264. name: 'wizard.stacks_versions',
  265. sender: this,
  266. data: {
  267. stackName: stackName
  268. },
  269. success: 'loadStacksVersionsSuccessCallback',
  270. error: 'loadStacksVersionsErrorCallback'
  271. }));
  272. }, this);
  273. return requests;
  274. },
  275. /**
  276. * Parse loaded data and create array of stacks objects
  277. */
  278. loadStacksVersionsSuccessCallback: function (data) {
  279. var result = [];
  280. var stackVersions = data.items.filterProperty('Versions.active');
  281. stackVersions.sortProperty('Versions.stack_version').reverse().forEach(function (version) {
  282. /*
  283. * operatingSystems:[
  284. * {
  285. * osType: 'centos5',
  286. * baseUrl: 'http://...',
  287. * originalBaseUrl: 'http://...',
  288. * defaultBaseUrl: 'http://...',
  289. * latestBaseUrl: 'http://...',
  290. * mirrorsList: '';
  291. * },
  292. * {
  293. * osType: 'centos6',
  294. * baseUrl: 'http://...',
  295. * originalBaseUrl: 'http://...',
  296. * defaultBaseUrl: 'http://...',
  297. * latestBaseUrl: 'http://...',
  298. * mirrorsList: '';
  299. * },
  300. * ]
  301. */
  302. var oses = [];
  303. if (version.operatingSystems) {
  304. version.operatingSystems.forEach(function (os) {
  305. if (os.repositories) {
  306. os.repositories.forEach(function (repo) {
  307. var defaultBaseUrl = repo.Repositories.default_base_url || repo.Repositories.base_url;
  308. var latestBaseUrl = repo.Repositories.latest_base_url || defaultBaseUrl;
  309. if (!App.supports.ubuntu && os.OperatingSystems.os_type == 'debian12') return; // @todo: remove after Ubuntu support confirmation
  310. oses.push({
  311. osType: os.OperatingSystems.os_type,
  312. baseUrl: latestBaseUrl,
  313. latestBaseUrl: latestBaseUrl,
  314. originalLatestBaseUrl: latestBaseUrl,
  315. originalBaseUrl: repo.Repositories.base_url,
  316. defaultBaseUrl: defaultBaseUrl,
  317. mirrorsList: repo.Repositories.mirrors_list,
  318. id: os.OperatingSystems.os_type + repo.Repositories.repo_name,
  319. repoId: repo.Repositories.repo_id,
  320. selected: true
  321. });
  322. });
  323. }
  324. });
  325. }
  326. result.push(
  327. Em.Object.create({
  328. name: version.Versions.stack_name + "-" + version.Versions.stack_version,
  329. isSelected: false,
  330. operatingSystems: oses
  331. })
  332. );
  333. }, this);
  334. this.get('stacks').pushObjects(result);
  335. },
  336. /**
  337. * onError callback for loading stacks data
  338. */
  339. loadStacksVersionsErrorCallback: function () {
  340. console.log('Error in loading stacks');
  341. },
  342. /**
  343. * check server version and web client version
  344. */
  345. checkServerClientVersion: function () {
  346. var dfd = $.Deferred();
  347. var self = this;
  348. self.getServerVersion().done(function () {
  349. dfd.resolve();
  350. });
  351. return dfd.promise();
  352. },
  353. getServerVersion: function () {
  354. return App.ajax.send({
  355. name: 'ambari.service.load_server_version',
  356. sender: this,
  357. success: 'getServerVersionSuccessCallback',
  358. error: 'getServerVersionErrorCallback'
  359. });
  360. },
  361. getServerVersionSuccessCallback: function (data) {
  362. var clientVersion = App.get('version');
  363. var serverVersion = (data.RootServiceComponents.component_version).toString();
  364. this.set('ambariServerVersion', serverVersion);
  365. if (clientVersion) {
  366. this.set('versionConflictAlertBody', Em.I18n.t('app.versionMismatchAlert.body').format(serverVersion, clientVersion));
  367. this.set('isServerClientVersionMismatch', clientVersion != serverVersion);
  368. } else {
  369. this.set('isServerClientVersionMismatch', false);
  370. }
  371. },
  372. getServerVersionErrorCallback: function () {
  373. console.log('ERROR: Cannot load Ambari server version');
  374. },
  375. /**
  376. * Save data to model
  377. * @param stepController App.WizardStep4Controller
  378. */
  379. saveServices: function (stepController) {
  380. var selectedServiceNames = [];
  381. var installedServiceNames = [];
  382. stepController.filterProperty('isSelected').forEach(function (item) {
  383. selectedServiceNames.push(item.get('serviceName'));
  384. });
  385. stepController.filterProperty('isInstalled').forEach(function (item) {
  386. installedServiceNames.push(item.get('serviceName'));
  387. });
  388. this.set('content.services', App.StackService.find());
  389. this.set('content.selectedServiceNames', selectedServiceNames);
  390. this.setDBProperty('selectedServiceNames', selectedServiceNames);
  391. this.set('content.installedServiceNames', installedServiceNames);
  392. this.setDBProperty('installedServiceNames', installedServiceNames);
  393. },
  394. /**
  395. * Save Master Component Hosts data to Main Controller
  396. * @param stepController App.WizardStep5Controller
  397. */
  398. saveMasterComponentHosts: function (stepController) {
  399. var obj = stepController.get('selectedServicesMasters'),
  400. hosts = this.getDBProperty('hosts');
  401. var masterComponentHosts = [];
  402. obj.forEach(function (_component) {
  403. masterComponentHosts.push({
  404. display_name: _component.get('display_name'),
  405. component: _component.get('component_name'),
  406. serviceId: _component.get('serviceId'),
  407. isInstalled: false,
  408. host_id: hosts[_component.get('selectedHost')].id
  409. });
  410. });
  411. console.log("installerController.saveMasterComponentHosts: saved hosts ", masterComponentHosts);
  412. this.setDBProperty('masterComponentHosts', masterComponentHosts);
  413. this.set('content.masterComponentHosts', masterComponentHosts);
  414. },
  415. /**
  416. * Load master component hosts data for using in required step controllers
  417. */
  418. loadMasterComponentHosts: function () {
  419. var masterComponentHosts = this.getDBProperty('masterComponentHosts'),
  420. hosts = this.getDBProperty('hosts'),
  421. host_names = Em.keys(hosts);
  422. if (Em.isNone(masterComponentHosts)) {
  423. masterComponentHosts = [];
  424. }
  425. else {
  426. masterComponentHosts.forEach(function (component) {
  427. for (var i = 0; i < host_names.length; i++) {
  428. if (hosts[host_names[i]].id === component.host_id) {
  429. component.hostName = host_names[i];
  430. break;
  431. }
  432. }
  433. });
  434. }
  435. this.set("content.masterComponentHosts", masterComponentHosts);
  436. },
  437. /**
  438. * Load master component hosts data for using in required step controllers
  439. */
  440. loadSlaveComponentHosts: function () {
  441. var slaveComponentHosts = this.getDBProperty('slaveComponentHosts'),
  442. hosts = this.getDBProperty('hosts'),
  443. host_names = Em.keys(hosts);
  444. if (!Em.isNone(slaveComponentHosts)) {
  445. slaveComponentHosts.forEach(function (component) {
  446. component.hosts.forEach(function (host) {
  447. for (var i = 0; i < host_names.length; i++) {
  448. if (hosts[host_names[i]].id === host.host_id) {
  449. host.hostName = host_names[i];
  450. break;
  451. }
  452. }
  453. });
  454. });
  455. }
  456. this.set("content.slaveComponentHosts", slaveComponentHosts);
  457. console.log("InstallerController.loadSlaveComponentHosts: loaded hosts ", slaveComponentHosts);
  458. },
  459. /**
  460. * Load serviceConfigProperties to model
  461. */
  462. loadServiceConfigProperties: function () {
  463. var serviceConfigProperties = this.getDBProperty('serviceConfigProperties');
  464. this.set('content.serviceConfigProperties', serviceConfigProperties);
  465. console.log("InstallerController.loadServiceConfigProperties: loaded config ", serviceConfigProperties);
  466. this.set('content.advancedServiceConfig', this.getDBProperty('advancedServiceConfig'));
  467. },
  468. /**
  469. * Generate clients list for selected services and save it to model
  470. * @param stepController step4WizardController
  471. */
  472. saveClients: function (stepController) {
  473. var clients = [];
  474. var serviceComponents = App.StackServiceComponent.find();
  475. var services =
  476. stepController.get('content').filterProperty('isSelected', true).forEach(function (_service) {
  477. var client = _service.get('serviceComponents').filterProperty('isClient', true);
  478. client.forEach(function (clientComponent) {
  479. clients.pushObject({
  480. component_name: clientComponent.get('componentName'),
  481. display_name: clientComponent.get('displayName'),
  482. isInstalled: false
  483. });
  484. }, this);
  485. }, this);
  486. this.setDBProperty('clientInfo', clients);
  487. this.set('content.clients', clients);
  488. },
  489. /**
  490. * Save stacks data to local db
  491. * @param stepController step1WizardController
  492. */
  493. saveStacks: function (stepController) {
  494. var stacks = stepController.get('content.stacks');
  495. if (stacks.length) {
  496. App.set('currentStackVersion', stacks.findProperty('isSelected').get('name'));
  497. } else {
  498. App.set('currentStackVersion', App.defaultStackVersion);
  499. }
  500. App.db.setStacks(stacks);
  501. this.set('content.stacks', stacks);
  502. },
  503. /**
  504. * Check validation of the customized local urls
  505. */
  506. checkRepoURL: function () {
  507. var selectedStack = this.get('content.stacks').findProperty('isSelected', true);
  508. selectedStack.set('reload', true);
  509. var nameVersionCombo = selectedStack.name;
  510. var stackName = nameVersionCombo.split('-')[0];
  511. var stackVersion = nameVersionCombo.split('-')[1];
  512. if (selectedStack && selectedStack.operatingSystems) {
  513. this.set('validationCnt', selectedStack.get('operatingSystems').filterProperty('selected', true).length);
  514. this.set('invalidCnt', 0);
  515. selectedStack.operatingSystems.forEach(function (os) {
  516. os.errorTitle = null;
  517. os.errorContent = null;
  518. var verifyBaseUrl = os.skipValidation ? false : true;
  519. if (os.selected) {
  520. os.validation = 'icon-repeat';
  521. selectedStack.set('reload', !selectedStack.get('reload'));
  522. App.ajax.send({
  523. name: 'wizard.advanced_repositories.valid_url',
  524. sender: this,
  525. data: {
  526. stackName: stackName,
  527. stackVersion: stackVersion,
  528. repoId: os.repoId,
  529. osType: os.osType,
  530. osId: os.id,
  531. data: {
  532. 'Repositories': {
  533. 'base_url': os.baseUrl,
  534. "verify_base_url": verifyBaseUrl
  535. }
  536. }
  537. },
  538. success: 'checkRepoURLSuccessCallback',
  539. error: 'checkRepoURLErrorCallback'
  540. });
  541. }
  542. }, this);
  543. }
  544. },
  545. setInvalidUrlCnt: function () {
  546. var selectedStack = this.get('content.stacks').findProperty('isSelected', true);
  547. selectedStack.set('invalidCnt', this.get('invalidCnt'));
  548. }.observes('invalidCnt'),
  549. /**
  550. * onSuccess callback for check Repo URL.
  551. */
  552. checkRepoURLSuccessCallback: function (response, request, data) {
  553. console.log('Success in check Repo URL. data osType: ' + data.osType);
  554. var selectedStack = this.get('content.stacks').findProperty('isSelected', true);
  555. if (selectedStack && selectedStack.operatingSystems) {
  556. var os = selectedStack.operatingSystems.findProperty('id', data.osId);
  557. os.validation = 'icon-ok';
  558. selectedStack.set('reload', !selectedStack.get('reload'));
  559. this.set('validationCnt', this.get('validationCnt') - 1);
  560. }
  561. },
  562. /**
  563. * onError callback for check Repo URL.
  564. */
  565. checkRepoURLErrorCallback: function (request, ajaxOptions, error, data, params) {
  566. console.log('Error in check Repo URL. The baseURL sent is: ' + data.data);
  567. var selectedStack = this.get('content.stacks').findProperty('isSelected', true);
  568. if (selectedStack && selectedStack.operatingSystems) {
  569. var os = selectedStack.operatingSystems.findProperty('id', params.osId);
  570. os.validation = 'icon-exclamation-sign';
  571. os.errorTitle = request.status + ":" + request.statusText;
  572. os.errorContent = $.parseJSON(request.responseText) ? $.parseJSON(request.responseText).message : "";
  573. selectedStack.set('reload', !selectedStack.get('reload'));
  574. this.set('validationCnt', this.get('validationCnt') - 1);
  575. this.set('invalidCnt', this.get('invalidCnt') + 1);
  576. }
  577. },
  578. loadMap: {
  579. '0': [
  580. {
  581. type: 'sync',
  582. callback: function () {
  583. this.load('cluster');
  584. }
  585. }
  586. ],
  587. '1': [
  588. {
  589. type: 'async',
  590. callback: function () {
  591. return this.loadStacks();
  592. }
  593. },
  594. {
  595. type: 'async',
  596. callback: function (stacksLoaded) {
  597. var dfd = $.Deferred();
  598. if (!stacksLoaded) {
  599. $.when.apply(this, this.loadStacksVersions()).done(function () {
  600. dfd.resolve(stacksLoaded);
  601. });
  602. } else {
  603. dfd.resolve(stacksLoaded);
  604. }
  605. return dfd.promise();
  606. }
  607. },
  608. {
  609. type: 'sync',
  610. callback: function (stacksLoaded) {
  611. if (!stacksLoaded) {
  612. this.setStacks();
  613. }
  614. }
  615. }
  616. ],
  617. '2': [
  618. {
  619. type: 'sync',
  620. callback: function () {
  621. this.load('installOptions');
  622. }
  623. }
  624. ],
  625. '3': [
  626. {
  627. type: 'sync',
  628. callback: function () {
  629. this.loadConfirmedHosts();
  630. }
  631. }
  632. ],
  633. '4': [
  634. {
  635. type: 'async',
  636. callback: function () {
  637. return this.loadServices();
  638. }
  639. }
  640. ],
  641. '5': [
  642. {
  643. type: 'sync',
  644. callback: function () {
  645. this.loadMasterComponentHosts();
  646. this.loadConfirmedHosts();
  647. }
  648. }
  649. ],
  650. '6': [
  651. {
  652. type: 'sync',
  653. callback: function () {
  654. this.loadSlaveComponentHosts();
  655. this.loadClients();
  656. }
  657. }
  658. ],
  659. '7': [
  660. {
  661. type: 'sync',
  662. callback: function () {
  663. this.loadServiceConfigGroups();
  664. this.loadServiceConfigProperties();
  665. }
  666. }
  667. ]
  668. },
  669. /**
  670. * Clear all temporary data
  671. */
  672. finish: function () {
  673. this.setCurrentStep('0');
  674. this.clearStorageData();
  675. var persists = App.router.get('applicationController').persistKey();
  676. App.router.get('applicationController').postUserPref(persists, true);
  677. },
  678. setStepsEnable: function () {
  679. for (var i = 0; i <= this.totalSteps; i++) {
  680. var step = this.get('isStepDisabled').findProperty('step', i);
  681. if (i <= this.get('currentStep')) {
  682. step.set('value', false);
  683. } else {
  684. step.set('value', true);
  685. }
  686. }
  687. }.observes('currentStep'),
  688. setLowerStepsDisable: function (stepNo) {
  689. for (var i = 0; i < stepNo; i++) {
  690. var step = this.get('isStepDisabled').findProperty('step', i);
  691. step.set('value', true);
  692. }
  693. },
  694. /**
  695. * Clear loaded recommendations
  696. */
  697. clearRecommendations: function() {
  698. this.set('recommendations', undefined)
  699. }
  700. });