installer.js 22 KB

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