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