step3_controller.js 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179
  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.WizardStep3Controller = Em.Controller.extend({
  20. name: 'wizardStep3Controller',
  21. hosts: [],
  22. content: [],
  23. bootHosts: [],
  24. registeredHosts: [],
  25. registrationStartedAt: null,
  26. registrationTimeoutSecs: function(){
  27. if(this.get('content.installOptions.manualInstall')){
  28. return 15;
  29. }
  30. return 120;
  31. }.property('content.installOptions.manualInstall'),
  32. stopBootstrap: false,
  33. isSubmitDisabled: true,
  34. categoryObject: Em.Object.extend({
  35. hostsCount: function () {
  36. var category = this;
  37. var hosts = this.get('controller.hosts').filter(function(_host) {
  38. if (_host.get('bootStatus') == category.get('hostsBootStatus')) {
  39. return true;
  40. } else if (_host.get('bootStatus') == 'DONE' && category.get('hostsBootStatus') == 'REGISTERING') {
  41. return true;
  42. } else {
  43. return false;
  44. }
  45. }, this);
  46. return hosts.get('length');
  47. }.property('controller.hosts.@each.bootStatus'), // 'hosts.@each.bootStatus'
  48. label: function () {
  49. return "%@ (%@)".fmt(this.get('value'), this.get('hostsCount'));
  50. }.property('value', 'hostsCount')
  51. }),
  52. getCategory: function(field, value){
  53. return this.get('categories').find(function(item){
  54. return item.get(field) == value;
  55. });
  56. },
  57. categories: function () {
  58. var self = this;
  59. self.categoryObject.reopen({
  60. controller: self,
  61. isActive: function(){
  62. return this.get('controller.category') == this;
  63. }.property('controller.category'),
  64. itemClass: function(){
  65. return this.get('isActive') ? 'active' : '';
  66. }.property('isActive')
  67. });
  68. var categories = [
  69. self.categoryObject.create({value: Em.I18n.t('common.all'), hostsCount: function () {
  70. return this.get('controller.hosts.length');
  71. }.property('controller.hosts.length') }),
  72. self.categoryObject.create({value: Em.I18n.t('installer.step3.hosts.status.installing'), hostsBootStatus: 'RUNNING'}),
  73. self.categoryObject.create({value: Em.I18n.t('installer.step3.hosts.status.registering'), hostsBootStatus: 'REGISTERING'}),
  74. self.categoryObject.create({value: Em.I18n.t('common.success'), hostsBootStatus: 'REGISTERED' }),
  75. self.categoryObject.create({value: Em.I18n.t('common.fail'), hostsBootStatus: 'FAILED', last: true })
  76. ];
  77. this.set('category', categories.get('firstObject'));
  78. return categories;
  79. }.property(),
  80. category: false,
  81. allChecked: false,
  82. onAllChecked: function () {
  83. var hosts = this.get('visibleHosts');
  84. hosts.setEach('isChecked', this.get('allChecked'));
  85. }.observes('allChecked'),
  86. noHostsSelected: function () {
  87. return !(this.hosts.someProperty('isChecked', true));
  88. }.property('hosts.@each.isChecked'),
  89. isRetryDisabled: true,
  90. navigateStep: function () {
  91. this.loadStep();
  92. if (this.get('content.installOptions.manualInstall') !== true) {
  93. if (!App.db.getBootStatus()) {
  94. this.startBootstrap();
  95. }
  96. } else {
  97. this.set('bootHosts', this.get('hosts'));
  98. if (App.testMode) {
  99. this.getHostInfo();
  100. this.get('bootHosts').setEach('bootStatus', 'REGISTERED');
  101. this.get('bootHosts').setEach('cpu', '2');
  102. this.get('bootHosts').setEach('memory', '2000000');
  103. this.set('isSubmitDisabled', false);
  104. } else {
  105. this.set('registrationStartedAt', null);
  106. this.get('bootHosts').setEach('bootStatus', 'DONE');
  107. this.startRegistration();
  108. }
  109. }
  110. },
  111. clearStep: function () {
  112. this.set('stopBootstrap', false);
  113. this.hosts.clear();
  114. this.bootHosts.clear();
  115. App.db.setBootStatus(false);
  116. this.set('isSubmitDisabled', true);
  117. this.set('isRetryDisabled', true);
  118. },
  119. loadStep: function () {
  120. console.log("TRACE: Loading step3: Confirm Hosts");
  121. this.set('registrationStartedAt', null);
  122. this.clearStep();
  123. var hosts = this.loadHosts();
  124. // hosts.setEach('bootStatus', 'RUNNING');
  125. this.renderHosts(hosts);
  126. },
  127. /* Loads the hostinfo from localStorage on the insertion of view. It's being called from view */
  128. loadHosts: function () {
  129. var hostInfo = this.get('content.hosts');
  130. var hosts = new Ember.Set();
  131. for (var index in hostInfo) {
  132. hosts.add(hostInfo[index]);
  133. console.log("TRACE: host name is: " + hostInfo[index].name);
  134. }
  135. return hosts;
  136. },
  137. /* Renders the set of passed hosts */
  138. renderHosts: function (hostsInfo) {
  139. var self = this;
  140. hostsInfo.forEach(function (_hostInfo) {
  141. var hostInfo = App.HostInfo.create({
  142. name: _hostInfo.name,
  143. bootStatus: _hostInfo.bootStatus,
  144. isChecked: false
  145. });
  146. console.log('pushing ' + hostInfo.name);
  147. self.hosts.pushObject(hostInfo);
  148. });
  149. },
  150. /**
  151. * Parses and updates the content based on bootstrap API response.
  152. * Returns true if polling should continue (some hosts are in "RUNNING" state); false otherwise
  153. */
  154. parseHostInfo: function (hostsStatusFromServer) {
  155. hostsStatusFromServer.forEach(function (_hostStatus) {
  156. var host = this.get('bootHosts').findProperty('name', _hostStatus.hostName);
  157. // check if hostname extracted from REST API data matches any hostname in content
  158. // also, make sure that bootStatus modified by isHostsRegistered call does not get overwritten
  159. // since these calls are being made in parallel
  160. if (host && !['REGISTERED', 'REGISTERING'].contains(host.get('bootStatus'))) {
  161. host.set('bootStatus', _hostStatus.status);
  162. host.set('bootLog', _hostStatus.log);
  163. }
  164. }, this);
  165. // if the data rendered by REST API has hosts in "RUNNING" state, polling will continue
  166. return this.get('bootHosts').length != 0 && this.get('bootHosts').someProperty('bootStatus', 'RUNNING');
  167. },
  168. /* Returns the current set of visible hosts on view (All, Succeeded, Failed) */
  169. visibleHosts: function () {
  170. if (this.get('category.hostsBootStatus')) {
  171. return this.hosts.filterProperty('bootStatus', this.get('category.hostsBootStatus'));
  172. } else { // if (this.get('category') === 'All Hosts')
  173. return this.hosts;
  174. }
  175. }.property('category', 'hosts.@each.bootStatus'),
  176. removeHosts: function (hosts) {
  177. var self = this;
  178. App.showConfirmationPopup(function() {
  179. App.router.send('removeHosts', hosts);
  180. self.hosts.removeObjects(hosts);
  181. if (!self.hosts.length) {
  182. self.set('isSubmitDisabled', true);
  183. }
  184. },Em.I18n.t('installer.step3.hosts.remove.popup.body'));
  185. },
  186. /* Removes a single element on the trash icon click. Called from View */
  187. removeHost: function (hostInfo) {
  188. this.removeHosts([hostInfo]);
  189. },
  190. removeSelectedHosts: function () {
  191. if (!this.get('noHostsSelected')) {
  192. var selectedHosts = this.get('visibleHosts').filterProperty('isChecked', true);
  193. selectedHosts.forEach(function (_hostInfo) {
  194. console.log('Removing: ' + _hostInfo.name);
  195. });
  196. this.removeHosts(selectedHosts);
  197. }
  198. },
  199. retryHost: function (hostInfo) {
  200. this.retryHosts([hostInfo]);
  201. },
  202. retryHosts: function (hosts) {
  203. var bootStrapData = JSON.stringify({'verbose': true, 'sshKey': this.get('content.installOptions.sshKey'), 'hosts': hosts.mapProperty('name'), 'user': this.get('content.installOptions.sshUser')});
  204. this.numPolls = 0;
  205. if (this.get('content.installOptions.manualInstall') !== true) {
  206. var requestId = App.router.get('installerController').launchBootstrap(bootStrapData);
  207. this.set('content.installOptions.bootRequestId', requestId);
  208. this.set('registrationStartedAt', null);
  209. this.doBootstrap();
  210. } else {
  211. this.set('registrationStartedAt', null);
  212. this.get('bootHosts').setEach('bootStatus', 'DONE');
  213. this.startRegistration();
  214. }
  215. },
  216. retrySelectedHosts: function () {
  217. //to display all hosts
  218. this.set('category', 'All');
  219. if (!this.get('isRetryDisabled')) {
  220. this.set('isRetryDisabled', true);
  221. var selectedHosts = this.get('bootHosts').filterProperty('bootStatus', 'FAILED');
  222. selectedHosts.forEach(function (_host) {
  223. _host.set('bootStatus', 'RUNNING');
  224. _host.set('bootLog', 'Retrying ...');
  225. }, this);
  226. this.retryHosts(selectedHosts);
  227. }
  228. },
  229. numPolls: 0,
  230. startBootstrap: function () {
  231. //this.set('isSubmitDisabled', true); //TODO: uncomment after actual hookup
  232. this.numPolls = 0;
  233. this.set('registrationStartedAt', null);
  234. this.set('bootHosts', this.get('hosts'));
  235. this.get('bootHosts').setEach('bootStatus', 'PENDING');
  236. this.doBootstrap();
  237. },
  238. isInstallInProgress: function(){
  239. var bootStatuses = this.get('bootHosts').getEach('bootStatus');
  240. if(bootStatuses.length &&
  241. (bootStatuses.contains('REGISTERING') ||
  242. bootStatuses.contains('DONE') ||
  243. bootStatuses.contains('RUNNING') ||
  244. bootStatuses.contains('PENDING'))){
  245. return true;
  246. }
  247. return false;
  248. }.property('bootHosts.@each.bootStatus'),
  249. disablePreviousSteps: function(){
  250. if(this.get('isInstallInProgress')){
  251. App.router.get('installerController').setLowerStepsDisable(3);
  252. this.set('isSubmitDisabled', true);
  253. } else {
  254. App.router.get('installerController.isStepDisabled').filter(function(step){
  255. if(step.step >= 0 && step.step <= 2) return true;
  256. }).setEach('value', false);
  257. }
  258. }.observes('isInstallInProgress'),
  259. doBootstrap: function () {
  260. if (this.get('stopBootstrap')) {
  261. return;
  262. }
  263. this.numPolls++;
  264. App.ajax.send({
  265. name: 'wizard.step3.bootstrap',
  266. sender: this,
  267. data: {
  268. bootRequestId: this.get('content.installOptions.bootRequestId'),
  269. numPolls: this.numPolls
  270. },
  271. success: 'doBootstrapSuccessCallback'
  272. }).
  273. retry({
  274. times: App.maxRetries,
  275. timeout: App.timeout
  276. }).
  277. then(
  278. null,
  279. function () {
  280. App.showReloadPopup();
  281. console.log('Bootstrap failed');
  282. }
  283. );
  284. },
  285. doBootstrapSuccessCallback: function (data) {
  286. if (data.hostsStatus !== null) {
  287. // in case of bootstrapping just one host, the server returns an object rather than an array, so
  288. // force into an array
  289. if (!(data.hostsStatus instanceof Array)) {
  290. data.hostsStatus = [ data.hostsStatus ];
  291. }
  292. console.log("TRACE: In success function for the GET bootstrap call");
  293. var keepPolling = this.parseHostInfo(data.hostsStatus);
  294. // Single host : if the only hostname is invalid (data.status == 'ERROR')
  295. // Multiple hosts : if one or more hostnames are invalid
  296. // following check will mark the bootStatus as 'FAILED' for the invalid hostname
  297. if (data.status == 'ERROR' || data.hostsStatus.length != this.get('bootHosts').length) {
  298. var hosts = this.get('bootHosts');
  299. for (var i = 0; i < hosts.length; i++) {
  300. var isValidHost = data.hostsStatus.someProperty('hostName', hosts[i].get('name'));
  301. if(hosts[i].get('bootStatus') !== 'REGISTERED'){
  302. if (!isValidHost) {
  303. hosts[i].set('bootStatus', 'FAILED');
  304. hosts[i].set('bootLog', Em.I18n.t('installer.step3.hosts.bootLog.failed'));
  305. }
  306. }
  307. }
  308. }
  309. if (data.hostsStatus.someProperty('status', 'DONE') || data.hostsStatus.someProperty('status', 'FAILED')) {
  310. // kicking off registration polls after at least one host has succeeded
  311. this.startRegistration();
  312. }
  313. if (keepPolling) {
  314. var self = this;
  315. window.setTimeout(function () {
  316. self.doBootstrap()
  317. }, 3000);
  318. }
  319. }
  320. },
  321. startRegistration: function () {
  322. if (this.get('registrationStartedAt') == null) {
  323. this.set('registrationStartedAt', new Date().getTime());
  324. console.log('registration started at ' + this.get('registrationStartedAt'));
  325. this.isHostsRegistered();
  326. }
  327. },
  328. isHostsRegistered: function () {
  329. if (this.get('stopBootstrap')) {
  330. return;
  331. }
  332. App.ajax.send({
  333. name: 'wizard.step3.is_hosts_registered',
  334. sender: this,
  335. success: 'isHostsRegisteredSuccessCallback'
  336. }).
  337. retry({
  338. times: App.maxRetries,
  339. timeout: App.timeout
  340. }).
  341. then(
  342. null,
  343. function () {
  344. App.showReloadPopup();
  345. console.log('Error: Getting registered host information from the server');
  346. }
  347. );
  348. },
  349. isHostsRegisteredSuccessCallback: function (data) {
  350. console.log('registration attempt...');
  351. var hosts = this.get('bootHosts');
  352. var jsonData = data;
  353. if (!jsonData) {
  354. console.warn("Error: jsonData is null");
  355. return;
  356. }
  357. // keep polling until all hosts have registered/failed, or registrationTimeout seconds after the last host finished bootstrapping
  358. var stopPolling = true;
  359. hosts.forEach(function (_host, index) {
  360. // Change name of first host for test mode.
  361. if (App.testMode) {
  362. if (index == 0) {
  363. _host.set('name', 'localhost.localdomain');
  364. }
  365. }
  366. // actions to take depending on the host's current bootStatus
  367. // RUNNING - bootstrap is running; leave it alone
  368. // DONE - bootstrap is done; transition to REGISTERING
  369. // REGISTERING - bootstrap is done but has not registered; transition to REGISTERED if host found in polling API result
  370. // REGISTERED - bootstrap and registration is done; leave it alone
  371. // FAILED - either bootstrap or registration failed; leave it alone
  372. console.log(_host.name + ' bootStatus=' + _host.get('bootStatus'));
  373. switch (_host.get('bootStatus')) {
  374. case 'DONE':
  375. _host.set('bootStatus', 'REGISTERING');
  376. _host.set('bootLog', (_host.get('bootLog') != null ? _host.get('bootLog') : '') + Em.I18n.t('installer.step3.hosts.bootLog.registering'));
  377. // update registration timestamp so that the timeout is computed from the last host that finished bootstrapping
  378. this.set('registrationStartedAt', new Date().getTime());
  379. stopPolling = false;
  380. break;
  381. case 'REGISTERING':
  382. if (jsonData.items.someProperty('Hosts.host_name', _host.name)) {
  383. console.log(_host.name + ' has been registered');
  384. _host.set('bootStatus', 'REGISTERED');
  385. _host.set('bootLog', (_host.get('bootLog') != null ? _host.get('bootLog') : '') + Em.I18n.t('installer.step3.hosts.bootLog.registering'));
  386. } else {
  387. console.log(_host.name + ' is registering...');
  388. stopPolling = false;
  389. }
  390. break;
  391. case 'RUNNING':
  392. stopPolling = false;
  393. break;
  394. case 'REGISTERED':
  395. case 'FAILED':
  396. default:
  397. break;
  398. }
  399. }, this);
  400. if (stopPolling) {
  401. this.getHostInfo();
  402. } else if (hosts.someProperty('bootStatus', 'RUNNING') || new Date().getTime() - this.get('registrationStartedAt') < this.get('registrationTimeoutSecs') * 1000) {
  403. // we want to keep polling for registration status if any of the hosts are still bootstrapping (so we check for RUNNING).
  404. var self = this;
  405. window.setTimeout(function () {
  406. self.isHostsRegistered();
  407. }, 3000);
  408. } else {
  409. // registration timed out. mark all REGISTERING hosts to FAILED
  410. console.log('registration timed out');
  411. hosts.filterProperty('bootStatus', 'REGISTERING').forEach(function (_host) {
  412. _host.set('bootStatus', 'FAILED');
  413. _host.set('bootLog', (_host.get('bootLog') != null ? _host.get('bootLog') : '') + Em.I18n.t('installer.step3.hosts.bootLog.failed'));
  414. });
  415. this.getHostInfo();
  416. }
  417. },
  418. hasMoreRegisteredHosts: false,
  419. getAllRegisteredHosts: function() {
  420. App.ajax.send({
  421. name: 'wizard.step3.is_hosts_registered',
  422. sender: this,
  423. success: 'getAllRegisteredHostsCallback'
  424. });
  425. }.observes('bootHosts.@each.name'),
  426. hostsInCluster: function() {
  427. return App.Host.find().getEach('hostName');
  428. }.property().volatile(),
  429. getAllRegisteredHostsCallback: function(hosts) {
  430. var registeredHosts = [];
  431. var hostsInCluster = this.get('hostsInCluster');
  432. var addedHosts = this.get('bootHosts').getEach('name');
  433. hosts.items.forEach(function(host){
  434. if (!hostsInCluster.contains(host.Hosts.host_name) && !addedHosts.contains(host.Hosts.host_name)) {
  435. registeredHosts.push(host.Hosts.host_name);
  436. }
  437. });
  438. if(registeredHosts.length) {
  439. this.set('hasMoreRegisteredHosts',true);
  440. this.set('registeredHosts',registeredHosts);
  441. } else {
  442. this.set('hasMoreRegisteredHosts',false);
  443. this.set('registeredHosts','');
  444. }
  445. },
  446. allHostsComplete: function() {
  447. var result = true;
  448. this.get('bootHosts').forEach(function(host) {
  449. var status = host.get('bootStatus');
  450. if (status != 'REGISTERED' && status != 'FAILED') {
  451. result = false;
  452. }
  453. });
  454. return result;
  455. }.property('bootHosts.@each.bootStatus'),
  456. registerErrPopup: function (header, message) {
  457. App.ModalPopup.show({
  458. header: header,
  459. secondary: false,
  460. onPrimary: function () {
  461. this.hide();
  462. },
  463. bodyClass: Ember.View.extend({
  464. template: Ember.Handlebars.compile(['<p>{{view.message}}</p>'].join('\n')),
  465. message: message
  466. })
  467. });
  468. },
  469. /**
  470. * Get disk info and cpu count of booted hosts from server
  471. */
  472. getHostInfo: function () {
  473. App.ajax.send({
  474. name: 'wizard.step3.host_info',
  475. sender: this,
  476. success: 'getHostInfoSuccessCallback',
  477. error: 'getHostInfoErrorCallback'
  478. });
  479. },
  480. getHostInfoSuccessCallback: function (jsonData) {
  481. var hosts = this.get('bootHosts');
  482. this.parseWarnings(jsonData);
  483. hosts.forEach(function (_host) {
  484. var host = (App.testMode) ? jsonData.items[0] : jsonData.items.findProperty('Hosts.host_name', _host.name);
  485. if (App.skipBootstrap) {
  486. _host.cpu = 2;
  487. _host.memory = ((parseInt(2000000))).toFixed(2);
  488. _host.disk_info = [{"mountpoint": "/", "type":"ext4"},{"mountpoint": "/grid/0", "type":"ext4"}, {"mountpoint": "/grid/1", "type":"ext4"}, {"mountpoint": "/grid/2", "type":"ext4"}];
  489. } else if (host) {
  490. _host.cpu = host.Hosts.cpu_count;
  491. _host.memory = ((parseInt(host.Hosts.total_mem))).toFixed(2);
  492. _host.disk_info = host.Hosts.disk_info;
  493. console.log("The value of memory is: " + _host.memory);
  494. }
  495. });
  496. this.set('bootHosts', hosts);
  497. console.log("The value of hosts: " + JSON.stringify(hosts));
  498. this.stopRegistration();
  499. },
  500. getHostInfoErrorCallback: function () {
  501. console.log('INFO: Getting host information(cpu_count and total_mem) from the server failed');
  502. this.registerErrPopup(Em.I18n.t('installer.step3.hostInformation.popup.header'), Em.I18n.t('installer.step3.hostInformation.popup.body'));
  503. },
  504. stopRegistration: function () {
  505. this.set('isSubmitDisabled', !this.get('bootHosts').someProperty('bootStatus', 'REGISTERED'));
  506. this.set('isRetryDisabled', !this.get('bootHosts').someProperty('bootStatus', 'FAILED'));
  507. },
  508. selectCategory: function(event, context){
  509. this.set('category', event.context);
  510. },
  511. submit: function () {
  512. if (!this.get('isSubmitDisabled')) {
  513. if(this.get('isHostHaveWarnings')) {
  514. var self = this;
  515. App.showConfirmationPopup(
  516. function(){
  517. self.set('content.hosts', self.get('bootHosts'));
  518. App.router.send('next');
  519. },
  520. Em.I18n.t('installer.step3.hostWarningsPopup.hostHasWarnings'));
  521. }
  522. else {
  523. this.set('content.hosts', this.get('bootHosts'));
  524. App.router.send('next');
  525. }
  526. }
  527. },
  528. hostLogPopup: function (event, context) {
  529. var host = event.context;
  530. App.ModalPopup.show({
  531. header: Em.I18n.t('installer.step3.hostLog.popup.header').format(host.get('name')),
  532. secondary: null,
  533. onPrimary: function () {
  534. this.hide();
  535. },
  536. bodyClass: Ember.View.extend({
  537. templateName: require('templates/wizard/step3_host_log_popup'),
  538. host: host,
  539. didInsertElement: function () {
  540. var self = this;
  541. var button = $(this.get('element')).find('.textTrigger');
  542. button.click(function () {
  543. if (self.get('isTextArea')) {
  544. $(this).text(Em.I18n.t('installer.step3.hostLogPopup.highlight'));
  545. } else {
  546. $(this).text(Em.I18n.t('installer.step3.hostLogPopup.copy'));
  547. }
  548. self.set('isTextArea', !self.get('isTextArea'));
  549. });
  550. $(this.get('element')).find('.content-area').mouseenter(
  551. function () {
  552. var element = $(this);
  553. element.css('border', '1px solid #dcdcdc');
  554. button.css('visibility', 'visible');
  555. }).mouseleave(
  556. function () {
  557. var element = $(this);
  558. element.css('border', 'none');
  559. button.css('visibility', 'hidden');
  560. })
  561. },
  562. isTextArea: false,
  563. textArea: Em.TextArea.extend({
  564. didInsertElement: function () {
  565. var element = $(this.get('element'));
  566. element.width($(this.get('parentView').get('element')).width() - 10);
  567. element.height($(this.get('parentView').get('element')).height());
  568. element.select();
  569. element.css('resize', 'none');
  570. },
  571. readOnly: true,
  572. value: function () {
  573. return this.get('content');
  574. }.property('content')
  575. })
  576. })
  577. });
  578. },
  579. /**
  580. * check warnings from server and put it in parsing
  581. */
  582. rerunChecks: function () {
  583. var self = this;
  584. var currentProgress = 0;
  585. var interval = setInterval(function () {
  586. currentProgress += 100000 / self.get('warningsTimeInterval');
  587. if (currentProgress < 100) {
  588. self.set('checksUpdateProgress', currentProgress);
  589. } else {
  590. clearInterval(interval);
  591. App.ajax.send({
  592. name: 'wizard.step3.rerun_checks',
  593. sender: self,
  594. success: 'rerunChecksSuccessCallback',
  595. error: 'rerunChecksErrorCallback'
  596. });
  597. }
  598. }, 1000);
  599. },
  600. rerunChecksSuccessCallback: function (data) {
  601. this.set('checksUpdateProgress', 100);
  602. this.set('checksUpdateStatus', 'SUCCESS');
  603. this.parseWarnings(data);
  604. },
  605. rerunChecksErrorCallback: function () {
  606. this.set('checksUpdateProgress', 100);
  607. this.set('checksUpdateStatus', 'FAILED');
  608. console.log('INFO: Getting host information(last_agent_env) from the server failed');
  609. },
  610. warnings: [],
  611. warningsByHost: [],
  612. warningsTimeInterval: 60000,
  613. /**
  614. * check are hosts have any warnings
  615. */
  616. isHostHaveWarnings: function(){
  617. return this.get('warnings.length') > 0;
  618. }.property('warnings'),
  619. isWarningsBoxVisible: function(){
  620. return (App.testMode) ? true : this.get('allHostsComplete');
  621. }.property('allHostsComplete'),
  622. checksUpdateProgress:0,
  623. checksUpdateStatus: null,
  624. /**
  625. * filter data for warnings parse
  626. * is data from host in bootStrap
  627. * @param data
  628. * @return {Object}
  629. */
  630. filterBootHosts: function (data) {
  631. var bootHostNames = this.get('bootHosts').mapProperty('name');
  632. var filteredData = {
  633. href: data.href,
  634. items: []
  635. };
  636. data.items.forEach(function (host) {
  637. if (bootHostNames.contains(host.Hosts.host_name)) {
  638. filteredData.items.push(host);
  639. }
  640. });
  641. return filteredData;
  642. },
  643. /**
  644. * parse warnings data for each host and total
  645. * @param data
  646. */
  647. parseWarnings: function (data) {
  648. data = App.testMode ? data : this.filterBootHosts(data);
  649. var warnings = [];
  650. var warning;
  651. var hosts = [];
  652. data.items.sort(function (a, b) {
  653. if (a.Hosts.host_name > b.Hosts.host_name) {
  654. return 1;
  655. }
  656. if (a.Hosts.host_name < b.Hosts.host_name) {
  657. return -1;
  658. }
  659. return 0;
  660. });
  661. data.items.forEach(function (_host) {
  662. var host = {
  663. name: _host.Hosts.host_name,
  664. warnings: []
  665. }
  666. if (!_host.Hosts.last_agent_env) {
  667. // in some unusual circumstances when last_agent_env is not available from the _host,
  668. // skip the _host and proceed to process the rest of the hosts.
  669. console.log("last_agent_env is missing for " + _host.Hosts.host_name + ". Skipping _host check.");
  670. return;
  671. }
  672. //parse all directories and files warnings for host
  673. //todo: to be removed after check in new API
  674. var stackFoldersAndFiles = _host.Hosts.last_agent_env.stackFoldersAndFiles || _host.Hosts.last_agent_env.paths;
  675. stackFoldersAndFiles.forEach(function (path) {
  676. warning = warnings.filterProperty('category', 'fileFolders').findProperty('name', path.name);
  677. if (warning) {
  678. warning.hosts.push(_host.Hosts.host_name);
  679. warning.onSingleHost = false;
  680. } else {
  681. warning = {
  682. name: path.name,
  683. hosts: [_host.Hosts.host_name],
  684. category: 'fileFolders',
  685. onSingleHost: true
  686. }
  687. warnings.push(warning);
  688. }
  689. host.warnings.push(warning);
  690. }, this);
  691. //parse all package warnings for host
  692. _host.Hosts.last_agent_env.installedPackages.forEach(function (_package) {
  693. warning = warnings.filterProperty('category', 'packages').findProperty('name', _package.name);
  694. if (warning) {
  695. warning.hosts.push(_host.Hosts.host_name);
  696. warning.version = _package.version,
  697. warning.onSingleHost = false;
  698. } else {
  699. warning = {
  700. name: _package.name,
  701. version: _package.version,
  702. hosts: [_host.Hosts.host_name],
  703. category: 'packages',
  704. onSingleHost: true
  705. }
  706. warnings.push(warning);
  707. }
  708. host.warnings.push(warning);
  709. }, this);
  710. //parse all process warnings for host
  711. //todo: to be removed after check in new API
  712. var javaProcs = _host.Hosts.last_agent_env.hostHealth ? _host.Hosts.last_agent_env.hostHealth.activeJavaProcs : _host.Hosts.last_agent_env.javaProcs;
  713. javaProcs.forEach(function (process) {
  714. warning = warnings.filterProperty('category', 'processes').findProperty('pid', process.pid);
  715. if (warning) {
  716. warning.hosts.push(_host.Hosts.host_name);
  717. warning.onSingleHost = false;
  718. } else {
  719. warning = {
  720. name: (process.command.substr(0, 35) + '...'),
  721. hosts: [_host.Hosts.host_name],
  722. category: 'processes',
  723. user: process.user,
  724. pid: process.pid,
  725. command: '<table><tr><td style="word-break: break-all;">' +
  726. ((process.command.length < 500) ? process.command : process.command.substr(0, 230) + '...' +
  727. '<p style="text-align: center">................</p>' +
  728. '...' + process.command.substr(-230)) + '</td></tr></table>',
  729. onSingleHost: true
  730. }
  731. warnings.push(warning);
  732. }
  733. host.warnings.push(warning);
  734. }, this);
  735. //parse all service warnings for host
  736. //todo: to be removed after check in new API
  737. if (_host.Hosts.last_agent_env.hostHealth && _host.Hosts.last_agent_env.hostHealth.liveServices) {
  738. _host.Hosts.last_agent_env.hostHealth.liveServices.forEach(function (service) {
  739. if (service.status === 'Unhealthy') {
  740. warning = warnings.filterProperty('category', 'services').findProperty('name', service.name);
  741. if (warning) {
  742. warning.hosts.push(_host.Hosts.host_name);
  743. warning.onSingleHost = false;
  744. } else {
  745. warning = {
  746. name: service.name,
  747. hosts: [_host.Hosts.host_name],
  748. category: 'services',
  749. onSingleHost: true
  750. }
  751. warnings.push(warning);
  752. }
  753. host.warnings.push(warning);
  754. }
  755. }, this);
  756. }
  757. //parse all user warnings for host
  758. //todo: to be removed after check in new API
  759. if (_host.Hosts.last_agent_env.existingUsers) {
  760. _host.Hosts.last_agent_env.existingUsers.forEach(function (user) {
  761. warning = warnings.filterProperty('category', 'users').findProperty('name', user.userName);
  762. if (warning) {
  763. warning.hosts.push(_host.Hosts.host_name);
  764. warning.onSingleHost = false;
  765. } else {
  766. warning = {
  767. name: user.userName,
  768. hosts: [_host.Hosts.host_name],
  769. category: 'users',
  770. onSingleHost: true
  771. }
  772. warnings.push(warning);
  773. }
  774. host.warnings.push(warning);
  775. }, this);
  776. }
  777. //parse misc warnings for host
  778. var umask = _host.Hosts.last_agent_env.umask;
  779. if (umask && umask !== 18) {
  780. warning = warnings.filterProperty('category', 'misc').findProperty('name', umask);
  781. if (warning) {
  782. warning.hosts.push(_host.Hosts.host_name);
  783. warning.onSingleHost = false;
  784. } else {
  785. warning = {
  786. name: umask,
  787. hosts: [_host.Hosts.host_name],
  788. category: 'misc',
  789. onSingleHost: true
  790. }
  791. warnings.push(warning);
  792. }
  793. host.warnings.push(warning);
  794. }
  795. var firewallRunning = _host.Hosts.last_agent_env.iptablesIsRunning;
  796. if (firewallRunning!==null && firewallRunning) {
  797. var name = Em.I18n.t('installer.step3.hostWarningsPopup.firewall.name');
  798. warning = warnings.filterProperty('category', 'firewall').findProperty('name', name);
  799. if (warning) {
  800. warning.hosts.push(_host.Hosts.host_name);
  801. warning.onSingleHost = false;
  802. } else {
  803. warning = {
  804. name: name,
  805. hosts: [_host.Hosts.host_name],
  806. category: 'firewall',
  807. onSingleHost: true
  808. }
  809. warnings.push(warning);
  810. }
  811. host.warnings.push(warning);
  812. }
  813. hosts.push(host);
  814. }, this);
  815. warnings.forEach(function (warn) {
  816. if (warn.hosts.length < 11) {
  817. warn.hostsList = warn.hosts.join('<br>')
  818. } else {
  819. warn.hostsList = warn.hosts.slice(0,10).join('<br>') + '<br> ' + Em.I18n.t('installer.step3.hostWarningsPopup.moreHosts').format(warn.hosts.length - 10);
  820. }
  821. });
  822. hosts.unshift({
  823. name: 'All Hosts',
  824. warnings: warnings
  825. });
  826. this.set('warnings', warnings);
  827. this.set('warningsByHost', hosts);
  828. },
  829. /**
  830. * open popup that contain hosts' warnings
  831. * @param event
  832. */
  833. hostWarningsPopup: function(event){
  834. var self = this;
  835. App.ModalPopup.show({
  836. header: Em.I18n.t('installer.step3.warnings.popup.header'),
  837. secondary: Em.I18n.t('installer.step3.hostWarningsPopup.rerunChecks'),
  838. primary: Em.I18n.t('common.close'),
  839. onPrimary: function () {
  840. self.set('checksUpdateStatus', null);
  841. this.hide();
  842. },
  843. onClose: function(){
  844. self.set('checksUpdateStatus', null);
  845. this.hide();
  846. },
  847. onSecondary: function() {
  848. self.rerunChecks();
  849. },
  850. didInsertElement: function () {
  851. this.fitHeight();
  852. },
  853. footerClass: Ember.View.extend({
  854. template: Ember.Handlebars.compile([
  855. '<div class="update-progress pull-left">',
  856. '{{#if view.isUpdateInProgress}}',
  857. '<div class="progress-info active progress">',
  858. '<div class="bar" {{bindAttr style="view.progressWidth"}}></div></div>',
  859. '{{else}}<label {{bindAttr class="view.updateStatusClass"}}>{{view.updateStatus}}</label>',
  860. '{{/if}}</div>',
  861. '{{#if view.parentView.secondary}}<button type="button" class="btn btn-info" {{bindAttr disabled="view.isUpdateInProgress"}} {{action onSecondary target="view.parentView"}}><i class="icon-repeat"></i>&nbsp;{{view.parentView.secondary}}</button>{{/if}}',
  862. '{{#if view.parentView.primary}}<button type="button" class="btn" {{action onPrimary target="view.parentView"}}>{{view.parentView.primary}}</button>{{/if}}'
  863. ].join('')),
  864. classNames: ['modal-footer', 'host-checks-update'],
  865. progressWidth: function(){
  866. return 'width:'+App.router.get('wizardStep3Controller.checksUpdateProgress')+'%';
  867. }.property('App.router.wizardStep3Controller.checksUpdateProgress'),
  868. isUpdateInProgress: function(){
  869. if((App.router.get('wizardStep3Controller.checksUpdateProgress') > 0) &&
  870. (App.router.get('wizardStep3Controller.checksUpdateProgress') < 100)){
  871. return true;
  872. }
  873. }.property('App.router.wizardStep3Controller.checksUpdateProgress'),
  874. updateStatusClass:function(){
  875. var status = App.router.get('wizardStep3Controller.checksUpdateStatus');
  876. if(status === 'SUCCESS'){
  877. return 'text-success';
  878. } else if(status === 'FAILED'){
  879. return 'text-error';
  880. } else {
  881. return null;
  882. }
  883. }.property('App.router.wizardStep3Controller.checksUpdateStatus'),
  884. updateStatus:function(){
  885. var status = App.router.get('wizardStep3Controller.checksUpdateStatus');
  886. if(status === 'SUCCESS'){
  887. return Em.I18n.t('installer.step3.warnings.updateChecks.success');
  888. } else if(status === 'FAILED'){
  889. return Em.I18n.t('installer.step3.warnings.updateChecks.failed');
  890. } else {
  891. return null;
  892. }
  893. }.property('App.router.wizardStep3Controller.checksUpdateStatus')
  894. }),
  895. bodyClass: Ember.View.extend({
  896. templateName: require('templates/wizard/step3_host_warnings_popup'),
  897. classNames: ['host-check'],
  898. didInsertElement: function () {
  899. Ember.run.next(this, function () {
  900. this.$("[rel='HostsListTooltip']").tooltip({html: true, placement: "right"});
  901. this.$('#process .warning-name').tooltip({html: true, placement: "top"});
  902. })
  903. }.observes('content'),
  904. warningsByHost: function () {
  905. return App.router.get('wizardStep3Controller.warningsByHost');
  906. }.property('App.router.wizardStep3Controller.warningsByHost'),
  907. warnings: function () {
  908. return App.router.get('wizardStep3Controller.warnings');
  909. }.property('App.router.wizardStep3Controller.warnings'),
  910. categories: function () {
  911. return this.get('warningsByHost').mapProperty('name');
  912. }.property('warningsByHost'),
  913. category: 'All Hosts',
  914. categoryWarnings: function () {
  915. return this.get('warningsByHost').findProperty('name', this.get('category')).warnings
  916. }.property('warningsByHost', 'category'),
  917. content: function () {
  918. var categoryWarnings = this.get('categoryWarnings');
  919. return [
  920. Ember.Object.create({
  921. warnings: categoryWarnings.filterProperty('category', 'firewall'),
  922. title: Em.I18n.t('installer.step3.hostWarningsPopup.firewall'),
  923. message: Em.I18n.t('installer.step3.hostWarningsPopup.firewall.message'),
  924. type: Em.I18n.t('common.issues'),
  925. emptyName: Em.I18n.t('installer.step3.hostWarningsPopup.empty.firewall'),
  926. action: Em.I18n.t('installer.step3.hostWarningsPopup.action.running'),
  927. category: 'firewall'
  928. }),
  929. Ember.Object.create({
  930. warnings: categoryWarnings.filterProperty('category', 'processes'),
  931. title: Em.I18n.t('installer.step3.hostWarningsPopup.process'),
  932. message: Em.I18n.t('installer.step3.hostWarningsPopup.processes.message'),
  933. type: Em.I18n.t('common.process'),
  934. emptyName: Em.I18n.t('installer.step3.hostWarningsPopup.empty.processes'),
  935. action: Em.I18n.t('installer.step3.hostWarningsPopup.action.running'),
  936. category: 'process'
  937. }),
  938. Ember.Object.create({
  939. warnings: categoryWarnings.filterProperty('category', 'packages'),
  940. title: Em.I18n.t('installer.step3.hostWarningsPopup.package'),
  941. message: Em.I18n.t('installer.step3.hostWarningsPopup.packages.message'),
  942. type: Em.I18n.t('common.package'),
  943. emptyName: Em.I18n.t('installer.step3.hostWarningsPopup.empty.packages'),
  944. action: Em.I18n.t('installer.step3.hostWarningsPopup.action.installed'),
  945. category: 'package'
  946. }),
  947. Ember.Object.create({
  948. warnings: categoryWarnings.filterProperty('category', 'fileFolders'),
  949. title: Em.I18n.t('installer.step3.hostWarningsPopup.fileAndFolder'),
  950. message: Em.I18n.t('installer.step3.hostWarningsPopup.fileFolders.message'),
  951. type: Em.I18n.t('common.path'),
  952. emptyName: Em.I18n.t('installer.step3.hostWarningsPopup.empty.filesAndFolders'),
  953. action: Em.I18n.t('installer.step3.hostWarningsPopup.action.exists'),
  954. category: 'fileFolders'
  955. }),
  956. Ember.Object.create({
  957. warnings: categoryWarnings.filterProperty('category', 'services'),
  958. title: Em.I18n.t('installer.step3.hostWarningsPopup.service'),
  959. message: Em.I18n.t('installer.step3.hostWarningsPopup.services.message'),
  960. type: Em.I18n.t('common.service'),
  961. emptyName: Em.I18n.t('installer.step3.hostWarningsPopup.empty.services'),
  962. action: Em.I18n.t('installer.step3.hostWarningsPopup.action.notRunning'),
  963. category: 'service'
  964. }),
  965. Ember.Object.create({
  966. warnings: categoryWarnings.filterProperty('category', 'users'),
  967. title: Em.I18n.t('installer.step3.hostWarningsPopup.user'),
  968. message: Em.I18n.t('installer.step3.hostWarningsPopup.users.message'),
  969. type: Em.I18n.t('common.user'),
  970. emptyName: Em.I18n.t('installer.step3.hostWarningsPopup.empty.users'),
  971. action: Em.I18n.t('installer.step3.hostWarningsPopup.action.exists'),
  972. category: 'user'
  973. }),
  974. Ember.Object.create({
  975. warnings: categoryWarnings.filterProperty('category', 'misc'),
  976. title: Em.I18n.t('installer.step3.hostWarningsPopup.misc'),
  977. message: Em.I18n.t('installer.step3.hostWarningsPopup.misc.message'),
  978. type: Em.I18n.t('installer.step3.hostWarningsPopup.misc.umask'),
  979. emptyName: Em.I18n.t('installer.step3.hostWarningsPopup.empty.misc'),
  980. action: Em.I18n.t('installer.step3.hostWarningsPopup.action.exists'),
  981. category: 'misc'
  982. })
  983. ]
  984. }.property('category', 'warningsByHost'),
  985. showHostsPopup: function (hosts) {
  986. $('.tooltip').hide();
  987. App.ModalPopup.show({
  988. header: Em.I18n.t('installer.step3.hostWarningsPopup.allHosts'),
  989. bodyClass: Ember.View.extend({
  990. hosts: hosts.context,
  991. template: Ember.Handlebars.compile('<ul>{{#each host in view.hosts}}<li>{{host}}</li>{{/each}}</ul>')
  992. }),
  993. onPrimary: function () {
  994. this.hide();
  995. },
  996. secondary: null
  997. });
  998. },
  999. onToggleBlock: function (category) {
  1000. this.$('#' + category.context.category).toggle('blind', 500);
  1001. },
  1002. warningsNotice: function () {
  1003. var warnings = this.get('warnings');
  1004. var warningsByHost = self.get('warningsByHost').slice();
  1005. warningsByHost.shift();
  1006. var issues = warnings.length + ' ' + (warnings.length === 1 ? Em.I18n.t('installer.step3.hostWarningsPopup.issue') : Em.I18n.t('installer.step3.hostWarningsPopup.issues'));
  1007. var hostsNumber = warningsByHost.length - warningsByHost.filterProperty('warnings.length', 0).length;
  1008. var hosts = hostsNumber + ' ' + (hostsNumber === 1 ? Em.I18n.t('installer.step3.hostWarningsPopup.host') : Em.I18n.t('installer.step3.hostWarningsPopup.hosts'));
  1009. return Em.I18n.t('installer.step3.hostWarningsPopup.summary').format(issues, hosts);
  1010. }.property('warnings', 'warningsByHost'),
  1011. /**
  1012. * generate detailed content to show it in new window
  1013. */
  1014. contentInDetails: function () {
  1015. var content = this.get('content');
  1016. var warningsByHost = this.get('warningsByHost').slice();
  1017. warningsByHost.shift();
  1018. var newContent = '';
  1019. newContent += Em.I18n.t('installer.step3.hostWarningsPopup.report.header') + new Date;
  1020. newContent += Em.I18n.t('installer.step3.hostWarningsPopup.report.hosts');
  1021. newContent += warningsByHost.filterProperty('warnings.length').mapProperty('name').join(' ');
  1022. if (content.findProperty('category', 'fileFolders').warnings.length) {
  1023. newContent += Em.I18n.t('installer.step3.hostWarningsPopup.report.fileFolders');
  1024. newContent += content.findProperty('category', 'fileFolders').warnings.mapProperty('name').join(' ');
  1025. }
  1026. if (content.findProperty('category', 'process').warnings.length) {
  1027. newContent += Em.I18n.t('installer.step3.hostWarningsPopup.report.process');
  1028. content.findProperty('category', 'process').warnings.forEach(function (process, i) {
  1029. process.hosts.forEach(function (host, j) {
  1030. if (!!i || !!j) {
  1031. newContent += ',';
  1032. }
  1033. newContent += '(' + host + ',' + process.user + ',' + process.pid + ')';
  1034. });
  1035. });
  1036. }
  1037. if (content.findProperty('category', 'package').warnings.length) {
  1038. newContent += Em.I18n.t('installer.step3.hostWarningsPopup.report.package');
  1039. newContent += content.findProperty('category', 'package').warnings.mapProperty('name').join(' ');
  1040. }
  1041. if (content.findProperty('category', 'service').warnings.length) {
  1042. newContent += Em.I18n.t('installer.step3.hostWarningsPopup.report.service');
  1043. newContent += content.findProperty('category', 'service').warnings.mapProperty('name').join(' ');
  1044. }
  1045. if (content.findProperty('category', 'user').warnings.length) {
  1046. newContent += Em.I18n.t('installer.step3.hostWarningsPopup.report.user');
  1047. newContent += content.findProperty('category', 'user').warnings.mapProperty('name').join(' ');
  1048. }
  1049. newContent += '</p>';
  1050. return newContent;
  1051. }.property('content', 'warningsByHost'),
  1052. /**
  1053. * open new browser tab with detailed content
  1054. */
  1055. openWarningsInDialog: function(){
  1056. var newWindow = window.open('');
  1057. var newDocument = newWindow.document;
  1058. newDocument.write(this.get('contentInDetails'));
  1059. newWindow.focus();
  1060. }
  1061. })
  1062. })
  1063. },
  1064. registeredHostsPopup: function(){
  1065. var self = this;
  1066. App.ModalPopup.show({
  1067. header: Em.I18n.t('installer.step3.warning.registeredHosts').format(this.get('registeredHosts').length),
  1068. secondary: null,
  1069. bodyClass: Ember.View.extend({
  1070. template: Ember.Handlebars.compile([
  1071. '<p>{{view.message}}</p>',
  1072. '<ul>{{#each host in view.registeredHosts}}',
  1073. '<li>{{host}}</li>',
  1074. '{{/each}}</ul>'
  1075. ].join('')),
  1076. message: Em.I18n.t('installer.step3.registeredHostsPopup'),
  1077. registeredHosts: self.get('registeredHosts')
  1078. })
  1079. })
  1080. },
  1081. back: function () {
  1082. if (this.get('isInstallInProgress')) {
  1083. return;
  1084. }
  1085. App.router.send('back');
  1086. }
  1087. });