step7_controller.js 44 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241
  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.indexOf(site) > -1) {
  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('isSelected').filter(function (service) {
  707. installedServiceSites = installedServiceSites.concat(service.get('configTypes'));
  708. }, this);
  709. installedServiceSites = installedServiceSites.uniq();
  710. var serviceConfigTags = [];
  711. for (var site in data.Clusters.desired_configs) {
  712. if (data.Clusters.desired_configs.hasOwnProperty(site)) {
  713. if (installedServiceSites.contains(site)) {
  714. serviceConfigTags.push({
  715. siteName: site,
  716. tagName: data.Clusters.desired_configs[site].tag,
  717. newTagName: null
  718. });
  719. }
  720. }
  721. }
  722. this.set('serviceConfigTags', serviceConfigTags);
  723. this.set('isAppliedConfigLoaded', true);
  724. },
  725. /**
  726. * set configs actual values from server
  727. * @param serviceConfigTags
  728. * @param configs
  729. * @method setInstalledServiceConfigs
  730. */
  731. setInstalledServiceConfigs: function (serviceConfigTags, configs) {
  732. var configsMap = {};
  733. var configTypeMap = {};
  734. var configMixin = App.get('config');
  735. App.router.get('configurationController').getConfigsByTags(serviceConfigTags).forEach(function (configSite) {
  736. $.extend(configsMap, configSite.properties);
  737. for (var name in configSite.properties) {
  738. configTypeMap[name] = configSite.type;
  739. }
  740. });
  741. configs.forEach(function (_config) {
  742. if (!Em.isNone(configsMap[_config.name])) {
  743. // prevent overriding already edited properties
  744. if (_config.defaultValue != configsMap[_config.name])
  745. _config.value = configsMap[_config.name];
  746. _config.defaultValue = configsMap[_config.name];
  747. _config.hasInitialValue = true;
  748. App.config.handleSpecialProperties(_config);
  749. delete configsMap[_config.name];
  750. }
  751. });
  752. this.setServiceDatabaseConfigs(configs);
  753. //add user properties
  754. for (var name in configsMap) {
  755. configs.push(configMixin.addUserProperty({
  756. id: 'site property',
  757. name: name,
  758. serviceName: configMixin.getServiceNameByConfigType(configTypeMap[name]),
  759. value: configsMap[name],
  760. defaultValue: configsMap[name],
  761. filename: (configMixin.get('filenameExceptions').contains(configTypeMap[name])) ? configTypeMap[name] : configTypeMap[name] + '.xml',
  762. category: 'Advanced',
  763. isUserProperty: true,
  764. isOverridable: true,
  765. overrides: [],
  766. isRequired: true,
  767. isVisible: true,
  768. showLabel: true
  769. }, false, []));
  770. }
  771. },
  772. /**
  773. * Check if Oozie or Hive use existing database then need
  774. * to restore missed properties
  775. *
  776. * @param {Object[]} configs
  777. **/
  778. setServiceDatabaseConfigs: function(configs) {
  779. var serviceNames = this.get('installedServiceNames').filter(function(serviceName) {
  780. return ['OOZIE', 'HIVE'].contains(serviceName);
  781. });
  782. serviceNames.forEach(function(serviceName) {
  783. var dbTypeConfig = configs.findProperty('name', serviceName.toLowerCase() + '_database');
  784. if (!/existing/gi.test(dbTypeConfig.value)) return;
  785. var dbHostName = serviceName.toLowerCase() + '_hostname';
  786. var database = dbTypeConfig.value.match(/MySQL|PostgreSQL|Oracle|Derby/gi)[0];
  787. var existingDBConfig = configs.findProperty('name', serviceName.toLowerCase() + '_existing_' + database.toLowerCase() + '_host');
  788. if (!existingDBConfig.value)
  789. existingDBConfig.value = existingDBConfig.defaultValue = configs.findProperty('name', dbHostName).value;
  790. }, this);
  791. },
  792. /**
  793. * Add group ids to <code>groupsToDelete</code>
  794. * Also save <code>groupsToDelete</code> to local storage
  795. * @param {Ember.Object[]} groups
  796. * @method setGroupsToDelete
  797. */
  798. setGroupsToDelete: function (groups) {
  799. var groupsToDelete = this.get('groupsToDelete');
  800. groups.forEach(function (group) {
  801. if (group.get('id'))
  802. groupsToDelete.push({
  803. id: group.get('id')
  804. });
  805. });
  806. this.get('wizardController').setDBProperty('groupsToDelete', groupsToDelete);
  807. },
  808. /**
  809. * Update <code>configGroups</code> with selected service configGroups
  810. * Also set default group to first position
  811. * Update <code>selectedConfigGroup</code> with new default group
  812. * @method selectedServiceObserver
  813. */
  814. selectedServiceObserver: function () {
  815. if (App.supports.hostOverridesInstaller && this.get('selectedService') && (this.get('selectedService.serviceName') !== 'MISC')) {
  816. var serviceGroups = this.get('selectedService.configGroups');
  817. serviceGroups.forEach(function (item, index, array) {
  818. if (item.isDefault) {
  819. array.unshift(item);
  820. array.splice(index + 1, 1);
  821. }
  822. });
  823. this.set('configGroups', serviceGroups);
  824. this.set('selectedConfigGroup', serviceGroups.findProperty('isDefault'));
  825. }
  826. }.observes('selectedService.configGroups.@each'),
  827. /**
  828. * load default groups for each service in case of initial load
  829. * @param serviceConfigGroups
  830. * @method loadConfigGroups
  831. */
  832. loadConfigGroups: function (serviceConfigGroups) {
  833. var services = this.get('stepConfigs');
  834. var hosts = this.get('wizardController.allHosts').mapProperty('hostName');
  835. services.forEach(function (service) {
  836. if (service.get('serviceName') === 'MISC') return;
  837. var serviceRawGroups = serviceConfigGroups.filterProperty('service.id', service.serviceName);
  838. if (!serviceRawGroups.length) {
  839. service.set('configGroups', [
  840. App.ConfigGroup.create({
  841. name: service.displayName + " Default",
  842. description: "Default cluster level " + service.serviceName + " configuration",
  843. isDefault: true,
  844. hosts: Em.copy(hosts),
  845. service: Em.Object.create({
  846. id: service.serviceName
  847. }),
  848. serviceName: service.serviceName
  849. })
  850. ]);
  851. }
  852. else {
  853. var defaultGroup = App.ConfigGroup.create(serviceRawGroups.findProperty('isDefault'));
  854. var serviceGroups = service.get('configGroups');
  855. serviceRawGroups.filterProperty('isDefault', false).forEach(function (configGroup) {
  856. var readyGroup = App.ConfigGroup.create(configGroup);
  857. var wrappedProperties = [];
  858. readyGroup.get('properties').forEach(function (property) {
  859. wrappedProperties.pushObject(App.ServiceConfigProperty.create(property));
  860. });
  861. wrappedProperties.setEach('group', readyGroup);
  862. readyGroup.set('properties', wrappedProperties);
  863. readyGroup.set('parentConfigGroup', defaultGroup);
  864. serviceGroups.pushObject(readyGroup);
  865. });
  866. defaultGroup.set('childConfigGroups', serviceGroups);
  867. serviceGroups.pushObject(defaultGroup);
  868. }
  869. });
  870. },
  871. /**
  872. * Click-handler on config-group to make it selected
  873. * @param {object} event
  874. * @method selectConfigGroup
  875. */
  876. selectConfigGroup: function (event) {
  877. this.set('selectedConfigGroup', event.context);
  878. },
  879. /**
  880. * Rebuild list of configs switch of config group:
  881. * on default - display all configs from default group and configs from non-default groups as disabled
  882. * on non-default - display all from default group as disabled and configs from selected non-default group
  883. * @method switchConfigGroupConfigs
  884. */
  885. switchConfigGroupConfigs: function () {
  886. var serviceConfigs = this.get('selectedService.configs'),
  887. selectedGroup = this.get('selectedConfigGroup'),
  888. overrideToAdd = this.get('overrideToAdd'),
  889. overrides = [];
  890. if (!selectedGroup) return;
  891. var displayedConfigGroups = this._getDisplayedConfigGroups();
  892. displayedConfigGroups.forEach(function (group) {
  893. overrides.pushObjects(group.get('properties'));
  894. });
  895. serviceConfigs.forEach(function (config) {
  896. this._setEditableValue(config);
  897. this._setOverrides(config, overrides);
  898. }, this);
  899. }.observes('selectedConfigGroup'),
  900. /**
  901. * Get list of config groups to display
  902. * Returns empty array if no <code>selectedConfigGroup</code>
  903. * @return {Array}
  904. * @method _getDisplayedConfigGroups
  905. */
  906. _getDisplayedConfigGroups: function () {
  907. var selectedGroup = this.get('selectedConfigGroup');
  908. if (!selectedGroup) return [];
  909. return (selectedGroup.get('isDefault')) ?
  910. this.get('selectedService.configGroups').filterProperty('isDefault', false) :
  911. [this.get('selectedConfigGroup')];
  912. },
  913. /**
  914. * Set <code>isEditable</code> property to <code>config</code>
  915. * @param {Ember.Object} config
  916. * @return {Ember.Object} updated config-object
  917. * @method _setEditableValue
  918. */
  919. _setEditableValue: function (config) {
  920. var selectedGroup = this.get('selectedConfigGroup');
  921. if (!selectedGroup) return config;
  922. var isEditable = config.get('isEditable'),
  923. isServiceInstalled = this.get('installedServiceNames').contains(this.get('selectedService.serviceName'));
  924. if (isServiceInstalled) {
  925. isEditable = (!isEditable && !config.get('isReconfigurable')) ? false : selectedGroup.get('isDefault');
  926. }
  927. else {
  928. isEditable = selectedGroup.get('isDefault');
  929. }
  930. config.set('isEditable', isEditable);
  931. return config;
  932. },
  933. /**
  934. * Set <code>overrides</code> property to <code>config</code>
  935. * @param {Ember.Object} config
  936. * @param {Ember.Enumerable} overrides
  937. * @returns {Ember.Object}
  938. * @method _setOverrides
  939. */
  940. _setOverrides: function (config, overrides) {
  941. var selectedGroup = this.get('selectedConfigGroup'),
  942. overrideToAdd = this.get('overrideToAdd'),
  943. configOverrides = overrides.filterProperty('name', config.get('name'));
  944. if (!selectedGroup) return config;
  945. if (overrideToAdd && overrideToAdd.get('name') === config.get('name')) {
  946. configOverrides.push(this.addOverrideProperty(config));
  947. this.set('overrideToAdd', null);
  948. }
  949. configOverrides.setEach('isEditable', !selectedGroup.get('isDefault'));
  950. configOverrides.setEach('parentSCP', config);
  951. config.set('overrides', configOverrides);
  952. return config;
  953. },
  954. /**
  955. * create overriden property and push it into Config group
  956. * @param {App.ServiceConfigProperty} serviceConfigProperty
  957. * @return {App.ServiceConfigProperty}
  958. * @method addOverrideProperty
  959. */
  960. addOverrideProperty: function (serviceConfigProperty) {
  961. var overrides = serviceConfigProperty.get('overrides') || [];
  962. var newSCP = App.ServiceConfigProperty.create(serviceConfigProperty);
  963. var group = this.get('selectedService.configGroups').findProperty('name', this.get('selectedConfigGroup.name'));
  964. newSCP.set('group', group);
  965. newSCP.set('value', '');
  966. newSCP.set('isOriginalSCP', false); // indicated this is overridden value,
  967. newSCP.set('parentSCP', serviceConfigProperty);
  968. newSCP.set('isEditable', true);
  969. group.get('properties').pushObject(newSCP);
  970. overrides.pushObject(newSCP);
  971. return newSCP;
  972. },
  973. /**
  974. * @method manageConfigurationGroup
  975. */
  976. manageConfigurationGroup: function () {
  977. App.router.get('mainServiceInfoConfigsController').manageConfigurationGroups(this);
  978. },
  979. /**
  980. * Make some configs visible depending on active services
  981. * @method activateSpecialConfigs
  982. */
  983. activateSpecialConfigs: function () {
  984. var miscConfigs = this.get('stepConfigs').findProperty('serviceName', 'MISC').configs;
  985. miscConfigs = App.config.miscConfigVisibleProperty(miscConfigs, this.get('selectedServiceNames'));
  986. },
  987. /**
  988. * Check whether hive New MySQL database is on the same host as Ambari server MySQL server
  989. * @return {$.ajax|null}
  990. * @method checkMySQLHost
  991. */
  992. checkMySQLHost: function () {
  993. // get ambari database type and hostname
  994. return App.ajax.send({
  995. name: 'config.ambari.database.info',
  996. sender: this,
  997. success: 'getAmbariDatabaseSuccess'
  998. });
  999. },
  1000. /**
  1001. * Success callback for ambari database, get Ambari DB type and DB server hostname, then
  1002. * Check whether hive New MySQL database is on the same host as Ambari server MySQL server
  1003. * @param {object} data
  1004. * @method getAmbariDatabaseSuccess
  1005. */
  1006. getAmbariDatabaseSuccess: function (data) {
  1007. var hiveDBHostname = this.get('stepConfigs').findProperty('serviceName', 'HIVE').configs.findProperty('name', 'hivemetastore_host').value;
  1008. var ambariServiceHostComponents = data.hostComponents;
  1009. if (!!ambariServiceHostComponents.length) {
  1010. var ambariDBInfo = JSON.stringify(ambariServiceHostComponents[0].RootServiceHostComponents.properties);
  1011. this.set('mySQLServerConflict', ambariDBInfo.indexOf('mysql') > 0 && ambariDBInfo.indexOf(hiveDBHostname) > 0);
  1012. } else {
  1013. this.set('mySQLServerConflict', false);
  1014. }
  1015. },
  1016. /**
  1017. * Check if new MySql database was chosen for Hive service
  1018. * and it is not located on the same host as Ambari server
  1019. * that using MySql database too.
  1020. *
  1021. * @method resolveHiveMysqlDatabase
  1022. **/
  1023. resolveHiveMysqlDatabase: function () {
  1024. var hiveService = this.get('content.services').findProperty('serviceName', 'HIVE');
  1025. if (!hiveService || !hiveService.get('isSelected') || hiveService.get('isInstalled')) {
  1026. this.moveNext();
  1027. return;
  1028. }
  1029. var hiveDBType = this.get('stepConfigs').findProperty('serviceName', 'HIVE').configs.findProperty('name', 'hive_database').value;
  1030. if (hiveDBType == 'New MySQL Database') {
  1031. var self = this;
  1032. this.checkMySQLHost().done(function () {
  1033. if (self.get('mySQLServerConflict')) {
  1034. // error popup before you can proceed
  1035. return App.ModalPopup.show({
  1036. header: Em.I18n.t('installer.step7.popup.mySQLWarning.header'),
  1037. bodyClass: Ember.View.extend({
  1038. template: Ember.Handlebars.compile(Em.I18n.t('installer.step7.popup.mySQLWarning.body'))
  1039. }),
  1040. secondary: Em.I18n.t('installer.step7.popup.mySQLWarning.button.gotostep5'),
  1041. primary: Em.I18n.t('installer.step7.popup.mySQLWarning.button.dismiss'),
  1042. onSecondary: function () {
  1043. var parent = this;
  1044. return App.ModalPopup.show({
  1045. header: Em.I18n.t('installer.step7.popup.mySQLWarning.confirmation.header'),
  1046. bodyClass: Ember.View.extend({
  1047. template: Ember.Handlebars.compile(Em.I18n.t('installer.step7.popup.mySQLWarning.confirmation.body'))
  1048. }),
  1049. onPrimary: function () {
  1050. this.hide();
  1051. parent.hide();
  1052. // go back to step 5: assign masters and disable default navigation warning
  1053. App.router.get('installerController').gotoStep(5, true);
  1054. }
  1055. });
  1056. }
  1057. });
  1058. } else {
  1059. self.moveNext();
  1060. }
  1061. });
  1062. } else {
  1063. this.moveNext();
  1064. }
  1065. },
  1066. checkDatabaseConnectionTest: function () {
  1067. var deferred = $.Deferred();
  1068. if (!App.supports.databaseConnection) {
  1069. deferred.resolve();
  1070. return deferred;
  1071. }
  1072. var configMap = [
  1073. {
  1074. serviceName: 'OOZIE',
  1075. ignored: Em.I18n.t('installer.step7.oozie.database.new')
  1076. },
  1077. {
  1078. serviceName: 'HIVE',
  1079. ignored: Em.I18n.t('installer.step7.hive.database.new')
  1080. }
  1081. ];
  1082. configMap.forEach(function (config) {
  1083. var isConnectionNotTested = false;
  1084. var service = this.get('content.services').findProperty('serviceName', config.serviceName);
  1085. if (service && service.get('isSelected') && !service.get('isInstalled')) {
  1086. var serviceConfigs = this.get('stepConfigs').findProperty('serviceName', config.serviceName).configs;
  1087. var serviceDatabase = serviceConfigs.findProperty('name', config.serviceName.toLowerCase() + '_database').get('value');
  1088. if (serviceDatabase !== config.ignored) {
  1089. var filledProperties = App.db.get('tmp', config.serviceName + '_connection');
  1090. if (!filledProperties || App.isEmptyObject(filledProperties)) {
  1091. isConnectionNotTested = true;
  1092. } else {
  1093. for (var key in filledProperties) {
  1094. if (serviceConfigs.findProperty('name', key).get('value') !== filledProperties[key])
  1095. isConnectionNotTested = true;
  1096. }
  1097. }
  1098. }
  1099. }
  1100. config.isCheckIgnored = isConnectionNotTested;
  1101. }, this);
  1102. var ignoredServices = configMap.filterProperty('isCheckIgnored', true);
  1103. if (ignoredServices.length) {
  1104. var displayedServiceNames = ignoredServices.mapProperty('serviceName').map(function (serviceName) {
  1105. return this.get('content.services').findProperty('serviceName', serviceName).get('displayName');
  1106. }, this);
  1107. this.showDatabaseConnectionWarningPopup(displayedServiceNames, deferred);
  1108. }
  1109. else {
  1110. deferred.resolve();
  1111. }
  1112. return deferred;
  1113. },
  1114. showDatabaseConnectionWarningPopup: function (serviceNames, deferred) {
  1115. return App.ModalPopup.show({
  1116. header: Em.I18n.t('installer.step7.popup.database.connection.header'),
  1117. body: Em.I18n.t('installer.step7.popup.database.connection.body').format(serviceNames.join(', ')),
  1118. secondary: Em.I18n.t('common.cancel'),
  1119. primary: Em.I18n.t('common.proceedAnyway'),
  1120. onPrimary: function () {
  1121. deferred.resolve();
  1122. this._super();
  1123. },
  1124. onSecondary: function () {
  1125. deferred.reject();
  1126. this._super();
  1127. }
  1128. })
  1129. },
  1130. /**
  1131. * Proceed to the next step
  1132. **/
  1133. moveNext: function () {
  1134. App.router.send('next');
  1135. },
  1136. /**
  1137. * Click-handler on Next button
  1138. * @method submit
  1139. */
  1140. submit: function () {
  1141. var _this = this;
  1142. if (!this.get('isSubmitDisabled')) {
  1143. this.checkDatabaseConnectionTest().done(function () {
  1144. _this.resolveHiveMysqlDatabase();
  1145. });
  1146. }
  1147. }
  1148. });