installer.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719
  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. '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: true
  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. this.set('loadStacksRequestsCounter', requests.length);
  262. return requests;
  263. },
  264. /**
  265. * Counter for counting number of successful requests to load stack versions
  266. */
  267. loadStacksRequestsCounter: 0,
  268. /**
  269. * Parse loaded data and create array of stacks objects
  270. */
  271. loadStacksVersionsSuccessCallback: function (data) {
  272. var stacks = App.db.getStacks();
  273. var isStacksExistInDb = stacks && stacks.length;
  274. if (isStacksExistInDb) {
  275. stacks.forEach(function (_stack) {
  276. var stack = data.items.filterProperty('Versions.stack_name', _stack.stack_name).findProperty('Versions.stack_version', _stack.stack_version);
  277. if (stack) {
  278. stack.Versions.is_selected = _stack.is_selected;
  279. }
  280. }, this);
  281. }
  282. App.stackMapper.map(data);
  283. if (!this.decrementProperty('loadStacksRequestsCounter')) {
  284. if (!isStacksExistInDb) {
  285. var defaultStackVersion = App.Stack.find().findProperty('id', App.defaultStackVersion);
  286. if (defaultStackVersion) {
  287. defaultStackVersion.set('isSelected', true)
  288. } else {
  289. App.Stack.find().objectAt(0).set('isSelected', true);
  290. }
  291. }
  292. this.set('content.stacks', App.Stack.find());
  293. App.set('currentStackVersion', App.Stack.find().findProperty('isSelected').get('id'));
  294. }
  295. },
  296. /**
  297. * onError callback for loading stacks data
  298. */
  299. loadStacksVersionsErrorCallback: function () {
  300. console.log('Error in loading stacks');
  301. },
  302. /**
  303. * check server version and web client version
  304. */
  305. checkServerClientVersion: function () {
  306. var dfd = $.Deferred();
  307. var self = this;
  308. self.getServerVersion().done(function () {
  309. dfd.resolve();
  310. });
  311. return dfd.promise();
  312. },
  313. getServerVersion: function () {
  314. return App.ajax.send({
  315. name: 'ambari.service',
  316. sender: this,
  317. data: {
  318. fields: '?fields=RootServiceComponents/component_version,RootServiceComponents/properties/server.os_family&minimal_response=true'
  319. },
  320. success: 'getServerVersionSuccessCallback',
  321. error: 'getServerVersionErrorCallback'
  322. });
  323. },
  324. getServerVersionSuccessCallback: function (data) {
  325. var clientVersion = App.get('version');
  326. var serverVersion = (data.RootServiceComponents.component_version).toString();
  327. this.set('ambariServerVersion', serverVersion);
  328. if (clientVersion) {
  329. this.set('versionConflictAlertBody', Em.I18n.t('app.versionMismatchAlert.body').format(serverVersion, clientVersion));
  330. this.set('isServerClientVersionMismatch', clientVersion != serverVersion);
  331. } else {
  332. this.set('isServerClientVersionMismatch', false);
  333. }
  334. App.set('isManagedMySQLForHiveEnabled', App.config.isManagedMySQLForHiveAllowed(data.RootServiceComponents.properties['server.os_family']));
  335. },
  336. getServerVersionErrorCallback: function () {
  337. console.log('ERROR: Cannot load Ambari server version');
  338. },
  339. /**
  340. * set stacks from server to content and local DB
  341. */
  342. setStacks: function () {
  343. var result = App.Stack.find() || [];
  344. Em.assert('Stack model is not populated', result.get('length'));
  345. App.db.setStacks(result.slice());
  346. this.set('content.stacks', result);
  347. },
  348. /**
  349. * Save data to model
  350. * @param stepController App.WizardStep4Controller
  351. */
  352. saveServices: function (stepController) {
  353. var selectedServiceNames = [];
  354. var installedServiceNames = [];
  355. stepController.filterProperty('isSelected').forEach(function (item) {
  356. selectedServiceNames.push(item.get('serviceName'));
  357. });
  358. stepController.filterProperty('isInstalled').forEach(function (item) {
  359. installedServiceNames.push(item.get('serviceName'));
  360. });
  361. this.set('content.services', App.StackService.find());
  362. this.set('content.selectedServiceNames', selectedServiceNames);
  363. this.setDBProperty('selectedServiceNames', selectedServiceNames);
  364. this.set('content.installedServiceNames', installedServiceNames);
  365. this.setDBProperty('installedServiceNames', installedServiceNames);
  366. },
  367. /**
  368. * Save Master Component Hosts data to Main Controller
  369. * @param stepController App.WizardStep5Controller
  370. */
  371. saveMasterComponentHosts: function (stepController) {
  372. var obj = stepController.get('selectedServicesMasters'),
  373. hosts = this.getDBProperty('hosts');
  374. var masterComponentHosts = [];
  375. obj.forEach(function (_component) {
  376. masterComponentHosts.push({
  377. display_name: _component.get('display_name'),
  378. component: _component.get('component_name'),
  379. serviceId: _component.get('serviceId'),
  380. isInstalled: false,
  381. host_id: hosts[_component.get('selectedHost')].id
  382. });
  383. });
  384. console.log("installerController.saveMasterComponentHosts: saved hosts ", masterComponentHosts);
  385. this.setDBProperty('masterComponentHosts', masterComponentHosts);
  386. this.set('content.masterComponentHosts', masterComponentHosts);
  387. },
  388. /**
  389. * Load master component hosts data for using in required step controllers
  390. */
  391. loadMasterComponentHosts: function () {
  392. var masterComponentHosts = this.getDBProperty('masterComponentHosts'),
  393. hosts = this.getDBProperty('hosts'),
  394. host_names = Em.keys(hosts);
  395. if (Em.isNone(masterComponentHosts)) {
  396. masterComponentHosts = [];
  397. }
  398. else {
  399. masterComponentHosts.forEach(function (component) {
  400. for (var i = 0; i < host_names.length; i++) {
  401. if (hosts[host_names[i]].id === component.host_id) {
  402. component.hostName = host_names[i];
  403. break;
  404. }
  405. }
  406. });
  407. }
  408. this.set("content.masterComponentHosts", masterComponentHosts);
  409. },
  410. loadCurrentHostGroups: function () {
  411. this.set("content.recommendationsHostGroups", this.getDBProperty('recommendationsHostGroups'));
  412. },
  413. loadRecommendationsConfigs: function () {
  414. App.router.set("wizardStep7Controller.recommendationsConfigs", this.getDBProperty('recommendationsConfigs'));
  415. },
  416. /**
  417. * Load master component hosts data for using in required step controllers
  418. */
  419. loadSlaveComponentHosts: function () {
  420. var slaveComponentHosts = this.getDBProperty('slaveComponentHosts'),
  421. hosts = this.getDBProperty('hosts'),
  422. host_names = Em.keys(hosts);
  423. if (!Em.isNone(slaveComponentHosts)) {
  424. slaveComponentHosts.forEach(function (component) {
  425. component.hosts.forEach(function (host) {
  426. for (var i = 0; i < host_names.length; i++) {
  427. if (hosts[host_names[i]].id === host.host_id) {
  428. host.hostName = host_names[i];
  429. break;
  430. }
  431. }
  432. });
  433. });
  434. }
  435. this.set("content.slaveComponentHosts", slaveComponentHosts);
  436. console.log("InstallerController.loadSlaveComponentHosts: loaded hosts ", slaveComponentHosts);
  437. },
  438. /**
  439. * Load serviceConfigProperties to model
  440. */
  441. loadServiceConfigProperties: function () {
  442. var serviceConfigProperties = this.getDBProperty('serviceConfigProperties');
  443. this.set('content.serviceConfigProperties', serviceConfigProperties);
  444. console.log("InstallerController.loadServiceConfigProperties: loaded config ", serviceConfigProperties);
  445. },
  446. /**
  447. * Generate clients list for selected services and save it to model
  448. * @param stepController step4WizardController
  449. */
  450. saveClients: function (stepController) {
  451. var clients = [];
  452. stepController.get('content').filterProperty('isSelected', true).forEach(function (_service) {
  453. var client = _service.get('serviceComponents').filterProperty('isClient', true);
  454. client.forEach(function (clientComponent) {
  455. clients.pushObject({
  456. component_name: clientComponent.get('componentName'),
  457. display_name: clientComponent.get('displayName'),
  458. isInstalled: false
  459. });
  460. }, this);
  461. }, this);
  462. this.setDBProperty('clientInfo', clients);
  463. this.set('content.clients', clients);
  464. },
  465. /**
  466. * Check validation of the customized local urls
  467. */
  468. checkRepoURL: function (wizardStep1Controller) {
  469. var selectedStack = this.get('content.stacks').findProperty('isSelected', true);
  470. selectedStack.set('reload', true);
  471. var nameVersionCombo = selectedStack.get('id');
  472. var stackName = nameVersionCombo.split('-')[0];
  473. var stackVersion = nameVersionCombo.split('-')[1];
  474. var dfd = $.Deferred();
  475. if (selectedStack && selectedStack.get('operatingSystems')) {
  476. this.set('validationCnt', selectedStack.get('repositories').filterProperty('isSelected').length);
  477. var verifyBaseUrl = !wizardStep1Controller.get('skipValidationChecked');
  478. selectedStack.get('operatingSystems').forEach(function (os) {
  479. if (os.get('isSelected')) {
  480. os.get('repositories').forEach(function (repo) {
  481. repo.setProperties({
  482. errorTitle: '',
  483. errorContent: '',
  484. validation: App.Repository.validation['INPROGRESS']
  485. });
  486. this.set('content.isCheckInProgress', true);
  487. App.ajax.send({
  488. name: 'wizard.advanced_repositories.valid_url',
  489. sender: this,
  490. data: {
  491. stackName: stackName,
  492. stackVersion: stackVersion,
  493. repoId: repo.get('repoId'),
  494. osType: os.get('osType'),
  495. osId: os.get('id'),
  496. dfd: dfd,
  497. data: {
  498. 'Repositories': {
  499. 'base_url': repo.get('baseUrl'),
  500. "verify_base_url": verifyBaseUrl
  501. }
  502. }
  503. },
  504. success: 'checkRepoURLSuccessCallback',
  505. error: 'checkRepoURLErrorCallback'
  506. });
  507. }, this);
  508. }
  509. }, this);
  510. }
  511. return dfd.promise();
  512. },
  513. /**
  514. * onSuccess callback for check Repo URL.
  515. */
  516. checkRepoURLSuccessCallback: function (response, request, data) {
  517. console.log('Success in check Repo URL. data osType: ' + data.osType);
  518. var selectedStack = this.get('content.stacks').findProperty('isSelected');
  519. if (selectedStack && selectedStack.get('operatingSystems')) {
  520. var os = selectedStack.get('operatingSystems').findProperty('id', data.osId);
  521. var repo = os.get('repositories').findProperty('repoId', data.repoId);
  522. if (repo) {
  523. repo.set('validation', App.Repository.validation['OK']);
  524. }
  525. }
  526. this.set('validationCnt', this.get('validationCnt') - 1);
  527. if (!this.get('validationCnt')) {
  528. this.set('content.isCheckInProgress', false);
  529. data.dfd.resolve();
  530. }
  531. },
  532. /**
  533. * onError callback for check Repo URL.
  534. */
  535. checkRepoURLErrorCallback: function (request, ajaxOptions, error, data, params) {
  536. console.log('Error in check Repo URL. The baseURL sent is: ' + data.data);
  537. var selectedStack = this.get('content.stacks').findProperty('isSelected', true);
  538. if (selectedStack && selectedStack.get('operatingSystems')) {
  539. var os = selectedStack.get('operatingSystems').findProperty('id', params.osId);
  540. var repo = os.get('repositories').findProperty('repoId', params.repoId);
  541. if (repo) {
  542. repo.setProperties({
  543. validation: App.Repository.validation['INVALID'],
  544. errorTitle: request.status + ":" + request.statusText,
  545. errorContent: $.parseJSON(request.responseText) ? $.parseJSON(request.responseText).message : ""
  546. });
  547. }
  548. }
  549. this.set('content.isCheckInProgress', false);
  550. params.dfd.reject();
  551. },
  552. loadMap: {
  553. '0': [
  554. {
  555. type: 'sync',
  556. callback: function () {
  557. this.load('cluster');
  558. }
  559. }
  560. ],
  561. '1': [
  562. {
  563. type: 'async',
  564. callback: function () {
  565. return this.loadStacks();
  566. }
  567. },
  568. {
  569. type: 'async',
  570. callback: function (stacksLoaded) {
  571. var dfd = $.Deferred();
  572. if (!stacksLoaded) {
  573. $.when.apply(this, this.loadStacksVersions()).done(function () {
  574. dfd.resolve(stacksLoaded);
  575. });
  576. } else {
  577. dfd.resolve(stacksLoaded);
  578. }
  579. return dfd.promise();
  580. }
  581. }
  582. ],
  583. '2': [
  584. {
  585. type: 'sync',
  586. callback: function () {
  587. this.load('installOptions');
  588. }
  589. }
  590. ],
  591. '3': [
  592. {
  593. type: 'sync',
  594. callback: function () {
  595. this.loadConfirmedHosts();
  596. }
  597. }
  598. ],
  599. '4': [
  600. {
  601. type: 'async',
  602. callback: function () {
  603. return this.loadServices();
  604. }
  605. }
  606. ],
  607. '5': [
  608. {
  609. type: 'sync',
  610. callback: function () {
  611. this.setSkipSlavesStep(App.StackService.find().filterProperty('isSelected'), 6);
  612. this.loadMasterComponentHosts();
  613. this.loadConfirmedHosts();
  614. this.loadRecommendations();
  615. }
  616. }
  617. ],
  618. '6': [
  619. {
  620. type: 'sync',
  621. callback: function () {
  622. this.loadSlaveComponentHosts();
  623. this.loadClients();
  624. this.loadRecommendations();
  625. }
  626. }
  627. ],
  628. '7': [
  629. {
  630. type: 'async',
  631. callback: function () {
  632. this.loadServiceConfigGroups();
  633. this.loadServiceConfigProperties();
  634. this.loadCurrentHostGroups();
  635. this.loadRecommendationsConfigs();
  636. return this.loadConfigThemes();
  637. }
  638. }
  639. ]
  640. },
  641. /**
  642. * Clear all temporary data
  643. */
  644. finish: function () {
  645. this.setCurrentStep('0');
  646. this.clearStorageData();
  647. var persists = App.router.get('applicationController').persistKey();
  648. App.router.get('applicationController').postUserPref(persists, true);
  649. },
  650. /**
  651. * Save cluster provisioning state to the server
  652. * @param state cluster provisioning state
  653. */
  654. setClusterProvisioningState: function (state) {
  655. return App.ajax.send({
  656. name: 'cluster.save_provisioning_state',
  657. sender: this,
  658. data: {
  659. state: state
  660. }
  661. });
  662. },
  663. setStepsEnable: function () {
  664. for (var i = 0; i <= this.totalSteps; i++) {
  665. this.get('isStepDisabled').findProperty('step', i).set('value', i > this.get('currentStep'));
  666. }
  667. }.observes('currentStep'),
  668. setLowerStepsDisable: function (stepNo) {
  669. for (var i = 0; i < stepNo; i++) {
  670. var step = this.get('isStepDisabled').findProperty('step', i);
  671. step.set('value', true);
  672. }
  673. }
  674. });