step7_controller.js 44 KB

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