installer.js 22 KB

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