installer.js 22 KB

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