add_controller.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743
  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.AddServiceController = Em.Controller.extend({
  20. name: 'addServiceController',
  21. /**
  22. * All wizards data will be stored in this variable
  23. *
  24. * cluster - cluster name
  25. * hosts - hosts, ssh key, repo info, etc.
  26. * services - services list
  27. * hostsInfo - list of selected hosts
  28. * slaveComponentHosts, - info about slave hosts
  29. * masterComponentHosts - info about master hosts
  30. * config??? - to be described later
  31. */
  32. content: Em.Object.create({
  33. cluster: null,
  34. hosts: null,
  35. services: null,
  36. hostsInfo: null,
  37. slaveComponentHosts: null,
  38. masterComponentHosts: null,
  39. serviceConfigProperties: null,
  40. advancedServiceConfig: null,
  41. controllerName: 'addServiceController',
  42. isWizard: true
  43. }),
  44. /**
  45. * Used for hiding back button in wizard
  46. */
  47. hideBackButton: true,
  48. isStepDisabled: [],
  49. totalSteps: 9,
  50. init: function () {
  51. this.isStepDisabled.pushObject(Ember.Object.create({
  52. step: 1,
  53. value: false
  54. }));
  55. for (var i = 2; i <= this.totalSteps; i++) {
  56. this.isStepDisabled.pushObject(Ember.Object.create({
  57. step: i,
  58. value: true
  59. }));
  60. }
  61. },
  62. setStepsEnable: function () {
  63. for (var i = 2; i <= this.totalSteps; i++) {
  64. var step = this.get('isStepDisabled').findProperty('step', i);
  65. if (i <= this.get('currentStep')) {
  66. step.set('value', false);
  67. } else {
  68. step.set('value', true);
  69. }
  70. }
  71. }.observes('currentStep'),
  72. /**
  73. * Return current step of Add Host Wizard
  74. */
  75. currentStep: function () {
  76. return App.get('router').getWizardCurrentStep('addService');
  77. }.property(),
  78. clusters: null,
  79. /**
  80. * Set current step to new value.
  81. * Method moved from App.router.setInstallerCurrentStep
  82. * @param currentStep
  83. * @param completed
  84. */
  85. setCurrentStep: function (currentStep, completed) {
  86. App.db.setWizardCurrentStep('addService', currentStep, completed);
  87. this.set('currentStep', currentStep);
  88. },
  89. isStep1: function () {
  90. return this.get('currentStep') == 1;
  91. }.property('currentStep'),
  92. isStep2: function () {
  93. return this.get('currentStep') == 2;
  94. }.property('currentStep'),
  95. isStep3: function () {
  96. return this.get('currentStep') == 3;
  97. }.property('currentStep'),
  98. isStep4: function () {
  99. return this.get('currentStep') == 4;
  100. }.property('currentStep'),
  101. isStep5: function () {
  102. return this.get('currentStep') == 5;
  103. }.property('currentStep'),
  104. isStep6: function () {
  105. return this.get('currentStep') == 6;
  106. }.property('currentStep'),
  107. isStep7: function () {
  108. return this.get('currentStep') == 7;
  109. }.property('currentStep'),
  110. gotoStep: function (step) {
  111. if (this.get('isStepDisabled').findProperty('step', step).get('value') === false) {
  112. App.router.send('gotoStep' + step);
  113. }
  114. },
  115. gotoStep1: function () {
  116. this.gotoStep(1);
  117. },
  118. gotoStep2: function () {
  119. this.gotoStep(2);
  120. },
  121. gotoStep3: function () {
  122. this.gotoStep(3);
  123. },
  124. gotoStep4: function () {
  125. this.gotoStep(4);
  126. },
  127. gotoStep5: function () {
  128. this.gotoStep(5);
  129. },
  130. gotoStep6: function () {
  131. this.gotoStep(6);
  132. },
  133. gotoStep7: function () {
  134. this.gotoStep(7);
  135. },
  136. /**
  137. * Load clusterInfo(step1) to model
  138. */
  139. loadClusterInfo: function(){
  140. var cluster = App.db.getClusterStatus();
  141. if(!cluster){
  142. cluster = {
  143. name: App.router.getClusterName(),
  144. status: "",
  145. isCompleted: false
  146. };
  147. App.db.setClusterStatus(cluster);
  148. }
  149. this.set('content.cluster', cluster);
  150. console.log("AddServiceController:loadClusterInfo: loaded data ", cluster);
  151. },
  152. /**
  153. * save status of the cluster. This is called from step8 and step9 to persist install and start requestId
  154. * @param clusterStatus object with status, isCompleted, requestId, isInstallError and isStartError field.
  155. */
  156. saveClusterStatus: function (clusterStatus) {
  157. clusterStatus.name = this.get('content.cluster.name');
  158. this.set('content.cluster', clusterStatus);
  159. console.log('called saveClusterStatus ' + JSON.stringify(clusterStatus));
  160. App.db.setClusterStatus(clusterStatus);
  161. },
  162. /**
  163. * Temporary function for wizardStep9, before back-end integration
  164. */
  165. setInfoForStep9: function () {
  166. var hostInfo = App.db.getHosts();
  167. for (var index in hostInfo) {
  168. hostInfo[index].status = "pending";
  169. hostInfo[index].message = 'Information';
  170. hostInfo[index].progress = '0';
  171. }
  172. App.db.setHosts(hostInfo);
  173. },
  174. /**
  175. * Load confirmed hosts.
  176. * Will be used at <code>Assign Masters(step5)</code> step
  177. */
  178. loadConfirmedHosts: function(){
  179. var hosts = App.db.getHosts();
  180. if(!hosts){
  181. var hosts = {};
  182. App.Host.find().forEach(function(item){
  183. hosts[item.get('id')] = {
  184. name: item.get('id'),
  185. cpu: item.get('cpu'),
  186. memory: item.get('memory'),
  187. bootStatus: "success",
  188. isInstalled: true
  189. };
  190. });
  191. }
  192. this.set('content.hostsInfo', hosts);
  193. console.log('AddServiceController.loadConfirmedHosts: loaded hosts', hosts);
  194. },
  195. /**
  196. * Save data after installation to main controller
  197. * @param stepController App.WizardStep9Controller
  198. */
  199. saveInstalledHosts: function (stepController) {
  200. var hosts = stepController.get('hosts');
  201. var hostInfo = App.db.getHosts();
  202. for (var index in hostInfo) {
  203. hostInfo[index].status = "pending";
  204. var host = hosts.findProperty('name', hostInfo[index].name);
  205. if (host) {
  206. hostInfo[index].status = host.status;
  207. hostInfo[index].message = host.message;
  208. hostInfo[index].progress = host.progress;
  209. }
  210. }
  211. App.db.setHosts(hostInfo);
  212. this.set('content.hostsInfo', hostInfo);
  213. console.log('AddServiceController:saveInstalledHosts: save hosts ', hostInfo);
  214. },
  215. /**
  216. * Remove all data for hosts
  217. */
  218. clearHosts: function () {
  219. var hosts = this.get('content').get('hosts');
  220. if (hosts) {
  221. hosts.hostNames = '';
  222. hosts.manualInstall = false;
  223. hosts.localRepo = '';
  224. hosts.localRepopath = '';
  225. hosts.sshKey = '';
  226. hosts.passphrase = '';
  227. hosts.confirmPassphrase = '';
  228. }
  229. App.db.setHosts(null);
  230. App.db.setAllHostNames(null);
  231. },
  232. /**
  233. * Load services data. Will be used at <code>Select services(step4)</code> step
  234. */
  235. loadServices: function () {
  236. var servicesInfo = App.db.getService();
  237. if(!servicesInfo || !servicesInfo.length){
  238. servicesInfo = require('data/mock/services').slice(0);
  239. servicesInfo.forEach(function(item, index){
  240. servicesInfo[index].isSelected = App.Service.find().someProperty('id', item.serviceName);
  241. servicesInfo[index].isDisabled = servicesInfo[index].isSelected;
  242. servicesInfo[index].isInstalled = servicesInfo[index].isSelected;
  243. });
  244. }
  245. servicesInfo.forEach(function (item, index) {
  246. servicesInfo[index] = Em.Object.create(item);
  247. });
  248. this.set('content.services', servicesInfo);
  249. console.log('AddServiceController.loadServices: loaded data ', servicesInfo);
  250. console.log('selected services ', servicesInfo.filterProperty('isSelected', true).filterProperty('isDisabled', false).mapProperty('serviceName'));
  251. },
  252. /**
  253. * Save data to model
  254. * @param stepController App.WizardStep4Controller
  255. */
  256. saveServices: function (stepController) {
  257. var serviceNames = [];
  258. App.db.setService(stepController.get('content'));
  259. console.log('AddServiceController.saveServices: saved data', stepController.get('content'));
  260. stepController.filterProperty('isSelected', true).filterProperty('isInstalled', false).forEach(function (item) {
  261. serviceNames.push(item.serviceName);
  262. });
  263. this.set('content.selectedServiceNames', serviceNames);
  264. App.db.setSelectedServiceNames(serviceNames);
  265. console.log('AddServiceController.selectedServiceNames:', serviceNames);
  266. },
  267. /**
  268. * Save Master Component Hosts data to Main Controller
  269. * @param stepController App.WizardStep5Controller
  270. */
  271. saveMasterComponentHosts: function (stepController) {
  272. var obj = stepController.get('selectedServicesMasters');
  273. var masterComponentHosts = [];
  274. var installedComponents = App.Component.find();
  275. obj.forEach(function (_component) {
  276. masterComponentHosts.push({
  277. display_name: _component.display_name,
  278. component: _component.component_name,
  279. hostName: _component.selectedHost,
  280. serviceId: _component.serviceId,
  281. isInstalled: installedComponents.someProperty('componentName', _component.component_name)
  282. });
  283. });
  284. console.log("AddServiceController.saveMasterComponentHosts: saved hosts ", masterComponentHosts);
  285. App.db.setMasterComponentHosts(masterComponentHosts);
  286. this.set('content.masterComponentHosts', masterComponentHosts);
  287. },
  288. /**
  289. * Load master component hosts data for using in required step controllers
  290. */
  291. loadMasterComponentHosts: function () {
  292. var masterComponentHosts = App.db.getMasterComponentHosts();
  293. if(!masterComponentHosts){
  294. masterComponentHosts = [];
  295. App.Component.find().filterProperty('isMaster', true).forEach(function(item){
  296. masterComponentHosts.push({
  297. component: item.get('componentName'),
  298. hostName: item.get('host.hostName'),
  299. isInstalled: true
  300. })
  301. });
  302. }
  303. this.set("content.masterComponentHosts", masterComponentHosts);
  304. console.log("AddServiceController.loadMasterComponentHosts: loaded hosts ", masterComponentHosts);
  305. },
  306. /**
  307. * Save slaveHostComponents to main controller
  308. * @param stepController
  309. */
  310. saveSlaveComponentHosts: function (stepController) {
  311. var hosts = stepController.get('hosts');
  312. var isMrSelected = stepController.get('isMrSelected');
  313. var isHbSelected = stepController.get('isHbSelected');
  314. var dataNodeHosts = [];
  315. var taskTrackerHosts = [];
  316. var regionServerHosts = [];
  317. var clientHosts = [];
  318. hosts.forEach(function (host) {
  319. if (host.get('isDataNode')) {
  320. dataNodeHosts.push({
  321. hostName: host.hostName,
  322. group: 'Default',
  323. isInstalled: host.get('isDataNodeInstalled')
  324. });
  325. }
  326. if (isMrSelected && host.get('isTaskTracker')) {
  327. taskTrackerHosts.push({
  328. hostName: host.hostName,
  329. group: 'Default',
  330. isInstalled: host.get('isTaskTrackerInstalled')
  331. });
  332. }
  333. if (isHbSelected && host.get('isRegionServer')) {
  334. regionServerHosts.push({
  335. hostName: host.hostName,
  336. group: 'Default',
  337. isInstalled: host.get('isRegionServerInstalled')
  338. });
  339. }
  340. if (host.get('isClient')) {
  341. clientHosts.pushObject({
  342. hostName: host.hostName,
  343. group: 'Default',
  344. isInstalled: host.get('isClientInstalled')
  345. });
  346. }
  347. }, this);
  348. var slaveComponentHosts = [];
  349. slaveComponentHosts.push({
  350. componentName: 'DATANODE',
  351. displayName: 'DataNode',
  352. hosts: dataNodeHosts
  353. });
  354. if (isMrSelected) {
  355. slaveComponentHosts.push({
  356. componentName: 'TASKTRACKER',
  357. displayName: 'TaskTracker',
  358. hosts: taskTrackerHosts
  359. });
  360. }
  361. if (isHbSelected) {
  362. slaveComponentHosts.push({
  363. componentName: 'HBASE_REGIONSERVER',
  364. displayName: 'RegionServer',
  365. hosts: regionServerHosts
  366. });
  367. }
  368. slaveComponentHosts.pushObject({
  369. componentName: 'CLIENT',
  370. displayName: 'client',
  371. hosts: clientHosts
  372. });
  373. App.db.setSlaveComponentHosts(slaveComponentHosts);
  374. console.log('addServiceController.slaveComponentHosts: saved hosts', slaveComponentHosts);
  375. this.set('content.slaveComponentHosts', slaveComponentHosts);
  376. },
  377. /**
  378. * return slaveComponents bound to hosts
  379. * @return {Array}
  380. */
  381. getSlaveComponentHosts: function () {
  382. var components = [{
  383. name : 'DATANODE',
  384. service : 'HDFS'
  385. },
  386. {
  387. name: 'TASKTRACKER',
  388. service: 'MAPREDUCE'
  389. },{
  390. name: 'HBASE_REGIONSERVER',
  391. service: 'HBASE'
  392. }];
  393. var result = [];
  394. var services = App.Service.find();
  395. var selectedServices = this.get('content.services').filterProperty('isSelected', true).mapProperty('serviceName');
  396. for(var index=0; index < components.length; index++){
  397. var comp = components[index];
  398. if(!selectedServices.contains(comp.service)){
  399. continue;
  400. }
  401. var service = services.findProperty('id', comp.service);
  402. var hosts = [];
  403. if(!service){
  404. service = services.findProperty('id', 'HDFS');
  405. service.get('hostComponents').filterProperty('componentName', 'DATANODE').forEach(function (host_component) {
  406. hosts.push({
  407. group: "Default",
  408. hostName: host_component.get('host.id'),
  409. isInstalled: false
  410. });
  411. }, this);
  412. } else {
  413. service.get('hostComponents').filterProperty('componentName', comp.name).forEach(function (host_component) {
  414. hosts.push({
  415. group: "Default",
  416. hostName: host_component.get('host.id'),
  417. isInstalled: true
  418. });
  419. }, this);
  420. }
  421. result.push({
  422. componentName: comp.name,
  423. displayName: App.format.role(comp.name),
  424. hosts: hosts
  425. })
  426. }
  427. var clientsHosts = App.HostComponent.find().filterProperty('componentName', 'HDFS_CLIENT');
  428. var hosts = [];
  429. clientsHosts.forEach(function (host_component) {
  430. hosts.push({
  431. group: "Default",
  432. hostName: host_component.get('host.id'),
  433. isInstalled: true
  434. });
  435. }, this);
  436. result.push({
  437. componentName: 'CLIENT',
  438. displayName: 'client',
  439. hosts: hosts
  440. })
  441. return result;
  442. },
  443. /**
  444. * Load master component hosts data for using in required step controllers
  445. */
  446. loadSlaveComponentHosts: function () {
  447. var slaveComponentHosts = App.db.getSlaveComponentHosts();
  448. if(!slaveComponentHosts){
  449. slaveComponentHosts = this.getSlaveComponentHosts();
  450. }
  451. this.set("content.slaveComponentHosts", slaveComponentHosts);
  452. console.log("AddServiceController.loadSlaveComponentHosts: loaded hosts ", slaveComponentHosts);
  453. },
  454. /**
  455. * Save config properties
  456. * @param stepController Step7WizardController
  457. */
  458. saveServiceConfigProperties: function (stepController) {
  459. var serviceConfigProperties = [];
  460. stepController.get('stepConfigs').forEach(function (_content) {
  461. _content.get('configs').forEach(function (_configProperties) {
  462. var configProperty = {
  463. name: _configProperties.get('name'),
  464. value: _configProperties.get('value'),
  465. service: _configProperties.get('serviceName')
  466. };
  467. serviceConfigProperties.push(configProperty);
  468. }, this);
  469. }, this);
  470. App.db.setServiceConfigProperties(serviceConfigProperties);
  471. this.set('content.serviceConfigProperties', serviceConfigProperties);
  472. },
  473. /**
  474. * Load serviceConfigProperties to model
  475. */
  476. loadServiceConfigProperties: function () {
  477. var serviceConfigProperties = App.db.getServiceConfigProperties();
  478. this.set('content.serviceConfigProperties', serviceConfigProperties);
  479. console.log("AddServiceController.loadServiceConfigProperties: loaded config ", serviceConfigProperties);
  480. },
  481. /**
  482. * Load information about hosts with clients components
  483. */
  484. loadClients: function(){
  485. var clients = App.db.getClientsForSelectedServices();
  486. this.set('content.clients', clients);
  487. console.log("AddServiceController.loadClients: loaded list ", clients);
  488. },
  489. dataLoading: function(){
  490. var dfd = $.Deferred();
  491. this.connectOutlet('loading');
  492. var interval = setInterval(function(){
  493. if (App.router.get('clusterController.isLoaded')){
  494. dfd.resolve();
  495. clearInterval(interval);
  496. }
  497. },50);
  498. return dfd.promise();
  499. },
  500. /**
  501. * Generate clients list for selected services and save it to model
  502. * @param stepController step4WizardController
  503. */
  504. saveClients: function(stepController){
  505. var clients = [];
  506. var serviceComponents = require('data/service_components');
  507. var hostComponents = App.HostComponent.find();
  508. stepController.get('content').filterProperty('isSelected',true).forEach(function (_service) {
  509. var client = serviceComponents.filterProperty('service_name', _service.serviceName).findProperty('isClient', true);
  510. if (client) {
  511. clients.pushObject({
  512. component_name: client.component_name,
  513. display_name: client.display_name,
  514. isInstalled: hostComponents.filterProperty('componentName', client.component_name).length > 0
  515. });
  516. }
  517. }, this);
  518. App.db.setClientsForSelectedServices(clients);
  519. this.set('content.clients', clients);
  520. console.log("AddServiceController.saveClients: saved list ", clients);
  521. },
  522. /**
  523. * Load data for all steps until <code>current step</code>
  524. */
  525. loadAllPriorSteps: function () {
  526. var step = this.get('currentStep');
  527. switch (step) {
  528. case '7':
  529. case '6':
  530. case '5':
  531. this.loadClusterInfo();
  532. case '4':
  533. this.loadServiceConfigProperties();
  534. case '3':
  535. this.loadServices();
  536. this.loadClients();
  537. this.loadSlaveComponentHosts();//depends on loadServices
  538. case '2':
  539. this.loadMasterComponentHosts();
  540. this.loadConfirmedHosts();
  541. case '1':
  542. this.loadServices();
  543. }
  544. },
  545. loadAdvancedConfigs: function () {
  546. App.db.getSelectedServiceNames().forEach(function (_serviceName) {
  547. this.loadAdvancedConfig(_serviceName);
  548. }, this);
  549. },
  550. /**
  551. * Generate serviceProperties save it to localdata
  552. * called form stepController step6WizardController
  553. */
  554. loadAdvancedConfig: function (serviceName) {
  555. var self = this;
  556. var url = (App.testMode) ? '/data/wizard/stack/hdp/version01/' + serviceName + '.json' : App.apiPrefix + '/stacks/HDP/version/1.2.0/services/' + serviceName; // TODO: get this url from the stack selected by the user in Install Options page
  557. var method = 'GET';
  558. $.ajax({
  559. type: method,
  560. url: url,
  561. async: false,
  562. dataType: 'text',
  563. timeout: App.timeout,
  564. success: function (data) {
  565. var jsonData = jQuery.parseJSON(data);
  566. console.log("TRACE: Step6 submit -> In success function for the loadAdvancedConfig call");
  567. console.log("TRACE: Step6 submit -> value of the url is: " + url);
  568. var serviceComponents = jsonData.properties;
  569. serviceComponents.setEach('serviceName', serviceName);
  570. var configs;
  571. if (App.db.getAdvancedServiceConfig()) {
  572. configs = App.db.getAdvancedServiceConfig();
  573. } else {
  574. configs = [];
  575. }
  576. configs = configs.concat(serviceComponents);
  577. self.set('content.advancedServiceConfig', configs);
  578. App.db.setAdvancedServiceConfig(configs);
  579. console.log('TRACE: servicename: ' + serviceName);
  580. },
  581. error: function (request, ajaxOptions, error) {
  582. console.log("TRACE: STep6 submit -> In error function for the loadAdvancedConfig call");
  583. console.log("TRACE: STep6 submit-> value of the url is: " + url);
  584. console.log("TRACE: STep6 submit-> error code status is: " + request.status);
  585. console.log('Step6 submit: Error message is: ' + request.responseText);
  586. },
  587. statusCode: require('data/statusCodes')
  588. });
  589. },
  590. /**
  591. * Generate clients list for selected services and save it to model
  592. * @param stepController step8WizardController or step9WizardController
  593. */
  594. installServices: function () {
  595. var self = this;
  596. var clusterName = this.get('content.cluster.name');
  597. var url = (App.testMode) ? '/data/wizard/deploy/poll_1.json' : App.apiPrefix + '/clusters/' + clusterName + '/services?state=INIT';
  598. var method = (App.testMode) ? 'GET' : 'PUT';
  599. var data = '{"ServiceInfo": {"state": "INSTALLED"}}';
  600. $.ajax({
  601. type: method,
  602. url: url,
  603. data: data,
  604. async: false,
  605. dataType: 'text',
  606. timeout: App.timeout,
  607. success: function (data) {
  608. var jsonData = jQuery.parseJSON(data);
  609. var installSartTime = new Date().getTime();
  610. console.log("TRACE: STep8 -> In success function for the installService call");
  611. console.log("TRACE: STep8 -> value of the url is: " + url);
  612. if (jsonData) {
  613. var requestId = jsonData.href.match(/.*\/(.*)$/)[1];
  614. console.log('requestId is: ' + requestId);
  615. var clusterStatus = {
  616. status: 'PENDING',
  617. requestId: requestId,
  618. isInstallError: false,
  619. isCompleted: false,
  620. installStartTime: installSartTime
  621. };
  622. self.saveClusterStatus(clusterStatus);
  623. } else {
  624. console.log('ERROR: Error occurred in parsing JSON data');
  625. }
  626. },
  627. error: function (request, ajaxOptions, error) {
  628. console.log("TRACE: STep8 -> In error function for the installService call");
  629. console.log("TRACE: STep8 -> value of the url is: " + url);
  630. console.log("TRACE: STep8 -> error code status is: " + request.status);
  631. console.log('Step8: Error message is: ' + request.responseText);
  632. var clusterStatus = {
  633. status: 'PENDING',
  634. isInstallError: true,
  635. isCompleted: false
  636. };
  637. self.saveClusterStatus(clusterStatus);
  638. },
  639. statusCode: require('data/statusCodes')
  640. });
  641. },
  642. /**
  643. * Remove all loaded data.
  644. * Created as copy for App.router.clearAllSteps
  645. */
  646. clearAllSteps: function () {
  647. this.clearHosts();
  648. //todo it)
  649. },
  650. /**
  651. * Clear all temporary data
  652. */
  653. finish: function(){
  654. this.setCurrentStep('1', false);
  655. App.db.setService(undefined); //not to use this data at AddService page
  656. App.db.setHosts(undefined);
  657. App.db.setMasterComponentHosts(undefined);
  658. App.db.setSlaveComponentHosts(undefined);
  659. App.db.setClusterStatus(undefined);
  660. }
  661. });