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. //TODO: uncomment following line after the hook up with the API call
  44. if (this.get('content.cluster.isCompleted') === false) {
  45. this.loadStep();
  46. if (this.get('content.cluster.status') === 'INSTALL FAILED') {
  47. this.set('isStepCompleted', true);
  48. this.set('status', 'failed');
  49. this.set('progress', '100');
  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 = [];
  74. hostInfo = App.db.getHosts();
  75. var hosts = new Ember.Set();
  76. for (var index in hostInfo) {
  77. hosts.add(hostInfo[index]);
  78. console.log("TRACE: host name is: " + hostInfo[index].name);
  79. }
  80. return hosts;
  81. //return hosts.filterProperty('bootStatus', 'success'); //TODO: uncomment after actual hookup with bootstrap
  82. },
  83. renderHosts: function (hostsInfo) {
  84. hostsInfo.forEach(function (_hostInfo) {
  85. var hostInfo = App.HostInfo.create({
  86. name: _hostInfo.name,
  87. status: _hostInfo.status,
  88. tasks: _hostInfo.tasks,
  89. logTasks: _hostInfo.logTasks,
  90. message: _hostInfo.message,
  91. progress: _hostInfo.progress
  92. });
  93. console.log('pushing ' + hostInfo.name);
  94. this.hosts.pushObject(hostInfo);
  95. }, this);
  96. },
  97. replacePolledData: function (polledData) {
  98. this.polledData.clear();
  99. this.set('polledData', polledData);
  100. },
  101. displayMessage: function (task) {
  102. var role = App.format.role(task.role);
  103. console.log("In display message with task command value: " + task.command);
  104. switch (task.command) {
  105. case 'INSTALL':
  106. switch (task.status) {
  107. case 'PENDING':
  108. return 'Preparing to install ' + role;
  109. case 'QUEUED' :
  110. return role + ' is queued for installation';
  111. case 'IN_PROGRESS':
  112. return 'Installing ' + role;
  113. case 'COMPLETED' :
  114. return 'Successfully installed ' + role;
  115. case 'FAILED':
  116. return 'Failed to install ' + role;
  117. }
  118. case 'UNINSTALL':
  119. switch (task.status) {
  120. case 'PENDING':
  121. return 'Preparing to uninstall ' + role;
  122. case 'QUEUED' :
  123. return role + ' is queued for uninstallation';
  124. case 'IN_PROGRESS':
  125. return 'Uninstalling ' + role;
  126. case 'COMPLETED' :
  127. return 'Successfully uninstalled ' + role;
  128. case 'FAILED':
  129. return 'Failed to uninstall ' + role;
  130. }
  131. case 'START' :
  132. switch (task.status) {
  133. case 'PENDING':
  134. return 'Preparing to start ' + role;
  135. case 'QUEUED' :
  136. return role + ' is queued for starting';
  137. case 'IN_PROGRESS':
  138. return 'Starting ' + role;
  139. case 'COMPLETED' :
  140. return role + ' started successfully';
  141. case 'FAILED':
  142. return role + ' failed to start';
  143. }
  144. case 'STOP' :
  145. switch (task.status) {
  146. case 'PENDING':
  147. return 'Preparing to stop ' + role;
  148. case 'QUEUED' :
  149. return role + ' is queued for stopping';
  150. case 'IN_PROGRESS':
  151. return 'Stopping ' + role;
  152. case 'COMPLETED' :
  153. return role + ' stopped successfully';
  154. case 'FAILED':
  155. return role + ' failed to stop';
  156. }
  157. case 'EXECUTE' :
  158. switch (task.status) {
  159. case 'PENDING':
  160. return 'Preparing to execute ' + role;
  161. case 'QUEUED' :
  162. return role + ' is queued for execution';
  163. case 'IN_PROGRESS':
  164. return 'Execution of ' + role + ' in progress';
  165. case 'COMPLETED' :
  166. return role + ' executed successfully';
  167. case 'FAILED':
  168. return role + ' failed to execute';
  169. }
  170. case 'ABORT' :
  171. switch (task.status) {
  172. case 'PENDING':
  173. return 'Preparing to abort ' + role;
  174. case 'QUEUED' :
  175. return role + ' is queued for aborting';
  176. case 'IN_PROGRESS':
  177. return 'Aborting ' + role;
  178. case 'COMPLETED' :
  179. return role + ' aborted successfully';
  180. case 'FAILED':
  181. return role + ' failed to abort';
  182. }
  183. }
  184. },
  185. launchStartServices: function () {
  186. var self = this;
  187. var clusterName = this.get('content.cluster.name');
  188. var url = '/api/clusters/' + clusterName + '/services?state=INSTALLED';
  189. var data = '{"ServiceInfo": {"state": "STARTED"}}';
  190. var method = 'PUT';
  191. if (App.testMode) {
  192. debugger;
  193. url = '/data/wizard/deploy/poll_6.json';
  194. method = 'GET';
  195. this.numPolls = 6;
  196. }
  197. $.ajax({
  198. type: method,
  199. url: url,
  200. async: false,
  201. data: data,
  202. dataType: 'text',
  203. timeout: 5000,
  204. success: function (data) {
  205. var jsonData = jQuery.parseJSON(data);
  206. console.log("TRACE: Step9 -> In success function for the startService call");
  207. console.log("TRACE: Step9 -> value of the url is: " + url);
  208. console.log("TRACE: Step9 -> value of the received data is: " + jsonData);
  209. var requestId = jsonData.href.match(/.*\/(.*)$/)[1];
  210. console.log('requestId is: ' + requestId);
  211. var clusterStatus = {
  212. name: clusterName,
  213. status: 'INSTALLED',
  214. requestId: requestId,
  215. isStartError: false,
  216. isCompleted: false
  217. };
  218. App.router.get('installerController').saveClusterStatus(clusterStatus);
  219. self.startPolling();
  220. },
  221. error: function () {
  222. console.log("ERROR");
  223. var clusterStatus = {
  224. name: clusterName,
  225. status: 'START FAILED',
  226. isStartError: true,
  227. isCompleted: false
  228. };
  229. App.router.get('installerController').saveClusterStatus(clusterStatus);
  230. },
  231. statusCode: require('data/statusCodes')
  232. });
  233. },
  234. onSuccessPerHost: function (actions, contentHost) {
  235. if (actions.everyProperty('Tasks.status', 'COMPLETED') && this.get('content.cluster.status') === 'INSTALLED') {
  236. contentHost.set('status', 'success');
  237. }
  238. },
  239. onWarningPerHost: function (actions, contentHost) {
  240. if (actions.someProperty('Tasks.status', 'FAILED') || actions.someProperty('Tasks.status', 'ABORTED') || actions.someProperty('Tasks.status', 'TIMEDOUT')) {
  241. console.log('step9: In warning');
  242. contentHost.set('status', 'warning');
  243. this.set('status', 'warning');
  244. }
  245. },
  246. onInProgressPerHost: function (tasks, contentHost) {
  247. var runningAction = tasks.findProperty('Tasks.status', 'IN_PROGRESS');
  248. if (runningAction === undefined || runningAction === null) {
  249. runningAction = tasks.findProperty('Tasks.status', 'QUEUED');
  250. }
  251. if (runningAction === undefined || runningAction === null) {
  252. runningAction = tasks.findProperty('Tasks.status', 'PENDING');
  253. }
  254. if (runningAction !== null && runningAction !== undefined) {
  255. contentHost.set('message', this.displayMessage(runningAction.Tasks));
  256. }
  257. },
  258. progressPerHost: function (actions, contentHost) {
  259. var progress = 0;
  260. var actionsPerHost = actions.length;
  261. var completedActions = actions.filterProperty('Tasks.status', 'COMPLETED').length
  262. + actions.filterProperty('Tasks.status', 'IN_PROGRESS').length
  263. + actions.filterProperty('Tasks.status', 'FAILED').length
  264. + actions.filterProperty('Tasks.status', 'ABORTED').length
  265. + actions.filterProperty('Tasks.status', 'TIMEDOUT').length;
  266. if (this.get('content.cluster.status') === 'PENDING') {
  267. progress = Math.floor(((completedActions / actionsPerHost) * 100) / 3);
  268. } else if (this.get('content.cluster.status') === 'INSTALLED') {
  269. progress = 34 + Math.floor(((completedActions / actionsPerHost) * 100 * 2) / 3);
  270. }
  271. console.log('INFO: progressPerHost is: ' + progress);
  272. contentHost.set('progress', progress.toString());
  273. return progress;
  274. },
  275. isSuccess: function (polledData) {
  276. return polledData.everyProperty('Tasks.status', 'COMPLETED');
  277. },
  278. isStepFailed: function (polledData) {
  279. var self = this;
  280. var result = false;
  281. polledData.forEach(function (_polledData) {
  282. _polledData.Tasks.sf = 100; //TODO: Remove this line after hook up with actual success factor
  283. var successFactor = _polledData.Tasks.sf;
  284. console.log("Step9: isStepFailed sf value: " + successFactor);
  285. var actionsPerRole = polledData.filterProperty('Tasks.role', _polledData.Tasks.role);
  286. var actionsFailed = actionsPerRole.filterProperty('Tasks.status', 'FAILED');
  287. var actionsAborted = actionsPerRole.filterProperty('Tasks.status', 'ABORTED');
  288. var actionsTimedOut = actionsPerRole.filterProperty('Tasks.status', 'TIMEDOUT');
  289. if ((((actionsFailed.length + actionsAborted.length + actionsTimedOut.length) / actionsPerRole.length) * 100) > (100 - successFactor)) {
  290. console.log('TRACE: Entering success factor and result is failed');
  291. result = true;
  292. }
  293. });
  294. return result;
  295. },
  296. getFailedHostsForFailedRoles: function (polledData) {
  297. var hostArr = new Ember.Set();
  298. polledData.forEach(function (_polledData) {
  299. _polledData.sf = 100; //TODO: Remove this line after hook up with actual success factor
  300. var successFactor = _polledData.sf;
  301. var actionsPerRole = polledData.filterProperty('Tasks.role', _polledData.Tasks.role);
  302. var actionsFailed = actionsPerRole.filterProperty('Tasks.status', 'FAILED');
  303. var actionsAborted = actionsPerRole.filterProperty('Tasks.status', 'ABORTED');
  304. var actionsTimedOut = actionsPerRole.filterProperty('Tasks.status', 'TIMEDOUT');
  305. if ((((actionsFailed.length + actionsAborted.length + actionsTimedOut.length) / actionsPerRole.length) * 100) > (100 - successFactor)) {
  306. actionsFailed.forEach(function (_actionFailed) {
  307. hostArr.add(_actionFailed.Tasks.host_name);
  308. });
  309. actionsAborted.forEach(function (_actionFailed) {
  310. hostArr.add(_actionFailed.Tasks.host_name);
  311. });
  312. actionsTimedOut.forEach(function (_actionFailed) {
  313. hostArr.add(_actionFailed.Tasks.host_name);
  314. });
  315. }
  316. });
  317. return hostArr;
  318. },
  319. setHostsStatus: function (hostNames, status) {
  320. hostNames.forEach(function (_hostName) {
  321. var host = this.hosts.findProperty('name', _hostName);
  322. host.set('status', status);
  323. host.set('progress', '100');
  324. }, this);
  325. },
  326. // polling from ui stops only when no action has 'PENDING', 'QUEUED' or 'IN_PROGRESS' status
  327. finishState: function (polledData) {
  328. var clusterStatus = {};
  329. var requestId = this.get('content.cluster.requestId');
  330. if (this.get('content.cluster.status') === 'INSTALLED') {
  331. if (!polledData.someProperty('Tasks.status', 'PENDING') && !polledData.someProperty('Tasks.status', 'QUEUED') && !polledData.someProperty('Tasks.status', 'IN_PROGRESS')) {
  332. this.set('progress', '100');
  333. clusterStatus = {
  334. status: 'INSTALLED',
  335. requestId: requestId,
  336. isCompleted: true,
  337. installStartTime: this.get('content.cluster.installStartTime')
  338. }
  339. if (this.isSuccess(polledData)) {
  340. clusterStatus.status = 'STARTED';
  341. var serviceSartTime = new Date().getTime();
  342. var timeToStart = Math.floor((serviceSartTime - this.get('content.cluster.installStartTime')) / 60000);
  343. clusterStatus.installTime = timeToStart;
  344. this.set('status', 'success');
  345. } else {
  346. if (this.isStepFailed(polledData)) {
  347. clusterStatus.status = 'START FAILED'; // 'START FAILED' implies to step10 that installation was successful but start failed
  348. this.set('status', 'failed');
  349. this.setHostsStatus(this.getFailedHostsForFailedRoles(polledData));
  350. }
  351. }
  352. App.router.get('installerController').saveClusterStatus(clusterStatus);
  353. this.set('isStepCompleted', true);
  354. this.setTasksPerHost();
  355. App.router.get('installerController').saveInstalledHosts(this);
  356. return true;
  357. }
  358. } else if (this.get('content.cluster.status') === 'PENDING') {
  359. if (!polledData.someProperty('Tasks.status', 'PENDING') && !polledData.someProperty('Tasks.status', 'QUEUED') && !polledData.someProperty('Tasks.status', 'IN_PROGRESS')) {
  360. clusterStatus = {
  361. status: 'PENDING',
  362. requestId: requestId,
  363. isCompleted: true,
  364. installStartTime: this.get('content.cluster.installStartTime')
  365. }
  366. var serviceSartTime = new Date().getTime();
  367. var timeToStart = serviceSartTime - this.get('content.cluster.installStartTime');
  368. console.log("STEP9: ********The time difference is = " + serviceSartTime / 60000);
  369. if (this.isStepFailed(polledData)) {
  370. console.log("In installation failure");
  371. clusterStatus.status = 'INSTALL FAILED';
  372. this.set('progress', '100');
  373. this.set('status', 'failed');
  374. this.setHostsStatus(this.getFailedHostsForFailedRoles(polledData), 'failed');
  375. App.router.get('installerController').saveClusterStatus(clusterStatus);
  376. this.set('isStepCompleted', true);
  377. } else {
  378. clusterStatus.status = 'INSTALLED';
  379. this.set('progress', '34');
  380. this.launchStartServices(); //TODO: uncomment after the actual hookup
  381. }
  382. this.setTasksPerHost();
  383. App.router.get('installerController').saveInstalledHosts(this);
  384. return true;
  385. }
  386. }
  387. return false;
  388. },
  389. setTasksPerHost: function () {
  390. console.log("In setTasksPerHost fo step9*****************");
  391. var tasksData = this.get('polledData');
  392. this.get('hosts').forEach(function (_host) {
  393. var tasksPerHost = tasksData.filterProperty('Tasks.host_name', _host.name); // retrieved from polled Data
  394. if (tasksPerHost.length === 0) {
  395. //alert('For testing with mockData follow the sequence: hit referesh,"mockData btn", "pollData btn", again "pollData btn"');
  396. //exit();
  397. }
  398. if (tasksPerHost !== null && tasksPerHost !== undefined && tasksPerHost.length !== 0) {
  399. tasksPerHost.forEach(function (_taskPerHost) {
  400. console.log('In step9 _taskPerHost function.');
  401. //if (_taskPerHost.Tasks.status !== 'PENDING' && _taskPerHost.Tasks.status !== 'QUEUED' && _taskPerHost.Tasks.status !== 'IN_PROGRESS') {
  402. _host.tasks.pushObject(_taskPerHost);
  403. //}
  404. }, this);
  405. }
  406. }, this);
  407. },
  408. // This is done at HostRole level.
  409. setLogTasksStatePerHost: function (tasksPerHost, host) {
  410. var tasks = [];
  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 = App.db.getClusterStatus().requestId;
  465. var url = '/api/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/poll_5.json';
  478. url = 'data/wizard/deploy/poll_5_failed.json';
  479. } else {
  480. url = 'data/wizard/deploy/poll_' + this.numPolls + '.json';
  481. }
  482. debugger;
  483. }
  484. $.ajax({
  485. type: 'GET',
  486. url: url,
  487. async: true,
  488. timeout: 10000,
  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. });