installer.js 22 KB

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