step9_controller.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630
  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.WizardStep9Controller = Em.Controller.extend({
  20. name: 'wizardStep9Controller',
  21. hosts: [],
  22. progress: '0',
  23. isStepCompleted: false,
  24. isSubmitDisabled: function () {
  25. //return false;
  26. return !this.get('isStepCompleted'); //TODO: uncomment after the hook up
  27. }.property('isStepCompleted'),
  28. mockHostData: require('data/mock/step9_hosts'),
  29. pollDataCounter: 0,
  30. polledData: [],
  31. status: function () {
  32. if (this.hosts.length && this.hosts.everyProperty('status', 'success')) {
  33. return 'success';
  34. } else if (this.hosts.someProperty('status', 'failed')) {
  35. return 'failed';
  36. } else if (this.hosts.someProperty('status', 'warning')) {
  37. return 'warning';
  38. } else {
  39. return 'info';
  40. }
  41. }.property('hosts.@each.status'),
  42. showRetry: function(){
  43. return this.get('status') == 'failed';
  44. }.property('status'),
  45. navigateStep: function () {
  46. if (this.get('content.cluster.isCompleted') === false) {
  47. if (this.get('content.cluster.status') === 'INSTALL FAILED') {
  48. this.loadStep();
  49. this.hosts.setEach('status', 'failed');
  50. this.set('progress', '100');
  51. this.set('isStepCompleted', true);
  52. //this.set('status', 'failed');
  53. } else if (this.get('content.cluster.status') === 'START FAILED') {
  54. this.hosts.setEach('status', 'info');
  55. this.set('isStepCompleted', false);
  56. this.launchStartServices();
  57. } else {
  58. this.loadStep();
  59. this.startPolling();
  60. }
  61. } else {
  62. this.set('isStepCompleted', true);
  63. this.set('progress', '100');
  64. }
  65. },
  66. clearStep: function () {
  67. this.hosts.clear();
  68. this.set('status', 'info');
  69. this.set('progress', '0');
  70. this.set('isStepCompleted', false);
  71. this.numPolls = 0;
  72. },
  73. loadStep: function () {
  74. console.log("TRACE: Loading step9: Install, Start and Test");
  75. this.clearStep();
  76. this.renderHosts(this.loadHosts());
  77. },
  78. loadHosts: function () {
  79. var hostInfo = this.get('content.hostsInfo');
  80. var hosts = new Ember.Set();
  81. for (var index in hostInfo) {
  82. var obj = Em.Object.create(hostInfo[index]);
  83. obj.tasks = [];
  84. obj.logTasks = [];
  85. hosts.add(obj);
  86. console.log("TRACE: host name is: " + hostInfo[index].name);
  87. }
  88. // return hosts;
  89. return hosts.filterProperty('bootStatus', 'REGISTERED');
  90. },
  91. renderHosts: function (hostsInfo) {
  92. hostsInfo.forEach(function (_hostInfo) {
  93. var hostInfo = App.HostInfo.create({
  94. name: _hostInfo.name,
  95. status: _hostInfo.status,
  96. tasks: _hostInfo.tasks,
  97. logTasks: _hostInfo.logTasks,
  98. message: _hostInfo.message,
  99. progress: _hostInfo.progress
  100. });
  101. console.log('pushing ' + hostInfo.name);
  102. this.hosts.pushObject(hostInfo);
  103. }, this);
  104. },
  105. replacePolledData: function (polledData) {
  106. this.polledData.clear();
  107. this.set('polledData', polledData);
  108. },
  109. displayMessage: function (task) {
  110. var role = App.format.role(task.role);
  111. console.log("In display message with task command value: " + task.command);
  112. switch (task.command) {
  113. case 'INSTALL':
  114. switch (task.status) {
  115. case 'PENDING':
  116. return 'Preparing to install ' + role;
  117. case 'QUEUED' :
  118. return 'Waiting to install ' + role;
  119. case 'IN_PROGRESS':
  120. return 'Installing ' + role;
  121. case 'COMPLETED' :
  122. return 'Successfully installed ' + role;
  123. case 'FAILED':
  124. return 'Failed to install ' + role;
  125. }
  126. case 'UNINSTALL':
  127. switch (task.status) {
  128. case 'PENDING':
  129. return 'Preparing to uninstall ' + role;
  130. case 'QUEUED' :
  131. return 'Waiting to uninstall ' + role;
  132. case 'IN_PROGRESS':
  133. return 'Uninstalling ' + role;
  134. case 'COMPLETED' :
  135. return 'Successfully uninstalled ' + role;
  136. case 'FAILED':
  137. return 'Failed to uninstall ' + role;
  138. }
  139. case 'START' :
  140. switch (task.status) {
  141. case 'PENDING':
  142. return 'Preparing to start ' + role;
  143. case 'QUEUED' :
  144. return 'Waiting to start ' + role;
  145. case 'IN_PROGRESS':
  146. return 'Starting ' + role;
  147. case 'COMPLETED' :
  148. return role + ' started successfully';
  149. case 'FAILED':
  150. return role + ' failed to start';
  151. }
  152. case 'STOP' :
  153. switch (task.status) {
  154. case 'PENDING':
  155. return 'Preparing to stop ' + role;
  156. case 'QUEUED' :
  157. return 'Waiting to stop ' + role;
  158. case 'IN_PROGRESS':
  159. return 'Stopping ' + role;
  160. case 'COMPLETED' :
  161. return role + ' stopped successfully';
  162. case 'FAILED':
  163. return role + ' failed to stop';
  164. }
  165. case 'EXECUTE' :
  166. switch (task.status) {
  167. case 'PENDING':
  168. return 'Preparing to execute ' + role;
  169. case 'QUEUED' :
  170. return 'Waiting to execute ' + role;
  171. case 'IN_PROGRESS':
  172. return 'Executing ' + role;
  173. case 'COMPLETED' :
  174. return role + ' executed successfully';
  175. case 'FAILED':
  176. return role + ' failed to execute';
  177. }
  178. case 'ABORT' :
  179. switch (task.status) {
  180. case 'PENDING':
  181. return 'Preparing to abort ' + role;
  182. case 'QUEUED' :
  183. return 'Waiting to abort ' + role;
  184. case 'IN_PROGRESS':
  185. return 'Aborting ' + role;
  186. case 'COMPLETED' :
  187. return role + ' aborted successfully';
  188. case 'FAILED':
  189. return role + ' failed to abort';
  190. }
  191. }
  192. },
  193. launchStartServices: function () {
  194. var self = this;
  195. var clusterName = this.get('content.cluster.name');
  196. var url = App.apiPrefix + '/clusters/' + clusterName + '/services?ServiceInfo/state=INSTALLED';
  197. var data = '{"ServiceInfo": {"state": "STARTED"}}';
  198. var method = 'PUT';
  199. if (App.testMode) {
  200. //debugger;
  201. url = '/data/wizard/deploy/poll_6.json';
  202. method = 'GET';
  203. this.numPolls = 6;
  204. }
  205. $.ajax({
  206. type: method,
  207. url: url,
  208. async: false,
  209. data: data,
  210. dataType: 'text',
  211. timeout: App.timeout,
  212. success: function (data) {
  213. var jsonData = jQuery.parseJSON(data);
  214. console.log("TRACE: Step9 -> In success function for the startService call");
  215. console.log("TRACE: Step9 -> value of the url is: " + url);
  216. console.log("TRACE: Step9 -> value of the received data is: " + jsonData);
  217. var requestId = jsonData.href.match(/.*\/(.*)$/)[1];
  218. console.log('requestId is: ' + requestId);
  219. var clusterStatus = {
  220. name: clusterName,
  221. status: 'INSTALLED',
  222. requestId: requestId,
  223. installStartTime: self.get('content.cluster').installStartTime,
  224. isStartError: false,
  225. isCompleted: false
  226. };
  227. App.router.get(self.get('content.controllerName')).saveClusterStatus(clusterStatus);
  228. self.startPolling();
  229. },
  230. error: function () {
  231. console.log("ERROR");
  232. var clusterStatus = {
  233. name: clusterName,
  234. status: 'START FAILED',
  235. installStartTime: self.get('content.cluster').installStartTime,
  236. isStartError: true,
  237. isCompleted: false
  238. };
  239. App.router.get(self.get('content.controllerName')).saveClusterStatus(clusterStatus);
  240. },
  241. statusCode: require('data/statusCodes')
  242. });
  243. },
  244. onSuccessPerHost: function (actions, contentHost) {
  245. if (actions.everyProperty('Tasks.status', 'COMPLETED') && this.get('content.cluster.status') === 'INSTALLED') {
  246. contentHost.set('status', 'success');
  247. }
  248. },
  249. onWarningPerHost: function (actions, contentHost) {
  250. if (actions.someProperty('Tasks.status', 'FAILED') || actions.someProperty('Tasks.status', 'ABORTED') || actions.someProperty('Tasks.status', 'TIMEDOUT')) {
  251. console.log('step9: In warning');
  252. contentHost.set('status', 'warning');
  253. this.set('status', 'warning');
  254. }
  255. },
  256. onInProgressPerHost: function (tasks, contentHost) {
  257. var runningAction = tasks.findProperty('Tasks.status', 'IN_PROGRESS');
  258. if (runningAction === undefined || runningAction === null) {
  259. runningAction = tasks.findProperty('Tasks.status', 'QUEUED');
  260. }
  261. if (runningAction === undefined || runningAction === null) {
  262. runningAction = tasks.findProperty('Tasks.status', 'PENDING');
  263. }
  264. if (runningAction !== null && runningAction !== undefined) {
  265. contentHost.set('message', this.displayMessage(runningAction.Tasks));
  266. }
  267. },
  268. progressPerHost: function (actions, contentHost) {
  269. var progress = 0;
  270. var actionsPerHost = actions.length;
  271. var completedActions = actions.filterProperty('Tasks.status', 'COMPLETED').length
  272. + actions.filterProperty('Tasks.status', 'FAILED').length
  273. + actions.filterProperty('Tasks.status', 'ABORTED').length
  274. + actions.filterProperty('Tasks.status', 'TIMEDOUT').length;
  275. if (this.get('content.cluster.status') === 'PENDING') {
  276. progress = Math.floor(((completedActions / actionsPerHost) * 100) / 3);
  277. } else if (this.get('content.cluster.status') === 'INSTALLED') {
  278. progress = 34 + Math.floor(((completedActions / actionsPerHost) * 100 * 2) / 3);
  279. }
  280. console.log('INFO: progressPerHost is: ' + progress);
  281. contentHost.set('progress', progress.toString());
  282. return progress;
  283. },
  284. isSuccess: function (polledData) {
  285. return polledData.everyProperty('Tasks.status', 'COMPLETED');
  286. },
  287. isStepFailed: function (polledData) {
  288. var self = this;
  289. var result = false;
  290. polledData.forEach(function (_polledData) {
  291. _polledData.Tasks.sf = 100; //TODO: Remove this line after hook up with actual success factor
  292. var successFactor = _polledData.Tasks.sf;
  293. console.log("Step9: isStepFailed sf value: " + successFactor);
  294. var actionsPerRole = polledData.filterProperty('Tasks.role', _polledData.Tasks.role);
  295. var actionsFailed = actionsPerRole.filterProperty('Tasks.status', 'FAILED');
  296. var actionsAborted = actionsPerRole.filterProperty('Tasks.status', 'ABORTED');
  297. var actionsTimedOut = actionsPerRole.filterProperty('Tasks.status', 'TIMEDOUT');
  298. if ((((actionsFailed.length + actionsAborted.length + actionsTimedOut.length) / actionsPerRole.length) * 100) > (100 - successFactor)) {
  299. console.log('TRACE: Entering success factor and result is failed');
  300. result = true;
  301. }
  302. });
  303. return result;
  304. },
  305. getFailedHostsForFailedRoles: function (polledData) {
  306. var hostArr = new Ember.Set();
  307. polledData.forEach(function (_polledData) {
  308. _polledData.sf = 100; //TODO: Remove this line after hook up with actual success factor
  309. var successFactor = _polledData.sf;
  310. var actionsPerRole = polledData.filterProperty('Tasks.role', _polledData.Tasks.role);
  311. var actionsFailed = actionsPerRole.filterProperty('Tasks.status', 'FAILED');
  312. var actionsAborted = actionsPerRole.filterProperty('Tasks.status', 'ABORTED');
  313. var actionsTimedOut = actionsPerRole.filterProperty('Tasks.status', 'TIMEDOUT');
  314. if ((((actionsFailed.length + actionsAborted.length + actionsTimedOut.length) / actionsPerRole.length) * 100) > (100 - successFactor)) {
  315. actionsFailed.forEach(function (_actionFailed) {
  316. hostArr.add(_actionFailed.Tasks.host_name);
  317. });
  318. actionsAborted.forEach(function (_actionFailed) {
  319. hostArr.add(_actionFailed.Tasks.host_name);
  320. });
  321. actionsTimedOut.forEach(function (_actionFailed) {
  322. hostArr.add(_actionFailed.Tasks.host_name);
  323. });
  324. }
  325. });
  326. return hostArr;
  327. },
  328. setHostsStatus: function (hostNames, status) {
  329. hostNames.forEach(function (_hostName) {
  330. var host = this.hosts.findProperty('name', _hostName);
  331. if (host) {
  332. host.set('status', status)
  333. .set('progress', '100');
  334. }
  335. }, this);
  336. },
  337. // polling from ui stops only when no action has 'PENDING', 'QUEUED' or 'IN_PROGRESS' status
  338. finishState: function (polledData) {
  339. var clusterStatus = {};
  340. var requestId = this.get('content.cluster.requestId');
  341. if (this.get('content.cluster.status') === 'INSTALLED') {
  342. if (!polledData.someProperty('Tasks.status', 'PENDING') && !polledData.someProperty('Tasks.status', 'QUEUED') && !polledData.someProperty('Tasks.status', 'IN_PROGRESS')) {
  343. this.set('progress', '100');
  344. clusterStatus = {
  345. status: 'INSTALLED',
  346. requestId: requestId,
  347. isCompleted: true,
  348. installStartTime: this.get('content.cluster.installStartTime')
  349. }
  350. if (this.isSuccess(polledData)) {
  351. clusterStatus.status = 'STARTED';
  352. var serviceStartTime = new Date().getTime();
  353. var timeToStart = ((parseInt(serviceStartTime) - parseInt(this.get('content.cluster.installStartTime'))) / 60000).toFixed(2);
  354. clusterStatus.installTime = timeToStart;
  355. this.set('status', 'success');
  356. } else {
  357. if (this.isStepFailed(polledData)) {
  358. clusterStatus.status = 'START FAILED'; // 'START FAILED' implies to step10 that installation was successful but start failed
  359. this.set('status', 'failed');
  360. this.setHostsStatus(this.getFailedHostsForFailedRoles(polledData), 'failed');
  361. }
  362. }
  363. App.router.get(this.get('content.controllerName')).saveClusterStatus(clusterStatus);
  364. this.set('isStepCompleted', true);
  365. this.setTasksPerHost();
  366. App.router.get(this.get('content.controllerName')).saveInstalledHosts(this);
  367. return true;
  368. }
  369. } else if (this.get('content.cluster.status') === 'PENDING') {
  370. if (!polledData.someProperty('Tasks.status', 'PENDING') && !polledData.someProperty('Tasks.status', 'QUEUED') && !polledData.someProperty('Tasks.status', 'IN_PROGRESS')) {
  371. clusterStatus = {
  372. status: 'PENDING',
  373. requestId: requestId,
  374. isCompleted: false,
  375. installStartTime: this.get('content.cluster.installStartTime')
  376. }
  377. if (this.isStepFailed(polledData)) {
  378. console.log("In installation failure");
  379. clusterStatus.status = 'INSTALL FAILED';
  380. this.set('progress', '100');
  381. this.set('status', 'failed');
  382. this.setHostsStatus(this.getFailedHostsForFailedRoles(polledData), 'failed');
  383. App.router.get(this.get('content.controllerName')).saveClusterStatus(clusterStatus);
  384. this.set('isStepCompleted', true);
  385. } else {
  386. clusterStatus.status = 'INSTALLED';
  387. this.set('progress', '34');
  388. this.launchStartServices();
  389. }
  390. this.setTasksPerHost();
  391. App.router.get(this.get('content.controllerName')).saveInstalledHosts(this);
  392. return true;
  393. }
  394. }
  395. return false;
  396. },
  397. setTasksPerHost: function () {
  398. var tasksData = this.get('polledData');
  399. this.get('hosts').forEach(function (_host) {
  400. var tasksPerHost = tasksData.filterProperty('Tasks.host_name', _host.name); // retrieved from polled Data
  401. if (tasksPerHost.length === 0) {
  402. //alert('For testing with mockData follow the sequence: hit referesh,"mockData btn", "pollData btn", again "pollData btn"');
  403. //exit();
  404. }
  405. if (tasksPerHost !== null && tasksPerHost !== undefined && tasksPerHost.length !== 0) {
  406. tasksPerHost.forEach(function (_taskPerHost) {
  407. console.log('In step9 _taskPerHost function.');
  408. //if (_taskPerHost.Tasks.status !== 'PENDING' && _taskPerHost.Tasks.status !== 'QUEUED' && _taskPerHost.Tasks.status !== 'IN_PROGRESS') {
  409. _host.tasks.pushObject(_taskPerHost);
  410. //}
  411. }, this);
  412. }
  413. }, this);
  414. },
  415. // This is done at HostRole level.
  416. setLogTasksStatePerHost: function (tasksPerHost, host) {
  417. console.log('In step9 setTasksStatePerHost function.');
  418. tasksPerHost.forEach(function (_task) {
  419. console.log('In step9 _taskPerHost function.');
  420. if (_task.Tasks.status !== 'PENDING' && _task.Tasks.status !== 'QUEUED') {
  421. var task = host.logTasks.findProperty('Tasks.id', _task.Tasks.id);
  422. if (task) {
  423. host.logTasks.removeObject(task);
  424. }
  425. host.logTasks.pushObject(_task);
  426. }
  427. }, this);
  428. },
  429. parseHostInfo: function (polledData) {
  430. console.log('TRACE: Entering host info function');
  431. var self = this;
  432. var totalProgress = 0;
  433. /* if (this.get('content.cluster.status') === 'INSTALLED') {
  434. totalProgress = 34;
  435. } else {
  436. totalProgress = 0;
  437. } */
  438. var tasksData = polledData.tasks;
  439. console.log("The value of tasksData is: ", tasksData);
  440. if (!tasksData) {
  441. console.log("Step9: ERROR: NO tasks availaible to process");
  442. }
  443. this.replacePolledData(tasksData);
  444. this.hosts.forEach(function (_host) {
  445. var actionsPerHost = tasksData.filterProperty('Tasks.host_name', _host.name); // retrieved from polled Data
  446. if (actionsPerHost.length === 0) {
  447. console.log("Error: No task is hosted on the host");
  448. }
  449. if (actionsPerHost !== null && actionsPerHost !== undefined && actionsPerHost.length !== 0) {
  450. this.setLogTasksStatePerHost(actionsPerHost, _host);
  451. this.onSuccessPerHost(actionsPerHost, _host); // every action should be a success
  452. this.onWarningPerHost(actionsPerHost, _host); // any action should be a faliure
  453. this.onInProgressPerHost(actionsPerHost, _host); // current running action for a host
  454. totalProgress += self.progressPerHost(actionsPerHost, _host);
  455. }
  456. }, this);
  457. totalProgress = Math.floor(totalProgress / this.hosts.length);
  458. this.set('progress', totalProgress.toString());
  459. console.log("INFO: right now the progress is: " + this.get('progress'));
  460. return this.finishState(tasksData);
  461. },
  462. startPolling: function () {
  463. this.set('isSubmitDisabled', true);
  464. this.doPolling();
  465. },
  466. numPolls: 0,
  467. getUrl: function () {
  468. var clusterName = this.get('content.cluster.name');
  469. var requestId = this.get('content.cluster.requestId');
  470. var url = App.apiPrefix + '/clusters/' + clusterName + '/requests/' + requestId + '?fields=tasks/*';
  471. console.log("URL for step9 is: " + url);
  472. return url;
  473. },
  474. POLL_INTERVAL: 4000,
  475. doPolling: function () {
  476. var self = this;
  477. var url = this.getUrl();
  478. if (App.testMode) {
  479. this.POLL_INTERVAL = 1;
  480. this.numPolls++;
  481. if (this.numPolls == 5) {
  482. url = 'data/wizard/deploy/poll_5.json';
  483. // url = 'data/wizard/deploy/poll_5_failed.json';
  484. } else {
  485. url = 'data/wizard/deploy/poll_' + this.numPolls + '.json';
  486. }
  487. }
  488. $.ajax({
  489. type: 'GET',
  490. url: url,
  491. async: true,
  492. timeout: App.timeout,
  493. dataType: 'text',
  494. success: function (data) {
  495. console.log("TRACE: In success function for the GET bootstrap call");
  496. console.log("TRACE: STep9 -> The value is: ", jQuery.parseJSON(data));
  497. var result = self.parseHostInfo(jQuery.parseJSON(data));
  498. if (result !== true) {
  499. window.setTimeout(function () {
  500. self.doPolling();
  501. }, self.POLL_INTERVAL);
  502. } else {
  503. self.stopPolling();
  504. }
  505. },
  506. error: function (request, ajaxOptions, error) {
  507. console.log("TRACE: STep9 -> In error function for the getService call");
  508. console.log("TRACE: STep9 -> value of the url is: " + url);
  509. console.log("TRACE: STep9 -> error code status is: " + request.status);
  510. self.stopPolling();
  511. },
  512. statusCode: require('data/statusCodes')
  513. });
  514. },
  515. stopPolling: function () {
  516. //TODO: uncomment following line after the hook up with the API call
  517. // this.set('isStepCompleted',true);
  518. },
  519. submit: function () {
  520. if (!this.get('isSubmitDisabled')) {
  521. this.set('content.cluster.status', this.get('status'));
  522. this.set('content.cluster.isCompleted', true);
  523. App.router.send('next');
  524. }
  525. },
  526. back: function () {
  527. if (!this.get('isSubmitDisabled')) {
  528. App.router.send('back');
  529. }
  530. },
  531. mockBtn: function () {
  532. this.set('isSubmitDisabled', false);
  533. this.hosts.clear();
  534. var hostInfo = this.mockHostData;
  535. this.renderHosts(hostInfo);
  536. },
  537. pollBtn: function () {
  538. this.set('isSubmitDisabled', false);
  539. var data1 = require('data/mock/step9PolledData/pollData_1');
  540. var data2 = require('data/mock/step9PolledData/pollData_2');
  541. var data3 = require('data/mock/step9PolledData/pollData_3');
  542. var data4 = require('data/mock/step9PolledData/pollData_4');
  543. var data5 = require('data/mock/step9PolledData/pollData_5');
  544. var data6 = require('data/mock/step9PolledData/pollData_6');
  545. var data7 = require('data/mock/step9PolledData/pollData_7');
  546. var data8 = require('data/mock/step9PolledData/pollData_8');
  547. var data9 = require('data/mock/step9PolledData/pollData_9');
  548. console.log("TRACE: In pollBtn function data1");
  549. var counter = parseInt(this.get('pollDataCounter')) + 1;
  550. this.set('pollDataCounter', counter.toString());
  551. switch (this.get('pollDataCounter')) {
  552. case '1':
  553. this.parseHostInfo(data1);
  554. break;
  555. case '2':
  556. this.parseHostInfo(data2);
  557. break;
  558. case '3':
  559. this.parseHostInfo(data3);
  560. break;
  561. case '4':
  562. this.parseHostInfo(data4);
  563. break;
  564. case '5':
  565. this.parseHostInfo(data5);
  566. break;
  567. case '6':
  568. this.set('content.cluster.status', 'INSTALLED');
  569. this.parseHostInfo(data6);
  570. break;
  571. case '7':
  572. this.parseHostInfo(data7);
  573. break;
  574. case '8':
  575. this.parseHostInfo(data8);
  576. break;
  577. case '9':
  578. this.parseHostInfo(data9);
  579. break;
  580. default:
  581. break;
  582. }
  583. }
  584. });