step9_controller.js 23 KB

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