step9_controller.js 22 KB

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