step7_controller.js 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242
  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. var numberUtils = require('utils/number_utils');
  20. var stringUtils = require('utils/string_utils');
  21. /**
  22. * By Step 7, we have the following information stored in App.db and set on this
  23. * controller by the router.
  24. *
  25. * selectedServices: App.db.selectedServices (the services that the user selected in Step 4)
  26. * masterComponentHosts: App.db.masterComponentHosts (master-components-to-hosts mapping the user selected in Step 5)
  27. * slaveComponentHosts: App.db.slaveComponentHosts (slave-components-to-hosts mapping the user selected in Step 6)
  28. *
  29. */
  30. App.WizardStep7Controller = Em.Controller.extend({
  31. name: 'wizardStep7Controller',
  32. /**
  33. * Contains all field properties that are viewed in this step
  34. * @type {object[]}
  35. */
  36. stepConfigs: [],
  37. selectedService: null,
  38. slaveHostToGroup: null,
  39. /**
  40. * used in services_config.js view to mark a config with security icon
  41. */
  42. secureConfigs: require('data/secure_mapping'),
  43. /**
  44. * If miscConfigChange Modal is shown
  45. * @type {bool}
  46. */
  47. miscModalVisible: false,
  48. gangliaAvailableSpace: null,
  49. /**
  50. * @type {string}
  51. */
  52. gangliaMoutDir: '/',
  53. overrideToAdd: null,
  54. /**
  55. * Is installer controller used
  56. * @type {bool}
  57. */
  58. isInstaller: true,
  59. /**
  60. * List of config groups
  61. * @type {object[]}
  62. */
  63. configGroups: [],
  64. /**
  65. * List of config group to be deleted
  66. * @type {object[]}
  67. */
  68. groupsToDelete: [],
  69. preSelectedConfigGroup: null,
  70. /**
  71. * Currently selected config group
  72. * @type {object}
  73. */
  74. selectedConfigGroup: null,
  75. /**
  76. * Config tags of actually installed services
  77. * @type {array}
  78. */
  79. serviceConfigTags: [],
  80. serviceConfigsData: require('data/service_configs'),
  81. /**
  82. * Are advanced configs loaded
  83. * @type {bool}
  84. */
  85. isAdvancedConfigLoaded: true,
  86. /**
  87. * Are applied to service configs loaded
  88. * @type {bool}
  89. */
  90. isAppliedConfigLoaded: true,
  91. isConfigsLoaded: function () {
  92. return (this.get('isAdvancedConfigLoaded') && this.get('isAppliedConfigLoaded'));
  93. }.property('isAdvancedConfigLoaded', 'isAppliedConfigLoaded'),
  94. /**
  95. * Should Next-button be disabled
  96. * @type {bool}
  97. */
  98. isSubmitDisabled: function () {
  99. return (!this.stepConfigs.filterProperty('showConfig', true).everyProperty('errorCount', 0) || this.get("miscModalVisible"));
  100. }.property('stepConfigs.@each.errorCount', 'miscModalVisible'),
  101. /**
  102. * List of selected to install service names
  103. * @type {string[]}
  104. */
  105. selectedServiceNames: function () {
  106. return this.get('content.services').filterProperty('isSelected', true).filterProperty('isInstalled', false).mapProperty('serviceName');
  107. }.property('content.services').cacheable(),
  108. /**
  109. * List of installed and selected to install service names
  110. * @type {string[]}
  111. */
  112. allSelectedServiceNames: function () {
  113. return this.get('content.services').filter(function (service) {
  114. return service.get('isInstalled') || service.get('isSelected');
  115. }).mapProperty('serviceName');
  116. }.property('content.services').cacheable(),
  117. /**
  118. * List of installed service names
  119. * Sqoop and HCatalog are excluded if not installer wizard running
  120. * @type {string[]}
  121. */
  122. installedServiceNames: function () {
  123. var serviceNames = this.get('content.services').filterProperty('isInstalled').mapProperty('serviceName');
  124. if (this.get('content.controllerName') !== 'installerController') {
  125. serviceNames = serviceNames.filter(function(_serviceName){
  126. return !App.get('services.noConfigTypes').concat('HCATALOG').contains(_serviceName);
  127. });
  128. }
  129. return serviceNames;
  130. }.property('content.services').cacheable(),
  131. /**
  132. * List of master components
  133. * @type {Ember.Enumerable}
  134. */
  135. masterComponentHosts: function () {
  136. return this.get('content.masterComponentHosts');
  137. }.property('content.masterComponentHosts'),
  138. /**
  139. * List of slave components
  140. * @type {Ember.Enumerable}
  141. */
  142. slaveComponentHosts: function () {
  143. return this.get('content.slaveGroupProperties');
  144. }.property('content.slaveGroupProperties', 'content.slaveComponentHosts'),
  145. customData: [],
  146. /**
  147. * Filter text will be located here
  148. * @type {string}
  149. */
  150. filter: '',
  151. /**
  152. * Dropdown menu items in filter combobox
  153. * @type {Ember.Object[]}
  154. */
  155. filterColumns: function () {
  156. var result = [];
  157. for (var i = 1; i < 2; i++) {
  158. result.push(Em.Object.create({
  159. name: this.t('common.combobox.dropdown.' + i),
  160. selected: false
  161. }));
  162. }
  163. return result;
  164. }.property(),
  165. /**
  166. * Clear controller's properties:
  167. * <ul>
  168. * <li>stepConfigs</li>
  169. * <li>filter</li>
  170. * </ul>
  171. * and desect all <code>filterColumns</code>
  172. * @method clearStep
  173. */
  174. clearStep: function () {
  175. this.get('stepConfigs').clear();
  176. this.set('filter', '');
  177. this.get('filterColumns').setEach('selected', false);
  178. },
  179. /**
  180. * Load config groups for installed services
  181. * One ajax-request for each service
  182. * @param {string[]} servicesNames
  183. * @method loadInstalledServicesConfigGroups
  184. */
  185. loadInstalledServicesConfigGroups: function (servicesNames) {
  186. servicesNames.forEach(function (serviceName) {
  187. App.ajax.send({
  188. name: 'config.tags_and_groups',
  189. sender: this,
  190. data: {
  191. serviceName: serviceName,
  192. serviceConfigsDef: App.config.get('preDefinedServiceConfigs').findProperty('serviceName', serviceName)
  193. },
  194. success: 'loadServiceTagsSuccess'
  195. });
  196. }, this);
  197. },
  198. /**
  199. * Create site to tag map. Format:
  200. * <code>
  201. * {
  202. * site1: tag1,
  203. * site1: tag2,
  204. * site2: tag3
  205. * ...
  206. * }
  207. * </code>
  208. * @param {object} desired_configs
  209. * @param {string[]} sites
  210. * @returns {object}
  211. * @private
  212. * @method _createSiteToTagMap
  213. */
  214. _createSiteToTagMap: function (desired_configs, sites) {
  215. var siteToTagMap = {};
  216. for (var site in desired_configs) {
  217. if (desired_configs.hasOwnProperty(site)) {
  218. if (!!sites[site]) {
  219. siteToTagMap[site] = desired_configs[site].tag;
  220. }
  221. }
  222. }
  223. return siteToTagMap;
  224. },
  225. /**
  226. * Load config groups success callback
  227. * @param {object} data
  228. * @param {object} opt
  229. * @param {object} params
  230. * @method loadServiceTagsSuccess
  231. */
  232. loadServiceTagsSuccess: function (data, opt, params) {
  233. var serviceName = params.serviceName,
  234. service = this.get('stepConfigs').findProperty('serviceName', serviceName),
  235. defaultConfigGroupHosts = this.get('wizardController.allHosts').mapProperty('hostName'),
  236. siteToTagMap = this._createSiteToTagMap(data.Clusters.desired_configs, params.serviceConfigsDef.get('configTypes')),
  237. selectedConfigGroup;
  238. this.set('loadedClusterSiteToTagMap', siteToTagMap);
  239. //parse loaded config groups
  240. if (App.get('supports.hostOverrides')) {
  241. var configGroups = [];
  242. if (data.config_groups.length) {
  243. data.config_groups.forEach(function (item) {
  244. item = item.ConfigGroup;
  245. if (item.tag === serviceName) {
  246. var groupHosts = item.hosts.mapProperty('host_name');
  247. var newConfigGroup = App.ConfigGroup.create({
  248. id: item.id,
  249. name: item.group_name,
  250. description: item.description,
  251. isDefault: false,
  252. parentConfigGroup: null,
  253. service: App.Service.find().findProperty('serviceName', item.tag),
  254. hosts: groupHosts,
  255. configSiteTags: []
  256. });
  257. groupHosts.forEach(function (host) {
  258. defaultConfigGroupHosts = defaultConfigGroupHosts.without(host);
  259. }, this);
  260. item.desired_configs.forEach(function (config) {
  261. newConfigGroup.configSiteTags.push(App.ConfigSiteTag.create({
  262. site: config.type,
  263. tag: config.tag
  264. }));
  265. }, this);
  266. configGroups.push(newConfigGroup);
  267. }
  268. }, this);
  269. }
  270. }
  271. var defaultConfigGroup = App.ConfigGroup.create({
  272. name: App.format.role(serviceName) + " Default",
  273. description: "Default cluster level " + serviceName + " configuration",
  274. isDefault: true,
  275. hosts: defaultConfigGroupHosts,
  276. parentConfigGroup: null,
  277. service: Em.Object.create({
  278. id: serviceName
  279. }),
  280. serviceName: serviceName,
  281. configSiteTags: []
  282. });
  283. if (!selectedConfigGroup) {
  284. selectedConfigGroup = defaultConfigGroup;
  285. }
  286. configGroups = configGroups.sortProperty('name');
  287. configGroups.unshift(defaultConfigGroup);
  288. if (App.get('supports.hostOverrides')) {
  289. service.set('configGroups', configGroups);
  290. var loadedGroupToOverrideSiteToTagMap = {};
  291. if (App.get('supports.hostOverrides')) {
  292. var configGroupsWithOverrides = selectedConfigGroup.get('isDefault') ? service.get('configGroups') : [selectedConfigGroup];
  293. configGroupsWithOverrides.forEach(function (item) {
  294. var groupName = item.get('name');
  295. loadedGroupToOverrideSiteToTagMap[groupName] = {};
  296. item.get('configSiteTags').forEach(function (siteTag) {
  297. var site = siteTag.get('site');
  298. loadedGroupToOverrideSiteToTagMap[groupName][site] = siteTag.get('tag');
  299. }, this);
  300. }, this);
  301. }
  302. this.set('preSelectedConfigGroup', selectedConfigGroup);
  303. App.config.loadServiceConfigGroupOverrides(service.get('configs'), loadedGroupToOverrideSiteToTagMap, service.get('configGroups'), this.onLoadOverrides, this);
  304. }
  305. },
  306. onLoadOverrides: function (configs) {
  307. var serviceName = configs[0].serviceName,
  308. service = this.get('stepConfigs').findProperty('serviceName', serviceName);
  309. if (App.get('supports.hostOverrides')) {
  310. var serviceConfig = App.config.createServiceConfig(serviceName);
  311. if (serviceConfig.get('serviceName') === 'HDFS') {
  312. App.config.OnNnHAHideSnn(serviceConfig);
  313. }
  314. service.set('selectedConfigGroup', this.get('preSelectedConfigGroup'));
  315. this.loadComponentConfigs(service.get('configs'), serviceConfig, service);
  316. }
  317. service.set('configs', serviceConfig.get('configs'));
  318. },
  319. /**
  320. * Get object with recommended default values for config properties
  321. * Format:
  322. * <code>
  323. * {
  324. * configName1: configValue1,
  325. * configName2: configValue2
  326. * ...
  327. * }
  328. * </code>
  329. * @param {string} serviceName
  330. * @returns {object}
  331. * @method _getRecommendedDefaultsForComponent
  332. */
  333. _getRecommendedDefaultsForComponent: function (serviceName) {
  334. var s = App.StackService.find(serviceName),
  335. recommendedDefaults = {},
  336. localDB = this.getInfoForDefaults();
  337. if (s.get('defaultsProvider')) {
  338. s.get('defaultsProvider').forEach(function (defaultsProvider) {
  339. var d = defaultsProvider.getDefaults(localDB);
  340. for (var name in d) {
  341. if (d.hasOwnProperty(name)) {
  342. recommendedDefaults[name] = d[name];
  343. }
  344. }
  345. });
  346. }
  347. return recommendedDefaults;
  348. },
  349. /**
  350. * Get info about hosts and host components to configDefaultsProviders
  351. * Work specifically in Add Service wizard
  352. * @slaveComponentHosts - contains slaves and clients as well
  353. * @returns {{masterComponentHosts: Array, slaveComponentHosts: Array, hosts: {}}}
  354. */
  355. getInfoForDefaults: function () {
  356. var slaveComponentHosts = [];
  357. var hosts = this.get('content.hosts');
  358. var slaveHostMap = {};
  359. //get clients and slaves from stack
  360. App.StackServiceComponent.find().forEach(function (component) {
  361. if (component.get('isClient') || component.get('isSlave')) {
  362. slaveHostMap[component.get('componentName')] = [];
  363. }
  364. });
  365. //assign hosts of every component
  366. for (var hostName in hosts) {
  367. hosts[hostName].hostComponents.forEach(function (componentName) {
  368. if (slaveHostMap[componentName]) {
  369. slaveHostMap[componentName].push({hostName: hostName});
  370. }
  371. });
  372. }
  373. //push slaves and clients into @slaveComponentHosts
  374. for (var componentName in slaveHostMap) {
  375. if (slaveHostMap[componentName].length > 0) {
  376. slaveComponentHosts.push({
  377. componentName: componentName,
  378. hosts: slaveHostMap[componentName]
  379. })
  380. }
  381. }
  382. var masterComponentHosts = App.HostComponent.find().filterProperty('isMaster', true).map(function (item) {
  383. return {
  384. component: item.get('componentName'),
  385. serviceId: item.get('service.serviceName'),
  386. host: item.get('hostName')
  387. }
  388. });
  389. return {
  390. masterComponentHosts: masterComponentHosts,
  391. slaveComponentHosts: slaveComponentHosts,
  392. hosts: hosts
  393. };
  394. },
  395. /**
  396. * By default <code>value</code>-property is string "true|false".
  397. * Should update it to boolean type
  398. * Also affects <code>defaultValue</code>
  399. * @param {Ember.Object} serviceConfigProperty
  400. * @returns {Ember.Object} Updated config-object
  401. * @method _updateValueForCheckBoxConfig
  402. */
  403. _updateValueForCheckBoxConfig: function (serviceConfigProperty) {
  404. var v = serviceConfigProperty.get('value');
  405. switch (serviceConfigProperty.get('value')) {
  406. case 'true':
  407. v = true;
  408. break;
  409. case 'false':
  410. v = false;
  411. break;
  412. }
  413. serviceConfigProperty.setProperties({value: v, defaultValue: v});
  414. return serviceConfigProperty;
  415. },
  416. /**
  417. * Set <code>isEditable</code>-property to <code>serviceConfigProperty</code>
  418. * Based on user's permissions and selected config group
  419. * @param {Ember.Object} serviceConfigProperty
  420. * @param {bool} defaultGroupSelected
  421. * @returns {Ember.Object} Updated config-object
  422. * @method _updateIsEditableFlagForConfig
  423. */
  424. _updateIsEditableFlagForConfig: function (serviceConfigProperty, defaultGroupSelected) {
  425. if (App.get('isAdmin')) {
  426. if (defaultGroupSelected && !this.get('isHostsConfigsPage')) {
  427. serviceConfigProperty.set('isEditable', serviceConfigProperty.get('isReconfigurable'));
  428. }
  429. else {
  430. serviceConfigProperty.set('isEditable', false);
  431. }
  432. }
  433. else {
  434. serviceConfigProperty.set('isEditable', false);
  435. }
  436. return serviceConfigProperty;
  437. },
  438. /**
  439. * Set <code>overrides</code>-property to <code>serviceConfigProperty<code>
  440. * @param {Ember.Object} serviceConfigProperty
  441. * @param {Ember.Object} component
  442. * @return {Ember.Object} Updated config-object
  443. * @method _updateOverridesForConfig
  444. */
  445. _updateOverridesForConfig: function (serviceConfigProperty, component) {
  446. var overrides = serviceConfigProperty.get('overrides');
  447. if (Em.isNone(overrides)) {
  448. serviceConfigProperty.set('overrides', Em.A([]));
  449. return serviceConfigProperty;
  450. }
  451. serviceConfigProperty.set('overrides', null);
  452. var defaultGroupSelected = component.get('selectedConfigGroup.isDefault');
  453. // Wrap each override to App.ServiceConfigProperty
  454. overrides.forEach(function (override) {
  455. var newSCP = App.ServiceConfigProperty.create(serviceConfigProperty);
  456. newSCP.set('value', override.value);
  457. newSCP.set('isOriginalSCP', false); // indicated this is overridden value,
  458. newSCP.set('parentSCP', serviceConfigProperty);
  459. if (App.get('supports.hostOverrides') && defaultGroupSelected) {
  460. var group = component.get('configGroups').findProperty('name', override.group.get('name'));
  461. // prevent cycle in proto object, clean link
  462. if (group.get('properties').length == 0) {
  463. group.set('properties', Em.A([]));
  464. }
  465. group.get('properties').push(newSCP);
  466. newSCP.set('group', override.group);
  467. newSCP.set('isEditable', false);
  468. }
  469. var parentOverridesArray = serviceConfigProperty.get('overrides');
  470. if (Em.isNone(parentOverridesArray)) {
  471. parentOverridesArray = Em.A([]);
  472. serviceConfigProperty.set('overrides', parentOverridesArray);
  473. }
  474. serviceConfigProperty.get('overrides').pushObject(newSCP);
  475. }, this);
  476. return serviceConfigProperty;
  477. },
  478. /**
  479. * Set <code>serviceValidator</code>-property to <code>serviceConfigProperty</code> if config's serviceName is equal
  480. * to component's serviceName
  481. * othervise set <code>isVisible</code>-property to <code>false</code>
  482. * @param {Ember.Object} serviceConfigProperty
  483. * @param {Ember.Object} component
  484. * @param {object} serviceConfigsData
  485. * @returns {Ember.Object} updated config-object
  486. * @mrthod _updateValidatorsForConfig
  487. */
  488. _updateValidatorsForConfig: function (serviceConfigProperty, component, serviceConfigsData) {
  489. if (serviceConfigProperty.get('serviceName') === component.get('serviceName')) {
  490. if (serviceConfigsData.get('configsValidator')) {
  491. var validators = serviceConfigsData.get('configsValidator').get('configValidators');
  492. for (var validatorName in validators) {
  493. if (validators.hasOwnProperty(validatorName)) {
  494. if (serviceConfigProperty.get('name') == validatorName) {
  495. serviceConfigProperty.set('serviceValidator', serviceConfigsData.get('configsValidator'));
  496. }
  497. }
  498. }
  499. }
  500. }
  501. else {
  502. serviceConfigProperty.set('isVisible', false);
  503. }
  504. return serviceConfigProperty;
  505. },
  506. /**
  507. * Set configs with overrides, recommended defaults to component
  508. * @param {Ember.Object[]} configs
  509. * @param {Ember.Object} componentConfig
  510. * @param {Ember.Object} component
  511. * @method loadComponentConfigs
  512. */
  513. loadComponentConfigs: function (configs, componentConfig, component) {
  514. var s = App.StackService.find(component.get('serviceName')),
  515. defaultGroupSelected = component.get('selectedConfigGroup.isDefault');
  516. if (s && s.get('configsValidator')) {
  517. var recommendedDefaults = this._getRecommendedDefaultsForComponent(component.get('serviceName'));
  518. s.get('configsValidator').set('recommendedDefaults', recommendedDefaults);
  519. }
  520. configs.forEach(function (serviceConfigProperty) {
  521. if (!serviceConfigProperty) return;
  522. if (Em.isNone(serviceConfigProperty.get('isOverridable'))) {
  523. serviceConfigProperty.set('isOverridable', true);
  524. }
  525. if (serviceConfigProperty.get('displayType') === 'checkbox') {
  526. this._updateValueForCheckBoxConfig(serviceConfigProperty);
  527. }
  528. this._updateValidatorsForConfig(serviceConfigProperty, component, s);
  529. this._updateOverridesForConfig(serviceConfigProperty, component);
  530. this._updateIsEditableFlagForConfig(serviceConfigProperty, defaultGroupSelected);
  531. componentConfig.get('configs').pushObject(serviceConfigProperty);
  532. serviceConfigProperty.validate();
  533. }, this);
  534. var overrideToAdd = this.get('overrideToAdd');
  535. if (overrideToAdd) {
  536. overrideToAdd = componentConfig.get('configs').findProperty('name', overrideToAdd.name);
  537. if (overrideToAdd) {
  538. this.addOverrideProperty(overrideToAdd);
  539. component.set('overrideToAdd', null);
  540. }
  541. }
  542. },
  543. /**
  544. * Resolve dependency between configs.
  545. * @param serviceName {String}
  546. * @param configs {Ember.Enumerable}
  547. */
  548. resolveServiceDependencyConfigs: function (serviceName, configs) {
  549. switch (serviceName) {
  550. case 'STORM':
  551. this.resolveStormConfigs(configs);
  552. break;
  553. default:
  554. break;
  555. }
  556. },
  557. /**
  558. * Update some Storm configs
  559. * If Ganglia is selected to install or already installed, Ganglia host should be added to configs
  560. * @param {Ember.Enumerable} configs
  561. * @method resolveStormConfigs
  562. */
  563. resolveStormConfigs: function (configs) {
  564. var dependentConfigs, gangliaServerHost;
  565. dependentConfigs = ['nimbus.childopts', 'supervisor.childopts', 'worker.childopts'];
  566. // if Ganglia selected or installed, set ganglia host to configs
  567. if (this.get('installedServiceNames').contains('STORM') && this.get('installedServiceNames').contains('GANGLIA')) return;
  568. if (this.get('allSelectedServiceNames').contains('GANGLIA') || this.get('installedServiceNames').contains('GANGLIA')) {
  569. gangliaServerHost = this.get('wizardController').getDBProperty('masterComponentHosts').findProperty('component', 'GANGLIA_SERVER').hostName;
  570. dependentConfigs.forEach(function (configName) {
  571. var config = configs.findProperty('name', configName);
  572. var replaceStr = config.value.match(/.jar=host[^,]+/)[0];
  573. var replaceWith = replaceStr.slice(0, replaceStr.lastIndexOf('=') - replaceStr.length + 1) + gangliaServerHost;
  574. config.value = config.defaultValue = config.value.replace(replaceStr, replaceWith);
  575. config.forceUpdate = true;
  576. }, this);
  577. }
  578. },
  579. /**
  580. * On load function
  581. * @method loadStep
  582. */
  583. loadStep: function () {
  584. console.log("TRACE: Loading step7: Configure Services");
  585. if (!this.get('isConfigsLoaded')) {
  586. return;
  587. }
  588. this.clearStep();
  589. App.config.setPreDefinedGlobalProperties();
  590. App.config.setPreDefinedServiceConfigs();
  591. //STEP 1: Load advanced configs
  592. var advancedConfigs = this.get('content.advancedServiceConfig');
  593. //STEP 2: Load on-site configs by service from local DB
  594. var storedConfigs = this.get('content.serviceConfigProperties');
  595. //STEP 3: Merge pre-defined configs with loaded on-site configs
  596. var configs = App.config.mergePreDefinedWithStored(
  597. storedConfigs,
  598. advancedConfigs,
  599. this.get('selectedServiceNames').concat(this.get('installedServiceNames'))
  600. );
  601. //STEP 4: Add advanced configs
  602. App.config.addAdvancedConfigs(configs, advancedConfigs);
  603. //STEP 5: Add custom configs
  604. App.config.addCustomConfigs(configs);
  605. //put properties from capacity-scheduler.xml into one config with textarea view
  606. if (this.get('allSelectedServiceNames').contains('YARN') && !App.get('supports.capacitySchedulerUi')) {
  607. configs = App.config.fileConfigsIntoTextarea(configs, 'capacity-scheduler.xml');
  608. }
  609. this.set('groupsToDelete', this.get('wizardController').getDBProperty('groupsToDelete') || []);
  610. if (this.get('wizardController.name') === 'addServiceController') {
  611. this.setInstalledServiceConfigs(this.get('serviceConfigTags'), configs);
  612. }
  613. if (this.get('allSelectedServiceNames').contains('STORM') || this.get('installedServiceNames').contains('STORM')) {
  614. this.resolveServiceDependencyConfigs('STORM', configs);
  615. }
  616. //STEP 6: Distribute configs by service and wrap each one in App.ServiceConfigProperty (configs -> serviceConfigs)
  617. this.setStepConfigs(configs, storedConfigs);
  618. this.checkHostOverrideInstaller();
  619. this.activateSpecialConfigs();
  620. this.selectProperService();
  621. if (this.get('content.skipConfigStep')) {
  622. App.router.send('next');
  623. }
  624. },
  625. /**
  626. * If <code>App.supports.hostOverridesInstaller</code> is enabled should load config groups
  627. * and (if some services are already installed) load config groups for installed services
  628. * @method checkHostOverrideInstaller
  629. */
  630. checkHostOverrideInstaller: function () {
  631. if (App.get('supports.hostOverridesInstaller')) {
  632. this.loadConfigGroups(this.get('content.configGroups'));
  633. if (this.get('installedServiceNames').length > 0) {
  634. this.loadInstalledServicesConfigGroups(this.get('installedServiceNames'));
  635. }
  636. }
  637. },
  638. /**
  639. * Set init <code>stepConfigs</code> value
  640. * Set <code>selected</code> for addable services if addServiceController is used
  641. * Remove SNameNode if HA is enabled (and if addServiceController is used)
  642. * @param {Ember.Object[]} configs
  643. * @param {Ember.Object[]} storedConfigs
  644. * @method setStepConfigs
  645. */
  646. setStepConfigs: function (configs, storedConfigs) {
  647. var localDB = {
  648. hosts: this.get('wizardController.content.hosts'),
  649. masterComponentHosts: this.get('wizardController.content.masterComponentHosts'),
  650. slaveComponentHosts: this.get('wizardController.content.slaveComponentHosts')
  651. };
  652. var serviceConfigs = App.config.renderConfigs(configs, storedConfigs, this.get('allSelectedServiceNames'), this.get('installedServiceNames'), localDB);
  653. if (this.get('wizardController.name') === 'addServiceController') {
  654. serviceConfigs.setEach('showConfig', true);
  655. serviceConfigs.setEach('selected', false);
  656. this.get('selectedServiceNames').forEach(function (serviceName) {
  657. if (!serviceConfigs.findProperty('serviceName', serviceName)) return;
  658. serviceConfigs.findProperty('serviceName', serviceName).set('selected', true);
  659. });
  660. // Remove SNameNode if HA is enabled
  661. if (App.get('isHaEnabled')) {
  662. var c = serviceConfigs.findProperty('serviceName', 'HDFS').configs;
  663. var removedConfigs = c.filterProperty('category', 'SECONDARY_NAMENODE');
  664. removedConfigs.map(function (config) {
  665. c = c.without(config);
  666. });
  667. serviceConfigs.findProperty('serviceName', 'HDFS').configs = c;
  668. }
  669. }
  670. this.set('stepConfigs', serviceConfigs);
  671. },
  672. /**
  673. * Select first addable service for <code>addServiceWizard</code>
  674. * Select first service at all in other cases
  675. * @method selectProperService
  676. */
  677. selectProperService: function () {
  678. if (this.get('wizardController.name') === 'addServiceController') {
  679. this.set('selectedService', this.get('stepConfigs').filterProperty('selected', true).get('firstObject'));
  680. }
  681. else {
  682. this.set('selectedService', this.get('stepConfigs').filterProperty('showConfig', true).objectAt(0));
  683. }
  684. },
  685. /**
  686. * Load config tags
  687. * @return {$.ajax|null}
  688. * @method getConfigTags
  689. */
  690. getConfigTags: function () {
  691. this.set('isAppliedConfigLoaded', false);
  692. return App.ajax.send({
  693. name: 'config.tags',
  694. sender: this,
  695. success: 'getConfigTagsSuccess'
  696. });
  697. },
  698. /**
  699. * Success callback for config tags request
  700. * Updates <code>serviceConfigTags</code> with tags received from server
  701. * @param {object} data
  702. * @method getConfigTagsSuccess
  703. */
  704. getConfigTagsSuccess: function (data) {
  705. var installedServiceSites = [];
  706. App.StackService.find().filterProperty('isInstalled').forEach(function (service) {
  707. var configTypes = Object.keys(service.get('configTypes'));
  708. installedServiceSites = installedServiceSites.concat(configTypes);
  709. }, this);
  710. installedServiceSites = installedServiceSites.uniq();
  711. var serviceConfigTags = [];
  712. for (var site in data.Clusters.desired_configs) {
  713. if (data.Clusters.desired_configs.hasOwnProperty(site)) {
  714. if (installedServiceSites.contains(site)) {
  715. serviceConfigTags.push({
  716. siteName: site,
  717. tagName: data.Clusters.desired_configs[site].tag,
  718. newTagName: null
  719. });
  720. }
  721. }
  722. }
  723. this.set('serviceConfigTags', serviceConfigTags);
  724. this.set('isAppliedConfigLoaded', true);
  725. },
  726. /**
  727. * set configs actual values from server
  728. * @param serviceConfigTags
  729. * @param configs
  730. * @method setInstalledServiceConfigs
  731. */
  732. setInstalledServiceConfigs: function (serviceConfigTags, configs) {
  733. var configsMap = {};
  734. var configTypeMap = {};
  735. var configMixin = App.get('config');
  736. App.router.get('configurationController').getConfigsByTags(serviceConfigTags).forEach(function (configSite) {
  737. $.extend(configsMap, configSite.properties);
  738. for (var name in configSite.properties) {
  739. configTypeMap[name] = configSite.type;
  740. }
  741. });
  742. configs.forEach(function (_config) {
  743. if (!Em.isNone(configsMap[_config.name])) {
  744. // prevent overriding already edited properties
  745. if (_config.defaultValue != configsMap[_config.name])
  746. _config.value = configsMap[_config.name];
  747. _config.defaultValue = configsMap[_config.name];
  748. _config.hasInitialValue = true;
  749. App.config.handleSpecialProperties(_config);
  750. delete configsMap[_config.name];
  751. }
  752. });
  753. this.setServiceDatabaseConfigs(configs);
  754. //add user properties
  755. for (var name in configsMap) {
  756. configs.push(configMixin.addUserProperty({
  757. id: 'site property',
  758. name: name,
  759. serviceName: configMixin.getServiceNameByConfigType(configTypeMap[name]),
  760. value: configsMap[name],
  761. defaultValue: configsMap[name],
  762. filename: (configMixin.get('filenameExceptions').contains(configTypeMap[name])) ? configTypeMap[name] : configTypeMap[name] + '.xml',
  763. category: 'Advanced',
  764. isUserProperty: true,
  765. isOverridable: true,
  766. overrides: [],
  767. isRequired: true,
  768. isVisible: true,
  769. showLabel: true
  770. }, false, []));
  771. }
  772. },
  773. /**
  774. * Check if Oozie or Hive use existing database then need
  775. * to restore missed properties
  776. *
  777. * @param {Object[]} configs
  778. **/
  779. setServiceDatabaseConfigs: function(configs) {
  780. var serviceNames = this.get('installedServiceNames').filter(function(serviceName) {
  781. return ['OOZIE', 'HIVE'].contains(serviceName);
  782. });
  783. serviceNames.forEach(function(serviceName) {
  784. var dbTypeConfig = configs.findProperty('name', serviceName.toLowerCase() + '_database');
  785. if (!/existing/gi.test(dbTypeConfig.value)) return;
  786. var dbHostName = serviceName.toLowerCase() + '_hostname';
  787. var database = dbTypeConfig.value.match(/MySQL|PostgreSQL|Oracle|Derby/gi)[0];
  788. var existingDBConfig = configs.findProperty('name', serviceName.toLowerCase() + '_existing_' + database.toLowerCase() + '_host');
  789. if (!existingDBConfig.value)
  790. existingDBConfig.value = existingDBConfig.defaultValue = configs.findProperty('name', dbHostName).value;
  791. }, this);
  792. },
  793. /**
  794. * Add group ids to <code>groupsToDelete</code>
  795. * Also save <code>groupsToDelete</code> to local storage
  796. * @param {Ember.Object[]} groups
  797. * @method setGroupsToDelete
  798. */
  799. setGroupsToDelete: function (groups) {
  800. var groupsToDelete = this.get('groupsToDelete');
  801. groups.forEach(function (group) {
  802. if (group.get('id'))
  803. groupsToDelete.push({
  804. id: group.get('id')
  805. });
  806. });
  807. this.get('wizardController').setDBProperty('groupsToDelete', groupsToDelete);
  808. },
  809. /**
  810. * Update <code>configGroups</code> with selected service configGroups
  811. * Also set default group to first position
  812. * Update <code>selectedConfigGroup</code> with new default group
  813. * @method selectedServiceObserver
  814. */
  815. selectedServiceObserver: function () {
  816. if (App.supports.hostOverridesInstaller && this.get('selectedService') && (this.get('selectedService.serviceName') !== 'MISC')) {
  817. var serviceGroups = this.get('selectedService.configGroups');
  818. serviceGroups.forEach(function (item, index, array) {
  819. if (item.isDefault) {
  820. array.unshift(item);
  821. array.splice(index + 1, 1);
  822. }
  823. });
  824. this.set('configGroups', serviceGroups);
  825. this.set('selectedConfigGroup', serviceGroups.findProperty('isDefault'));
  826. }
  827. }.observes('selectedService.configGroups.@each'),
  828. /**
  829. * load default groups for each service in case of initial load
  830. * @param serviceConfigGroups
  831. * @method loadConfigGroups
  832. */
  833. loadConfigGroups: function (serviceConfigGroups) {
  834. var services = this.get('stepConfigs');
  835. var hosts = this.get('wizardController.allHosts').mapProperty('hostName');
  836. services.forEach(function (service) {
  837. if (service.get('serviceName') === 'MISC') return;
  838. var serviceRawGroups = serviceConfigGroups.filterProperty('service.id', service.serviceName);
  839. if (!serviceRawGroups.length) {
  840. service.set('configGroups', [
  841. App.ConfigGroup.create({
  842. name: service.displayName + " Default",
  843. description: "Default cluster level " + service.serviceName + " configuration",
  844. isDefault: true,
  845. hosts: Em.copy(hosts),
  846. service: Em.Object.create({
  847. id: service.serviceName
  848. }),
  849. serviceName: service.serviceName
  850. })
  851. ]);
  852. }
  853. else {
  854. var defaultGroup = App.ConfigGroup.create(serviceRawGroups.findProperty('isDefault'));
  855. var serviceGroups = service.get('configGroups');
  856. serviceRawGroups.filterProperty('isDefault', false).forEach(function (configGroup) {
  857. var readyGroup = App.ConfigGroup.create(configGroup);
  858. var wrappedProperties = [];
  859. readyGroup.get('properties').forEach(function (property) {
  860. wrappedProperties.pushObject(App.ServiceConfigProperty.create(property));
  861. });
  862. wrappedProperties.setEach('group', readyGroup);
  863. readyGroup.set('properties', wrappedProperties);
  864. readyGroup.set('parentConfigGroup', defaultGroup);
  865. serviceGroups.pushObject(readyGroup);
  866. });
  867. defaultGroup.set('childConfigGroups', serviceGroups);
  868. serviceGroups.pushObject(defaultGroup);
  869. }
  870. });
  871. },
  872. /**
  873. * Click-handler on config-group to make it selected
  874. * @param {object} event
  875. * @method selectConfigGroup
  876. */
  877. selectConfigGroup: function (event) {
  878. this.set('selectedConfigGroup', event.context);
  879. },
  880. /**
  881. * Rebuild list of configs switch of config group:
  882. * on default - display all configs from default group and configs from non-default groups as disabled
  883. * on non-default - display all from default group as disabled and configs from selected non-default group
  884. * @method switchConfigGroupConfigs
  885. */
  886. switchConfigGroupConfigs: function () {
  887. var serviceConfigs = this.get('selectedService.configs'),
  888. selectedGroup = this.get('selectedConfigGroup'),
  889. overrideToAdd = this.get('overrideToAdd'),
  890. overrides = [];
  891. if (!selectedGroup) return;
  892. var displayedConfigGroups = this._getDisplayedConfigGroups();
  893. displayedConfigGroups.forEach(function (group) {
  894. overrides.pushObjects(group.get('properties'));
  895. });
  896. serviceConfigs.forEach(function (config) {
  897. this._setEditableValue(config);
  898. this._setOverrides(config, overrides);
  899. }, this);
  900. }.observes('selectedConfigGroup'),
  901. /**
  902. * Get list of config groups to display
  903. * Returns empty array if no <code>selectedConfigGroup</code>
  904. * @return {Array}
  905. * @method _getDisplayedConfigGroups
  906. */
  907. _getDisplayedConfigGroups: function () {
  908. var selectedGroup = this.get('selectedConfigGroup');
  909. if (!selectedGroup) return [];
  910. return (selectedGroup.get('isDefault')) ?
  911. this.get('selectedService.configGroups').filterProperty('isDefault', false) :
  912. [this.get('selectedConfigGroup')];
  913. },
  914. /**
  915. * Set <code>isEditable</code> property to <code>config</code>
  916. * @param {Ember.Object} config
  917. * @return {Ember.Object} updated config-object
  918. * @method _setEditableValue
  919. */
  920. _setEditableValue: function (config) {
  921. var selectedGroup = this.get('selectedConfigGroup');
  922. if (!selectedGroup) return config;
  923. var isEditable = config.get('isEditable'),
  924. isServiceInstalled = this.get('installedServiceNames').contains(this.get('selectedService.serviceName'));
  925. if (isServiceInstalled) {
  926. isEditable = (!isEditable && !config.get('isReconfigurable')) ? false : selectedGroup.get('isDefault');
  927. }
  928. else {
  929. isEditable = selectedGroup.get('isDefault');
  930. }
  931. config.set('isEditable', isEditable);
  932. return config;
  933. },
  934. /**
  935. * Set <code>overrides</code> property to <code>config</code>
  936. * @param {Ember.Object} config
  937. * @param {Ember.Enumerable} overrides
  938. * @returns {Ember.Object}
  939. * @method _setOverrides
  940. */
  941. _setOverrides: function (config, overrides) {
  942. var selectedGroup = this.get('selectedConfigGroup'),
  943. overrideToAdd = this.get('overrideToAdd'),
  944. configOverrides = overrides.filterProperty('name', config.get('name'));
  945. if (!selectedGroup) return config;
  946. if (overrideToAdd && overrideToAdd.get('name') === config.get('name')) {
  947. configOverrides.push(this.addOverrideProperty(config));
  948. this.set('overrideToAdd', null);
  949. }
  950. configOverrides.setEach('isEditable', !selectedGroup.get('isDefault'));
  951. configOverrides.setEach('parentSCP', config);
  952. config.set('overrides', configOverrides);
  953. return config;
  954. },
  955. /**
  956. * create overriden property and push it into Config group
  957. * @param {App.ServiceConfigProperty} serviceConfigProperty
  958. * @return {App.ServiceConfigProperty}
  959. * @method addOverrideProperty
  960. */
  961. addOverrideProperty: function (serviceConfigProperty) {
  962. var overrides = serviceConfigProperty.get('overrides') || [];
  963. var newSCP = App.ServiceConfigProperty.create(serviceConfigProperty);
  964. var group = this.get('selectedService.configGroups').findProperty('name', this.get('selectedConfigGroup.name'));
  965. newSCP.set('group', group);
  966. newSCP.set('value', '');
  967. newSCP.set('isOriginalSCP', false); // indicated this is overridden value,
  968. newSCP.set('parentSCP', serviceConfigProperty);
  969. newSCP.set('isEditable', true);
  970. group.get('properties').pushObject(newSCP);
  971. overrides.pushObject(newSCP);
  972. return newSCP;
  973. },
  974. /**
  975. * @method manageConfigurationGroup
  976. */
  977. manageConfigurationGroup: function () {
  978. App.router.get('mainServiceInfoConfigsController').manageConfigurationGroups(this);
  979. },
  980. /**
  981. * Make some configs visible depending on active services
  982. * @method activateSpecialConfigs
  983. */
  984. activateSpecialConfigs: function () {
  985. var miscConfigs = this.get('stepConfigs').findProperty('serviceName', 'MISC').configs;
  986. miscConfigs = App.config.miscConfigVisibleProperty(miscConfigs, this.get('selectedServiceNames'));
  987. },
  988. /**
  989. * Check whether hive New MySQL database is on the same host as Ambari server MySQL server
  990. * @return {$.ajax|null}
  991. * @method checkMySQLHost
  992. */
  993. checkMySQLHost: function () {
  994. // get ambari database type and hostname
  995. return App.ajax.send({
  996. name: 'config.ambari.database.info',
  997. sender: this,
  998. success: 'getAmbariDatabaseSuccess'
  999. });
  1000. },
  1001. /**
  1002. * Success callback for ambari database, get Ambari DB type and DB server hostname, then
  1003. * Check whether hive New MySQL database is on the same host as Ambari server MySQL server
  1004. * @param {object} data
  1005. * @method getAmbariDatabaseSuccess
  1006. */
  1007. getAmbariDatabaseSuccess: function (data) {
  1008. var hiveDBHostname = this.get('stepConfigs').findProperty('serviceName', 'HIVE').configs.findProperty('name', 'hivemetastore_host').value;
  1009. var ambariServiceHostComponents = data.hostComponents;
  1010. if (!!ambariServiceHostComponents.length) {
  1011. var ambariDBInfo = JSON.stringify(ambariServiceHostComponents[0].RootServiceHostComponents.properties);
  1012. this.set('mySQLServerConflict', ambariDBInfo.indexOf('mysql') > 0 && ambariDBInfo.indexOf(hiveDBHostname) > 0);
  1013. } else {
  1014. this.set('mySQLServerConflict', false);
  1015. }
  1016. },
  1017. /**
  1018. * Check if new MySql database was chosen for Hive service
  1019. * and it is not located on the same host as Ambari server
  1020. * that using MySql database too.
  1021. *
  1022. * @method resolveHiveMysqlDatabase
  1023. **/
  1024. resolveHiveMysqlDatabase: function () {
  1025. var hiveService = this.get('content.services').findProperty('serviceName', 'HIVE');
  1026. if (!hiveService || !hiveService.get('isSelected') || hiveService.get('isInstalled')) {
  1027. this.moveNext();
  1028. return;
  1029. }
  1030. var hiveDBType = this.get('stepConfigs').findProperty('serviceName', 'HIVE').configs.findProperty('name', 'hive_database').value;
  1031. if (hiveDBType == 'New MySQL Database') {
  1032. var self = this;
  1033. this.checkMySQLHost().done(function () {
  1034. if (self.get('mySQLServerConflict')) {
  1035. // error popup before you can proceed
  1036. return App.ModalPopup.show({
  1037. header: Em.I18n.t('installer.step7.popup.mySQLWarning.header'),
  1038. bodyClass: Ember.View.extend({
  1039. template: Ember.Handlebars.compile(Em.I18n.t('installer.step7.popup.mySQLWarning.body'))
  1040. }),
  1041. secondary: Em.I18n.t('installer.step7.popup.mySQLWarning.button.gotostep5'),
  1042. primary: Em.I18n.t('installer.step7.popup.mySQLWarning.button.dismiss'),
  1043. onSecondary: function () {
  1044. var parent = this;
  1045. return App.ModalPopup.show({
  1046. header: Em.I18n.t('installer.step7.popup.mySQLWarning.confirmation.header'),
  1047. bodyClass: Ember.View.extend({
  1048. template: Ember.Handlebars.compile(Em.I18n.t('installer.step7.popup.mySQLWarning.confirmation.body'))
  1049. }),
  1050. onPrimary: function () {
  1051. this.hide();
  1052. parent.hide();
  1053. // go back to step 5: assign masters and disable default navigation warning
  1054. App.router.get('installerController').gotoStep(5, true);
  1055. }
  1056. });
  1057. }
  1058. });
  1059. } else {
  1060. self.moveNext();
  1061. }
  1062. });
  1063. } else {
  1064. this.moveNext();
  1065. }
  1066. },
  1067. checkDatabaseConnectionTest: function () {
  1068. var deferred = $.Deferred();
  1069. if (!App.supports.databaseConnection) {
  1070. deferred.resolve();
  1071. return deferred;
  1072. }
  1073. var configMap = [
  1074. {
  1075. serviceName: 'OOZIE',
  1076. ignored: Em.I18n.t('installer.step7.oozie.database.new')
  1077. },
  1078. {
  1079. serviceName: 'HIVE',
  1080. ignored: Em.I18n.t('installer.step7.hive.database.new')
  1081. }
  1082. ];
  1083. configMap.forEach(function (config) {
  1084. var isConnectionNotTested = false;
  1085. var service = this.get('content.services').findProperty('serviceName', config.serviceName);
  1086. if (service && service.get('isSelected') && !service.get('isInstalled')) {
  1087. var serviceConfigs = this.get('stepConfigs').findProperty('serviceName', config.serviceName).configs;
  1088. var serviceDatabase = serviceConfigs.findProperty('name', config.serviceName.toLowerCase() + '_database').get('value');
  1089. if (serviceDatabase !== config.ignored) {
  1090. var filledProperties = App.db.get('tmp', config.serviceName + '_connection');
  1091. if (!filledProperties || App.isEmptyObject(filledProperties)) {
  1092. isConnectionNotTested = true;
  1093. } else {
  1094. for (var key in filledProperties) {
  1095. if (serviceConfigs.findProperty('name', key).get('value') !== filledProperties[key])
  1096. isConnectionNotTested = true;
  1097. }
  1098. }
  1099. }
  1100. }
  1101. config.isCheckIgnored = isConnectionNotTested;
  1102. }, this);
  1103. var ignoredServices = configMap.filterProperty('isCheckIgnored', true);
  1104. if (ignoredServices.length) {
  1105. var displayedServiceNames = ignoredServices.mapProperty('serviceName').map(function (serviceName) {
  1106. return this.get('content.services').findProperty('serviceName', serviceName).get('displayName');
  1107. }, this);
  1108. this.showDatabaseConnectionWarningPopup(displayedServiceNames, deferred);
  1109. }
  1110. else {
  1111. deferred.resolve();
  1112. }
  1113. return deferred;
  1114. },
  1115. showDatabaseConnectionWarningPopup: function (serviceNames, deferred) {
  1116. return App.ModalPopup.show({
  1117. header: Em.I18n.t('installer.step7.popup.database.connection.header'),
  1118. body: Em.I18n.t('installer.step7.popup.database.connection.body').format(serviceNames.join(', ')),
  1119. secondary: Em.I18n.t('common.cancel'),
  1120. primary: Em.I18n.t('common.proceedAnyway'),
  1121. onPrimary: function () {
  1122. deferred.resolve();
  1123. this._super();
  1124. },
  1125. onSecondary: function () {
  1126. deferred.reject();
  1127. this._super();
  1128. }
  1129. })
  1130. },
  1131. /**
  1132. * Proceed to the next step
  1133. **/
  1134. moveNext: function () {
  1135. App.router.send('next');
  1136. },
  1137. /**
  1138. * Click-handler on Next button
  1139. * @method submit
  1140. */
  1141. submit: function () {
  1142. var _this = this;
  1143. if (!this.get('isSubmitDisabled')) {
  1144. this.checkDatabaseConnectionTest().done(function () {
  1145. _this.resolveHiveMysqlDatabase();
  1146. });
  1147. }
  1148. }
  1149. });