wizard.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733
  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.WizardController = Em.Controller.extend({
  20. isStepDisabled: null,
  21. init: function () {
  22. this.set('isStepDisabled', []);
  23. this.clusters = App.Cluster.find();
  24. this.isStepDisabled.pushObject(Ember.Object.create({
  25. step: 1,
  26. value: false
  27. }));
  28. for (var i = 2; i <= this.get('totalSteps'); i++) {
  29. this.isStepDisabled.pushObject(Ember.Object.create({
  30. step: i,
  31. value: true
  32. }));
  33. }
  34. // window.onbeforeunload = function () {
  35. // return "You have not saved your document yet. If you continue, your work will not be saved."
  36. //}
  37. },
  38. setStepsEnable: function () {
  39. for (var i = 1; i <= this.totalSteps; i++) {
  40. var step = this.get('isStepDisabled').findProperty('step', i);
  41. if (i <= this.get('currentStep')) {
  42. step.set('value', false);
  43. } else {
  44. step.set('value', true);
  45. }
  46. }
  47. }.observes('currentStep'),
  48. setLowerStepsDisable: function (stepNo) {
  49. for (var i = 1; i < stepNo; i++) {
  50. var step = this.get('isStepDisabled').findProperty('step', i);
  51. step.set('value', true);
  52. }
  53. },
  54. /**
  55. * Set current step to new value.
  56. * Method moved from App.router.setInstallerCurrentStep
  57. * @param currentStep
  58. * @param completed
  59. */
  60. currentStep: function () {
  61. return App.get('router').getWizardCurrentStep(this.get('name').substr(0, this.get('name').length - 10));
  62. }.property(),
  63. /**
  64. * Set current step to new value.
  65. * Method moved from App.router.setInstallerCurrentStep
  66. * @param currentStep
  67. * @param completed
  68. */
  69. setCurrentStep: function (currentStep, completed) {
  70. App.db.setWizardCurrentStep(this.get('name').substr(0, this.get('name').length - 10), currentStep, completed);
  71. this.set('currentStep', currentStep);
  72. },
  73. clusters: null,
  74. isStep0: function () {
  75. return this.get('currentStep') == 0;
  76. }.property('currentStep'),
  77. isStep1: function () {
  78. return this.get('currentStep') == 1;
  79. }.property('currentStep'),
  80. isStep2: function () {
  81. return this.get('currentStep') == 2;
  82. }.property('currentStep'),
  83. isStep3: function () {
  84. return this.get('currentStep') == 3;
  85. }.property('currentStep'),
  86. isStep4: function () {
  87. return this.get('currentStep') == 4;
  88. }.property('currentStep'),
  89. isStep5: function () {
  90. return this.get('currentStep') == 5;
  91. }.property('currentStep'),
  92. isStep6: function () {
  93. return this.get('currentStep') == 6;
  94. }.property('currentStep'),
  95. isStep7: function () {
  96. return this.get('currentStep') == 7;
  97. }.property('currentStep'),
  98. isStep8: function () {
  99. return this.get('currentStep') == 8;
  100. }.property('currentStep'),
  101. isStep9: function () {
  102. return this.get('currentStep') == 9;
  103. }.property('currentStep'),
  104. isStep10: function () {
  105. return this.get('currentStep') == 10;
  106. }.property('currentStep'),
  107. gotoStep: function (step) {
  108. if (this.get('isStepDisabled').findProperty('step', step).get('value') !== false) {
  109. return false;
  110. }
  111. // if going back from Step 9 in Install Wizard, delete the checkpoint so that the user is not redirected
  112. // to Step 9
  113. if (this.get('content.controllerName') == 'installerController' && this.get('currentStep') === '9' && step < 9) {
  114. App.clusterStatus.setClusterStatus({
  115. clusterName: this.get('clusterName'),
  116. clusterState: 'CLUSTER_NOT_CREATED_1',
  117. wizardControllerName: 'installerController',
  118. localdb: App.db.data
  119. });
  120. }
  121. if ((this.get('currentStep') - step) > 1) {
  122. App.ModalPopup.show({
  123. header: Em.I18n.t('installer.navigation.warning.header'),
  124. onPrimary: function () {
  125. App.router.send('gotoStep' + step);
  126. this.hide();
  127. },
  128. body: "If you proceed to go back to Step " + step + ", you will lose any changes you have made beyond this step"
  129. });
  130. } else {
  131. App.router.send('gotoStep' + step);
  132. }
  133. return true;
  134. },
  135. gotoStep0: function () {
  136. this.gotoStep(0);
  137. },
  138. gotoStep1: function () {
  139. this.gotoStep(1);
  140. },
  141. gotoStep2: function () {
  142. this.gotoStep(2);
  143. },
  144. gotoStep3: function () {
  145. this.gotoStep(3);
  146. },
  147. gotoStep4: function () {
  148. this.gotoStep(4);
  149. },
  150. gotoStep5: function () {
  151. this.gotoStep(5);
  152. },
  153. gotoStep6: function () {
  154. this.gotoStep(6);
  155. },
  156. gotoStep7: function () {
  157. this.gotoStep(7);
  158. },
  159. gotoStep8: function () {
  160. this.gotoStep(8);
  161. },
  162. gotoStep9: function () {
  163. this.gotoStep(9);
  164. },
  165. gotoStep10: function () {
  166. this.gotoStep(10);
  167. },
  168. /**
  169. * Initialize host status info for step9
  170. */
  171. setInfoForStep9: function () {
  172. var hostInfo = App.db.getHosts();
  173. for (var index in hostInfo) {
  174. hostInfo[index].status = "pending";
  175. hostInfo[index].message = 'Waiting';
  176. hostInfo[index].logTasks = [];
  177. hostInfo[index].tasks = [];
  178. hostInfo[index].progress = '0';
  179. }
  180. App.db.setHosts(hostInfo);
  181. },
  182. /**
  183. * Remove all data for installOptions step
  184. */
  185. clearInstallOptions: function () {
  186. var installOptions = jQuery.extend({}, this.get('installOptionsTemplate'));
  187. this.set('content.installOptions', installOptions);
  188. this.save('installOptions');
  189. this.set('content.hosts', []);
  190. this.save('hosts');
  191. },
  192. toObject: function(object){
  193. var result = {};
  194. for(var i in object){
  195. if(object.hasOwnProperty(i)){
  196. result[i] = object[i];
  197. }
  198. }
  199. return result;
  200. },
  201. /**
  202. * save status of the cluster. This is called from step8 and step9 to persist install and start requestId
  203. * @param clusterStatus object with status, isCompleted, requestId, isInstallError and isStartError field.
  204. */
  205. saveClusterStatus: function (clusterStatus) {
  206. var oldStatus = this.toObject(this.get('content.cluster'));
  207. clusterStatus = jQuery.extend(oldStatus, clusterStatus);
  208. if (clusterStatus.requestId &&
  209. clusterStatus.oldRequestsId.indexOf(clusterStatus.requestId) === -1){
  210. clusterStatus.oldRequestsId.push(clusterStatus.requestId);
  211. }
  212. this.set('content.cluster', clusterStatus);
  213. this.save('cluster');
  214. },
  215. /**
  216. * Invoke installation of selected services to the server and saves the request id returned by the server.
  217. * @param isRetry
  218. */
  219. installServices: function (isRetry) {
  220. // clear requests since we are installing services
  221. // and we don't want to get tasks for previous install attempts
  222. this.set('content.cluster.oldRequestsId', []);
  223. var clusterName = this.get('content.cluster.name');
  224. var data;
  225. var name;
  226. switch (this.get('content.controllerName')) {
  227. case 'addHostController':
  228. var hostnames = [];
  229. for (var hostname in App.db.getHosts()) {
  230. hostnames.push(hostname);
  231. }
  232. if (isRetry) {
  233. name = 'wizard.install_services.add_host_controller.is_retry';
  234. }
  235. else {
  236. name = 'wizard.install_services.add_host_controller.not_is_retry';
  237. }
  238. data = {
  239. "RequestInfo": {
  240. "context": Em.I18n.t('requestInfo.installComponents'),
  241. "query": "HostRoles/host_name.in(" + hostnames.join(',') + ")"
  242. },
  243. "Body": {
  244. "HostRoles": {"state": "INSTALLED"}
  245. }
  246. };
  247. data = JSON.stringify(data);
  248. break;
  249. case 'installerController':
  250. default:
  251. if (isRetry) {
  252. name = 'wizard.install_services.installer_controller.is_retry';
  253. data = '{"RequestInfo": {"context" :"'+ Em.I18n.t('requestInfo.installComponents') +'"}, "Body": {"HostRoles": {"state": "INSTALLED"}}}';
  254. }
  255. else {
  256. name = 'wizard.install_services.installer_controller.not_is_retry';
  257. data = '{"RequestInfo": {"context" :"'+ Em.I18n.t('requestInfo.installServices') +'"}, "Body": {"ServiceInfo": {"state": "INSTALLED"}}}';
  258. }
  259. break;
  260. }
  261. App.ajax.send({
  262. name: name,
  263. sender: this,
  264. data: {
  265. data: data,
  266. cluster: clusterName
  267. },
  268. success: 'installServicesSuccessCallback',
  269. error: 'installServicesErrorCallback'
  270. });
  271. },
  272. installServicesSuccessCallback: function (jsonData) {
  273. var installStartTime = new Date().getTime();
  274. console.log("TRACE: In success function for the installService call");
  275. if (jsonData) {
  276. var requestId = jsonData.Requests.id;
  277. console.log('requestId is: ' + requestId);
  278. var clusterStatus = {
  279. status: 'PENDING',
  280. requestId: requestId,
  281. isInstallError: false,
  282. isCompleted: false,
  283. installStartTime: installStartTime
  284. };
  285. this.saveClusterStatus(clusterStatus);
  286. } else {
  287. console.log('ERROR: Error occurred in parsing JSON data');
  288. }
  289. },
  290. installServicesErrorCallback: function (request, ajaxOptions, error) {
  291. console.log("TRACE: In error function for the installService call");
  292. console.log("TRACE: error code status is: " + request.status);
  293. console.log('Error message is: ' + request.responseText);
  294. var clusterStatus = {
  295. status: 'PENDING',
  296. requestId: this.get('content.cluster.requestId'),
  297. isInstallError: true,
  298. isCompleted: false
  299. };
  300. this.saveClusterStatus(clusterStatus);
  301. App.showAlertPopup(Em.I18n.t('common.errorPopup.header'), request.responseText);
  302. },
  303. bootstrapRequestId: null,
  304. /*
  305. Bootstrap selected hosts.
  306. */
  307. launchBootstrap: function (bootStrapData) {
  308. App.ajax.send({
  309. name: 'wizard.launch_bootstrap',
  310. sender: this,
  311. data: {
  312. bootStrapData: bootStrapData
  313. },
  314. success: 'launchBootstrapSuccessCallback',
  315. error: 'launchBootstrapErrorCallback'
  316. });
  317. return this.get('bootstrapRequestId');
  318. },
  319. launchBootstrapSuccessCallback: function (data) {
  320. console.log("TRACE: POST bootstrap succeeded");
  321. this.set('bootstrapRequestId', data.requestId);
  322. },
  323. launchBootstrapErrorCallback: function () {
  324. console.log("ERROR: POST bootstrap failed");
  325. alert('Bootstrap call failed. Please try again.');
  326. },
  327. /**
  328. * Load <code>content.<name></code> variable from localStorage, if wasn't loaded before.
  329. * If you specify <code>reload</code> to true - it will reload it.
  330. * @param name
  331. * @param reload
  332. * @return {Boolean}
  333. */
  334. load: function (name, reload) {
  335. if (this.get('content.' + name) && !reload) {
  336. return false;
  337. }
  338. var result = App.db['get' + name.capitalize()]();
  339. if (!result){
  340. result = this['get' + name.capitalize()]();
  341. App.db['set' + name.capitalize()](result);
  342. console.log(this.get('name') + ": created " + name, result);
  343. }
  344. this.set('content.' + name, result);
  345. console.log(this.get('name') + ": loaded " + name, result);
  346. },
  347. save: function(name){
  348. var value = this.toObject(this.get('content.' + name));
  349. App.db['set' + name.capitalize()](value);
  350. console.log(this.get('name') + ": saved " + name, value);
  351. },
  352. clear: function () {
  353. this.set('content', Ember.Object.create({
  354. 'controllerName': this.get('content.controllerName')
  355. }));
  356. this.set('currentStep', 0);
  357. this.clearStorageData();
  358. },
  359. clusterStatusTemplate : {
  360. name: "",
  361. status: "PENDING",
  362. isCompleted: false,
  363. requestId: null,
  364. installStartTime: null,
  365. installTime: null,
  366. isInstallError: false,
  367. isStartError: false,
  368. oldRequestsId: []
  369. },
  370. clearStorageData: function(){
  371. App.db.setService(undefined); //not to use this data at AddService page
  372. App.db.setHosts(undefined);
  373. App.db.setMasterComponentHosts(undefined);
  374. App.db.setSlaveComponentHosts(undefined);
  375. App.db.setCluster(undefined);
  376. App.db.setAllHostNames(undefined);
  377. App.db.setInstallOptions(undefined);
  378. App.db.setAllHostNamesPattern(undefined);
  379. },
  380. installOptionsTemplate: {
  381. hostNames: "", //string
  382. manualInstall: false, //true, false
  383. useSsh: true, //bool
  384. javaHome: App.defaultJavaHome, //string
  385. localRepo: false, //true, false
  386. sshKey: "", //string
  387. bootRequestId: null, //string
  388. sshUser: "root" //string
  389. },
  390. loadedServiceComponents: null,
  391. /**
  392. * Generate serviceComponents as pr the stack definition and save it to localdata
  393. * called form stepController step4WizardController
  394. */
  395. loadServiceComponents: function () {
  396. App.ajax.send({
  397. name: 'wizard.service_components',
  398. sender: this,
  399. data: {
  400. stackUrl: App.get('stack2VersionURL'),
  401. stackVersion: App.get('currentStackVersionNumber')
  402. },
  403. success: 'loadServiceComponentsSuccessCallback',
  404. error: 'loadServiceComponentsErrorCallback'
  405. });
  406. return this.get('loadedServiceComponents');
  407. },
  408. loadServiceComponentsSuccessCallback: function (jsonData) {
  409. var displayOrderConfig = require('data/services');
  410. console.log("TRACE: getService ajax call -> In success function for the getServiceComponents call");
  411. console.log("TRACE: jsonData.services : " + jsonData.items);
  412. // Creating Model
  413. var Service = Ember.Object.extend({
  414. serviceName: null,
  415. displayName: null,
  416. isDisabled: true,
  417. isSelected: true,
  418. isInstalled: false,
  419. description: null,
  420. version: null
  421. });
  422. var data = [];
  423. // loop through all the service components
  424. for (var i = 0; i < displayOrderConfig.length; i++) {
  425. var entry = jsonData.items.findProperty("StackServices.service_name", displayOrderConfig[i].serviceName);
  426. if (entry) {
  427. var myService = Service.create({
  428. serviceName: entry.StackServices.service_name,
  429. displayName: displayOrderConfig[i].displayName,
  430. isDisabled: displayOrderConfig[i].isDisabled,
  431. isSelected: displayOrderConfig[i].isSelected,
  432. canBeSelected: displayOrderConfig[i].canBeSelected,
  433. isInstalled: false,
  434. isHidden: displayOrderConfig[i].isHidden,
  435. description: entry.StackServices.comments,
  436. version: entry.StackServices.service_version
  437. });
  438. data.push(myService);
  439. }
  440. else {
  441. console.warn('Service not found - ', displayOrderConfig[i].serviceName);
  442. }
  443. }
  444. this.set('loadedServiceComponents', data);
  445. console.log('TRACE: service components: ' + JSON.stringify(data));
  446. },
  447. loadServiceComponentsErrorCallback: function (request, ajaxOptions, error) {
  448. console.log("TRACE: STep5 -> In error function for the getServiceComponents call");
  449. console.log("TRACE: STep5 -> error code status is: " + request.status);
  450. console.log('Step8: Error message is: ' + request.responseText);
  451. },
  452. loadServicesFromServer: function() {
  453. var services = App.db.getService();
  454. if (services) {
  455. return;
  456. }
  457. var apiService = this.loadServiceComponents();
  458. this.set('content.services', apiService);
  459. App.db.setService(apiService);
  460. },
  461. registerErrPopup: function (header, message) {
  462. App.ModalPopup.show({
  463. header: header,
  464. secondary: false,
  465. onPrimary: function () {
  466. this.hide();
  467. },
  468. bodyClass: Ember.View.extend({
  469. template: Ember.Handlebars.compile(['<p>{{view.message}}</p>'].join('\n')),
  470. message: message
  471. })
  472. });
  473. },
  474. /**
  475. * Save hosts that the user confirmed to proceed with from step 3
  476. * @param stepController App.WizardStep3Controller
  477. */
  478. saveConfirmedHosts: function (stepController) {
  479. var hostInfo = {};
  480. stepController.get('content.hosts').forEach(function (_host) {
  481. hostInfo[_host.name] = {
  482. name: _host.name,
  483. cpu: _host.cpu,
  484. memory: _host.memory,
  485. disk_info: _host.disk_info,
  486. bootStatus: _host.bootStatus,
  487. isInstalled: false
  488. };
  489. });
  490. console.log('wizardController:saveConfirmedHosts: save hosts ', hostInfo);
  491. App.db.setHosts(hostInfo);
  492. this.set('content.hosts', hostInfo);
  493. },
  494. /**
  495. * Save data after installation to main controller
  496. * @param stepController App.WizardStep9Controller
  497. */
  498. saveInstalledHosts: function (stepController) {
  499. var hosts = stepController.get('hosts');
  500. var hostInfo = App.db.getHosts();
  501. for (var index in hostInfo) {
  502. hostInfo[index].status = "pending";
  503. var host = hosts.findProperty('name', hostInfo[index].name);
  504. if (host) {
  505. hostInfo[index].status = host.status;
  506. hostInfo[index].message = host.message;
  507. hostInfo[index].progress = host.progress;
  508. }
  509. }
  510. this.set('content.hosts', hostInfo);
  511. this.save('hosts');
  512. console.log('wizardController:saveInstalledHosts: save hosts ', hostInfo);
  513. },
  514. /**
  515. * Save slaveHostComponents to main controller
  516. * @param stepController
  517. */
  518. saveSlaveComponentHosts: function (stepController) {
  519. var hosts = stepController.get('hosts');
  520. var headers = stepController.get('headers');
  521. var formattedHosts = Ember.Object.create();
  522. headers.forEach(function(header) {
  523. formattedHosts.set(header.get('name'), []);
  524. });
  525. hosts.forEach(function (host) {
  526. var checkboxes = host.get('checkboxes');
  527. headers.forEach(function(header) {
  528. var cb = checkboxes.findProperty('title', header.get('label'));
  529. if (cb.get('checked')) {
  530. formattedHosts.get(header.get('name')).push({
  531. hostName: host.hostName,
  532. group: 'Default',
  533. isInstalled: cb.get('isInstalled')
  534. });
  535. }
  536. });
  537. });
  538. var slaveComponentHosts = [];
  539. headers.forEach(function(header) {
  540. slaveComponentHosts.push({
  541. componentName: header.get('name'),
  542. displayName: header.get('label').replace(/\s/g, ''),
  543. hosts: formattedHosts.get(header.get('name'))
  544. });
  545. });
  546. App.db.setSlaveComponentHosts(slaveComponentHosts);
  547. console.log('wizardController.slaveComponentHosts: saved hosts', slaveComponentHosts);
  548. this.set('content.slaveComponentHosts', slaveComponentHosts);
  549. },
  550. /**
  551. * Return true if cluster data is loaded and false otherwise.
  552. * This is used for all wizard controllers except for installer wizard.
  553. */
  554. dataLoading: function(){
  555. var dfd = $.Deferred();
  556. this.connectOutlet('loading');
  557. if (App.router.get('clusterController.isLoaded')){
  558. dfd.resolve();
  559. } else{
  560. var interval = setInterval(function(){
  561. if (App.router.get('clusterController.isLoaded')){
  562. dfd.resolve();
  563. clearInterval(interval);
  564. }
  565. },50);
  566. }
  567. return dfd.promise();
  568. },
  569. /**
  570. * Save cluster status before going to deploy step
  571. * @param name cluster state. Unique for every wizard
  572. */
  573. saveClusterState: function(name){
  574. App.clusterStatus.setClusterStatus({
  575. clusterName: this.get('content.cluster.name'),
  576. clusterState: name,
  577. wizardControllerName: this.get('content.controllerName'),
  578. localdb: App.db.data
  579. });
  580. },
  581. /**
  582. * load advanced configs from server
  583. */
  584. loadAdvancedConfigs: function () {
  585. var configs = (App.db.getAdvancedServiceConfig()) ? App.db.getAdvancedServiceConfig() : [];
  586. this.get('content.services').filterProperty('isSelected', true).mapProperty('serviceName').forEach(function (_serviceName) {
  587. var serviceComponents = App.config.loadAdvancedConfig(_serviceName);
  588. if(serviceComponents){
  589. configs = configs.concat(serviceComponents);
  590. }
  591. }, this);
  592. this.set('content.advancedServiceConfig', configs);
  593. App.db.setAdvancedServiceConfig(configs);
  594. },
  595. /**
  596. * Load serviceConfigProperties to model
  597. */
  598. loadServiceConfigProperties: function () {
  599. var serviceConfigProperties = App.db.getServiceConfigProperties();
  600. this.set('content.serviceConfigProperties', serviceConfigProperties);
  601. console.log("AddHostController.loadServiceConfigProperties: loaded config ", serviceConfigProperties);
  602. },
  603. /**
  604. * Save config properties
  605. * @param stepController Step7WizardController
  606. */
  607. saveServiceConfigProperties: function (stepController) {
  608. var serviceConfigProperties = [];
  609. stepController.get('stepConfigs').forEach(function (_content) {
  610. if(_content.serviceName === 'YARN' && !App.supports.capacitySchedulerUi){
  611. _content.set('configs', App.config.textareaIntoFileConfigs(_content.get('configs'), 'capacity-scheduler.xml'));
  612. }
  613. _content.get('configs').forEach(function (_configProperties) {
  614. var overrides = _configProperties.get('overrides');
  615. var overridesArray = [];
  616. if(overrides!=null){
  617. overrides.forEach(function(override){
  618. var overrideEntry = {
  619. value: override.get('value'),
  620. hosts: []
  621. };
  622. override.get('selectedHostOptions').forEach(function(host){
  623. overrideEntry.hosts.push(host);
  624. });
  625. overridesArray.push(overrideEntry);
  626. });
  627. }
  628. overridesArray = (overridesArray.length) ? overridesArray : null;
  629. var configProperty = {
  630. id: _configProperties.get('id'),
  631. name: _configProperties.get('name'),
  632. value: _configProperties.get('value'),
  633. defaultValue: _configProperties.get('defaultValue'),
  634. description: _configProperties.get('description'),
  635. serviceName: _configProperties.get('serviceName'),
  636. domain: _configProperties.get('domain'),
  637. filename: _configProperties.get('filename'),
  638. displayType: _configProperties.get('displayType'),
  639. overrides: overridesArray
  640. };
  641. serviceConfigProperties.push(configProperty);
  642. }, this);
  643. }, this);
  644. App.db.setServiceConfigProperties(serviceConfigProperties);
  645. this.set('content.serviceConfigProperties', serviceConfigProperties);
  646. }
  647. })