step9_controller.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626
  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. installStartTime: self.get('content.cluster').installStartTime,
  218. isStartError: false,
  219. isCompleted: false
  220. };
  221. App.router.get(self.get('content.controllerName')).saveClusterStatus(clusterStatus);
  222. self.startPolling();
  223. },
  224. error: function () {
  225. console.log("ERROR");
  226. var clusterStatus = {
  227. name: clusterName,
  228. status: 'START FAILED',
  229. installStartTime: self.get('content.cluster').installStartTime,
  230. isStartError: true,
  231. isCompleted: false
  232. };
  233. App.router.get(self.get('content.controllerName')).saveClusterStatus(clusterStatus);
  234. },
  235. statusCode: require('data/statusCodes')
  236. });
  237. },
  238. onSuccessPerHost: function (actions, contentHost) {
  239. if (actions.everyProperty('Tasks.status', 'COMPLETED') && this.get('content.cluster.status') === 'INSTALLED') {
  240. contentHost.set('status', 'success');
  241. }
  242. },
  243. onWarningPerHost: function (actions, contentHost) {
  244. if (actions.someProperty('Tasks.status', 'FAILED') || actions.someProperty('Tasks.status', 'ABORTED') || actions.someProperty('Tasks.status', 'TIMEDOUT')) {
  245. console.log('step9: In warning');
  246. contentHost.set('status', 'warning');
  247. this.set('status', 'warning');
  248. }
  249. },
  250. onInProgressPerHost: function (tasks, contentHost) {
  251. var runningAction = tasks.findProperty('Tasks.status', 'IN_PROGRESS');
  252. if (runningAction === undefined || runningAction === null) {
  253. runningAction = tasks.findProperty('Tasks.status', 'QUEUED');
  254. }
  255. if (runningAction === undefined || runningAction === null) {
  256. runningAction = tasks.findProperty('Tasks.status', 'PENDING');
  257. }
  258. if (runningAction !== null && runningAction !== undefined) {
  259. contentHost.set('message', this.displayMessage(runningAction.Tasks));
  260. }
  261. },
  262. progressPerHost: function (actions, contentHost) {
  263. var progress = 0;
  264. var actionsPerHost = actions.length;
  265. var completedActions = actions.filterProperty('Tasks.status', 'COMPLETED').length
  266. + actions.filterProperty('Tasks.status', 'IN_PROGRESS').length
  267. + actions.filterProperty('Tasks.status', 'FAILED').length
  268. + actions.filterProperty('Tasks.status', 'ABORTED').length
  269. + actions.filterProperty('Tasks.status', 'TIMEDOUT').length;
  270. if (this.get('content.cluster.status') === 'PENDING') {
  271. progress = Math.floor(((completedActions / actionsPerHost) * 100) / 3);
  272. } else if (this.get('content.cluster.status') === 'INSTALLED') {
  273. progress = 34 + Math.floor(((completedActions / actionsPerHost) * 100 * 2) / 3);
  274. }
  275. console.log('INFO: progressPerHost is: ' + progress);
  276. contentHost.set('progress', progress.toString());
  277. return progress;
  278. },
  279. isSuccess: function (polledData) {
  280. return polledData.everyProperty('Tasks.status', 'COMPLETED');
  281. },
  282. isStepFailed: function (polledData) {
  283. var self = this;
  284. var result = false;
  285. polledData.forEach(function (_polledData) {
  286. _polledData.Tasks.sf = 100; //TODO: Remove this line after hook up with actual success factor
  287. var successFactor = _polledData.Tasks.sf;
  288. console.log("Step9: isStepFailed sf value: " + successFactor);
  289. var actionsPerRole = polledData.filterProperty('Tasks.role', _polledData.Tasks.role);
  290. var actionsFailed = actionsPerRole.filterProperty('Tasks.status', 'FAILED');
  291. var actionsAborted = actionsPerRole.filterProperty('Tasks.status', 'ABORTED');
  292. var actionsTimedOut = actionsPerRole.filterProperty('Tasks.status', 'TIMEDOUT');
  293. if ((((actionsFailed.length + actionsAborted.length + actionsTimedOut.length) / actionsPerRole.length) * 100) > (100 - successFactor)) {
  294. console.log('TRACE: Entering success factor and result is failed');
  295. result = true;
  296. }
  297. });
  298. return result;
  299. },
  300. getFailedHostsForFailedRoles: function (polledData) {
  301. var hostArr = new Ember.Set();
  302. polledData.forEach(function (_polledData) {
  303. _polledData.sf = 100; //TODO: Remove this line after hook up with actual success factor
  304. var successFactor = _polledData.sf;
  305. var actionsPerRole = polledData.filterProperty('Tasks.role', _polledData.Tasks.role);
  306. var actionsFailed = actionsPerRole.filterProperty('Tasks.status', 'FAILED');
  307. var actionsAborted = actionsPerRole.filterProperty('Tasks.status', 'ABORTED');
  308. var actionsTimedOut = actionsPerRole.filterProperty('Tasks.status', 'TIMEDOUT');
  309. if ((((actionsFailed.length + actionsAborted.length + actionsTimedOut.length) / actionsPerRole.length) * 100) > (100 - successFactor)) {
  310. actionsFailed.forEach(function (_actionFailed) {
  311. hostArr.add(_actionFailed.Tasks.host_name);
  312. });
  313. actionsAborted.forEach(function (_actionFailed) {
  314. hostArr.add(_actionFailed.Tasks.host_name);
  315. });
  316. actionsTimedOut.forEach(function (_actionFailed) {
  317. hostArr.add(_actionFailed.Tasks.host_name);
  318. });
  319. }
  320. });
  321. return hostArr;
  322. },
  323. setHostsStatus: function (hostNames, status) {
  324. hostNames.forEach(function (_hostName) {
  325. var host = this.hosts.findProperty('name', _hostName);
  326. if (host) {
  327. host.set('status', status)
  328. .set('progress', '100');
  329. }
  330. }, this);
  331. },
  332. // polling from ui stops only when no action has 'PENDING', 'QUEUED' or 'IN_PROGRESS' status
  333. finishState: function (polledData) {
  334. var clusterStatus = {};
  335. var requestId = this.get('content.cluster.requestId');
  336. if (this.get('content.cluster.status') === 'INSTALLED') {
  337. if (!polledData.someProperty('Tasks.status', 'PENDING') && !polledData.someProperty('Tasks.status', 'QUEUED') && !polledData.someProperty('Tasks.status', 'IN_PROGRESS')) {
  338. this.set('progress', '100');
  339. clusterStatus = {
  340. status: 'INSTALLED',
  341. requestId: requestId,
  342. isCompleted: true,
  343. installStartTime: this.get('content.cluster.installStartTime')
  344. }
  345. if (this.isSuccess(polledData)) {
  346. clusterStatus.status = 'STARTED';
  347. var serviceStartTime = new Date().getTime();
  348. var timeToStart = ((parseInt(serviceStartTime) - parseInt(this.get('content.cluster.installStartTime'))) / 60000).toFixed(2);
  349. clusterStatus.installTime = timeToStart;
  350. this.set('status', 'success');
  351. } else {
  352. if (this.isStepFailed(polledData)) {
  353. clusterStatus.status = 'START FAILED'; // 'START FAILED' implies to step10 that installation was successful but start failed
  354. this.set('status', 'failed');
  355. this.setHostsStatus(this.getFailedHostsForFailedRoles(polledData), 'failed');
  356. }
  357. }
  358. App.router.get(this.get('content.controllerName')).saveClusterStatus(clusterStatus);
  359. this.set('isStepCompleted', true);
  360. this.setTasksPerHost();
  361. App.router.get(this.get('content.controllerName')).saveInstalledHosts(this);
  362. return true;
  363. }
  364. } else if (this.get('content.cluster.status') === 'PENDING') {
  365. if (!polledData.someProperty('Tasks.status', 'PENDING') && !polledData.someProperty('Tasks.status', 'QUEUED') && !polledData.someProperty('Tasks.status', 'IN_PROGRESS')) {
  366. clusterStatus = {
  367. status: 'PENDING',
  368. requestId: requestId,
  369. isCompleted: false,
  370. installStartTime: this.get('content.cluster.installStartTime')
  371. }
  372. if (this.isStepFailed(polledData)) {
  373. console.log("In installation failure");
  374. clusterStatus.status = 'INSTALL FAILED';
  375. this.set('progress', '100');
  376. this.set('status', 'failed');
  377. this.setHostsStatus(this.getFailedHostsForFailedRoles(polledData), 'failed');
  378. App.router.get(this.get('content.controllerName')).saveClusterStatus(clusterStatus);
  379. this.set('isStepCompleted', true);
  380. } else {
  381. clusterStatus.status = 'INSTALLED';
  382. this.set('progress', '34');
  383. this.launchStartServices();
  384. }
  385. this.setTasksPerHost();
  386. App.router.get(this.get('content.controllerName')).saveInstalledHosts(this);
  387. return true;
  388. }
  389. }
  390. return false;
  391. },
  392. setTasksPerHost: function () {
  393. console.log("In setTasksPerHost fo step9*****************");
  394. var tasksData = this.get('polledData');
  395. this.get('hosts').forEach(function (_host) {
  396. var tasksPerHost = tasksData.filterProperty('Tasks.host_name', _host.name); // retrieved from polled Data
  397. if (tasksPerHost.length === 0) {
  398. //alert('For testing with mockData follow the sequence: hit referesh,"mockData btn", "pollData btn", again "pollData btn"');
  399. //exit();
  400. }
  401. if (tasksPerHost !== null && tasksPerHost !== undefined && tasksPerHost.length !== 0) {
  402. tasksPerHost.forEach(function (_taskPerHost) {
  403. console.log('In step9 _taskPerHost function.');
  404. //if (_taskPerHost.Tasks.status !== 'PENDING' && _taskPerHost.Tasks.status !== 'QUEUED' && _taskPerHost.Tasks.status !== 'IN_PROGRESS') {
  405. _host.tasks.pushObject(_taskPerHost);
  406. //}
  407. }, this);
  408. }
  409. }, this);
  410. },
  411. // This is done at HostRole level.
  412. setLogTasksStatePerHost: function (tasksPerHost, host) {
  413. console.log('In step9 setTasksStatePerHost function.');
  414. tasksPerHost.forEach(function (_task) {
  415. console.log('In step9 _taskPerHost function.');
  416. if (_task.Tasks.status !== 'PENDING' && _task.Tasks.status !== 'QUEUED') {
  417. var task = host.logTasks.findProperty('Tasks.id', _task.Tasks.id);
  418. if (task) {
  419. host.logTasks.removeObject(task);
  420. }
  421. host.logTasks.pushObject(_task);
  422. }
  423. }, this);
  424. },
  425. parseHostInfo: function (polledData) {
  426. console.log('TRACE: Entering host info function');
  427. var self = this;
  428. var totalProgress = 0;
  429. /* if (this.get('content.cluster.status') === 'INSTALLED') {
  430. totalProgress = 34;
  431. } else {
  432. totalProgress = 0;
  433. } */
  434. var tasksData = polledData.tasks;
  435. console.log("The value of tasksData is: ", tasksData);
  436. if (!tasksData) {
  437. console.log("Step9: ERROR: NO tasks availaible to process");
  438. }
  439. this.replacePolledData(tasksData);
  440. this.hosts.forEach(function (_host) {
  441. var actionsPerHost = tasksData.filterProperty('Tasks.host_name', _host.name); // retrieved from polled Data
  442. if (actionsPerHost.length === 0) {
  443. console.log("Error: No task is hosted on the host");
  444. }
  445. if (actionsPerHost !== null && actionsPerHost !== undefined && actionsPerHost.length !== 0) {
  446. this.setLogTasksStatePerHost(actionsPerHost, _host);
  447. this.onSuccessPerHost(actionsPerHost, _host); // every action should be a success
  448. this.onWarningPerHost(actionsPerHost, _host); // any action should be a faliure
  449. this.onInProgressPerHost(actionsPerHost, _host); // current running action for a host
  450. totalProgress += self.progressPerHost(actionsPerHost, _host);
  451. }
  452. }, this);
  453. totalProgress = Math.floor(totalProgress / this.hosts.length);
  454. this.set('progress', totalProgress.toString());
  455. console.log("INFO: right now the progress is: " + this.get('progress'));
  456. return this.finishState(tasksData);
  457. },
  458. startPolling: function () {
  459. this.set('isSubmitDisabled', true);
  460. this.doPolling();
  461. },
  462. numPolls: 0,
  463. getUrl: function () {
  464. var clusterName = this.get('content.cluster.name');
  465. var requestId = this.get('content.cluster.requestId');
  466. var url = App.apiPrefix + '/clusters/' + clusterName + '/requests/' + requestId + '?fields=tasks/*';
  467. console.log("URL for step9 is: " + url);
  468. return url;
  469. },
  470. POLL_INTERVAL: 4000,
  471. doPolling: function () {
  472. var self = this;
  473. var url = this.getUrl();
  474. if (App.testMode) {
  475. this.POLL_INTERVAL = 1;
  476. this.numPolls++;
  477. if (this.numPolls == 5) {
  478. url = 'data/wizard/deploy/poll_5.json';
  479. // url = 'data/wizard/deploy/poll_5_failed.json';
  480. } else {
  481. url = 'data/wizard/deploy/poll_' + this.numPolls + '.json';
  482. }
  483. debugger;
  484. }
  485. $.ajax({
  486. type: 'GET',
  487. url: url,
  488. async: true,
  489. timeout: App.timeout,
  490. dataType: 'text',
  491. success: function (data) {
  492. console.log("TRACE: In success function for the GET bootstrap call");
  493. console.log("TRACE: STep9 -> The value is: ", jQuery.parseJSON(data));
  494. var result = self.parseHostInfo(jQuery.parseJSON(data));
  495. if (result !== true) {
  496. window.setTimeout(function () {
  497. self.doPolling();
  498. }, self.POLL_INTERVAL);
  499. } else {
  500. self.stopPolling();
  501. }
  502. },
  503. error: function (request, ajaxOptions, error) {
  504. console.log("TRACE: STep9 -> In error function for the getService call");
  505. console.log("TRACE: STep9 -> value of the url is: " + url);
  506. console.log("TRACE: STep9 -> error code status is: " + request.status);
  507. self.stopPolling();
  508. },
  509. statusCode: require('data/statusCodes')
  510. });
  511. },
  512. stopPolling: function () {
  513. //TODO: uncomment following line after the hook up with the API call
  514. // this.set('isStepCompleted',true);
  515. },
  516. submit: function () {
  517. if (!this.get('isSubmitDisabled')) {
  518. this.set('content.cluster.status', this.get('status'));
  519. this.set('content.cluster.isCompleted', true);
  520. App.router.send('next');
  521. }
  522. },
  523. back: function () {
  524. if (!this.get('isSubmitDisabled')) {
  525. App.router.send('back');
  526. }
  527. },
  528. mockBtn: function () {
  529. this.set('isSubmitDisabled', false);
  530. this.hosts.clear();
  531. var hostInfo = this.mockHostData;
  532. this.renderHosts(hostInfo);
  533. },
  534. pollBtn: function () {
  535. this.set('isSubmitDisabled', false);
  536. var data1 = require('data/mock/step9PolledData/pollData_1');
  537. var data2 = require('data/mock/step9PolledData/pollData_2');
  538. var data3 = require('data/mock/step9PolledData/pollData_3');
  539. var data4 = require('data/mock/step9PolledData/pollData_4');
  540. var data5 = require('data/mock/step9PolledData/pollData_5');
  541. var data6 = require('data/mock/step9PolledData/pollData_6');
  542. var data7 = require('data/mock/step9PolledData/pollData_7');
  543. var data8 = require('data/mock/step9PolledData/pollData_8');
  544. var data9 = require('data/mock/step9PolledData/pollData_9');
  545. console.log("TRACE: In pollBtn function data1");
  546. var counter = parseInt(this.get('pollDataCounter')) + 1;
  547. this.set('pollDataCounter', counter.toString());
  548. switch (this.get('pollDataCounter')) {
  549. case '1':
  550. this.parseHostInfo(data1);
  551. break;
  552. case '2':
  553. this.parseHostInfo(data2);
  554. break;
  555. case '3':
  556. this.parseHostInfo(data3);
  557. break;
  558. case '4':
  559. this.parseHostInfo(data4);
  560. break;
  561. case '5':
  562. this.parseHostInfo(data5);
  563. break;
  564. case '6':
  565. this.set('content.cluster.status', 'INSTALLED');
  566. this.parseHostInfo(data6);
  567. break;
  568. case '7':
  569. this.parseHostInfo(data7);
  570. break;
  571. case '8':
  572. this.parseHostInfo(data8);
  573. break;
  574. case '9':
  575. this.parseHostInfo(data9);
  576. break;
  577. default:
  578. break;
  579. }
  580. }
  581. });