step7_controller.js 63 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711
  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. /**
  20. * By Step 7, we have the following information stored in App.db and set on this
  21. * controller by the router.
  22. *
  23. * selectedServices: App.db.selectedServices (the services that the user selected in Step 4)
  24. * masterComponentHosts: App.db.masterComponentHosts (master-components-to-hosts mapping the user selected in Step 5)
  25. * slaveComponentHosts: App.db.slaveComponentHosts (slave-components-to-hosts mapping the user selected in Step 6)
  26. *
  27. */
  28. /**
  29. * @typedef {object} masterComponentHost
  30. * @property {string} component
  31. * @property {string} hostName
  32. * @property {boolean} isInstalled is component already installed on the this host or just going to be installed
  33. */
  34. /**
  35. * @typedef {object} topologyLocalDB
  36. * @property {object[]} hosts list of hosts with information of their disks usage and dirs
  37. * @property {masterComponentHost[]} masterComponentHosts
  38. * @property {?object[]} slaveComponentHosts
  39. */
  40. App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.EnhancedConfigsMixin, App.ToggleIsRequiredMixin, {
  41. name: 'wizardStep7Controller',
  42. /**
  43. * Contains all field properties that are viewed in this step
  44. * @type {object[]}
  45. */
  46. stepConfigs: [],
  47. hash: null,
  48. selectedService: null,
  49. slaveHostToGroup: null,
  50. addMiscTabToPage: true,
  51. /**
  52. * Is Submit-click processing now
  53. * @type {bool}
  54. */
  55. submitButtonClicked: false,
  56. isRecommendedLoaded: false,
  57. /**
  58. * used in services_config.js view to mark a config with security icon
  59. */
  60. secureConfigs: require('data/HDP2/secure_mapping'),
  61. /**
  62. * If configChangeObserver Modal is shown
  63. * @type {bool}
  64. */
  65. miscModalVisible: false,
  66. overrideToAdd: null,
  67. /**
  68. * Is installer controller used
  69. * @type {bool}
  70. */
  71. isInstaller: true,
  72. /**
  73. * List of config groups
  74. * @type {object[]}
  75. */
  76. configGroups: [],
  77. /**
  78. * List of config group to be deleted
  79. * @type {object[]}
  80. */
  81. groupsToDelete: [],
  82. preSelectedConfigGroup: null,
  83. /**
  84. * Currently selected config group
  85. * @type {object}
  86. */
  87. selectedConfigGroup: null,
  88. /**
  89. * Config tags of actually installed services
  90. * @type {array}
  91. */
  92. serviceConfigTags: [],
  93. /**
  94. * Are applied to service configs loaded
  95. * @type {bool}
  96. */
  97. isAppliedConfigLoaded: true,
  98. isConfigsLoaded: Em.computed.and('wizardController.stackConfigsLoaded', 'isAppliedConfigLoaded'),
  99. /**
  100. * PreInstall Checks allowed only for Install
  101. * @type {boolean}
  102. */
  103. supportsPreInstallChecks: function () {
  104. return App.get('supports.preInstallChecks') && 'installerController' === this.get('content.controllerName');
  105. }.property('App.supports.preInstallChecks', 'wizardController.name'),
  106. /**
  107. * Number of errors in the configs in the selected service
  108. * @type {number}
  109. */
  110. errorsCount: function() {
  111. return this.get('selectedService.configsWithErrors').filter(function(c) {
  112. return Em.isNone(c.get('widget'));
  113. }).length;
  114. }.property('selectedService.configsWithErrors.length'),
  115. /**
  116. * Should Next-button be disabled
  117. * @type {bool}
  118. */
  119. isSubmitDisabled: function () {
  120. if (!this.get('stepConfigs.length')) return true;
  121. if (this.get('submitButtonClicked')) return true;
  122. return (!this.get('stepConfigs').filterProperty('showConfig', true).everyProperty('errorCount', 0) || this.get("miscModalVisible"));
  123. }.property('stepConfigs.@each.errorCount', 'miscModalVisible', 'submitButtonClicked'),
  124. /**
  125. * List of selected to install service names
  126. * @type {string[]}
  127. */
  128. selectedServiceNames: function () {
  129. return this.get('content.services').filterProperty('isSelected', true).filterProperty('isInstalled', false).mapProperty('serviceName');
  130. }.property('content.services', 'content.services.@each.isSelected', 'content.services.@each.isInstalled', 'content.stacks.@each.isSelected').cacheable(),
  131. /**
  132. * List of installed and selected to install service names
  133. * @type {string[]}
  134. */
  135. allSelectedServiceNames: function () {
  136. return this.get('content.services').filter(function (service) {
  137. return service.get('isInstalled') || service.get('isSelected');
  138. }).mapProperty('serviceName');
  139. }.property('content.services', 'content.services.@each.isSelected', 'content.services.@each.isInstalled', 'content.stacks.@each.isSelected').cacheable(),
  140. /**
  141. * List of installed service names
  142. * @type {string[]}
  143. */
  144. installedServiceNames: function () {
  145. var serviceNames = this.get('content.services').filterProperty('isInstalled').mapProperty('serviceName');
  146. if (this.get('content.controllerName') !== 'installerController') {
  147. serviceNames = serviceNames.filter(function (_serviceName) {
  148. return !App.get('services.noConfigTypes').contains(_serviceName);
  149. });
  150. }
  151. return serviceNames;
  152. }.property('content.services').cacheable(),
  153. installedServices: function () {
  154. return App.StackService.find().toArray().toMapByCallback('serviceName', function (item) {
  155. return Em.get(item, 'isInstalled');
  156. });
  157. }.property(),
  158. /**
  159. * List of master components
  160. * @type {Ember.Enumerable}
  161. */
  162. masterComponentHosts: Em.computed.alias('content.masterComponentHosts'),
  163. /**
  164. * List of slave components
  165. * @type {Ember.Enumerable}
  166. */
  167. slaveComponentHosts: Em.computed.alias('content.slaveGroupProperties'),
  168. customData: [],
  169. /**
  170. * Filter text will be located here
  171. * @type {string}
  172. */
  173. filter: '',
  174. /**
  175. * list of dependencies that are user to set init value of config
  176. *
  177. * @type {Object}
  178. */
  179. configDependencies: function() {
  180. var dependencies = {
  181. 'sliderSelected': this.get('allSelectedServiceNames').contains('SLIDER')
  182. };
  183. var hiveMetastore = App.configsCollection.getConfigByName('hive.metastore.uris', 'hive-site.xml');
  184. var clientPort = App.configsCollection.getConfigByName('clientPort', 'zoo.cfg.xml');
  185. if (hiveMetastore) dependencies['hive.metastore.uris'] = hiveMetastore.recommendedValue;
  186. if (clientPort) dependencies['clientPort'] = clientPort.recommendedValue;
  187. return dependencies
  188. }.property('allSelectedServiceNames'),
  189. /**
  190. * List of filters for config properties to populate filter combobox
  191. */
  192. propertyFilters: [
  193. {
  194. attributeName: 'isOverridden',
  195. attributeValue: true,
  196. caption: 'common.combobox.dropdown.overridden'
  197. },
  198. {
  199. attributeName: 'isFinal',
  200. attributeValue: true,
  201. caption: 'common.combobox.dropdown.final'
  202. },
  203. {
  204. attributeName: 'hasIssues',
  205. attributeValue: true,
  206. caption: 'common.combobox.dropdown.issues'
  207. }
  208. ],
  209. issuesFilterText: function () {
  210. return (this.get('isSubmitDisabled') && !this.get('submitButtonClicked') &&
  211. this.get('filterColumns').findProperty('attributeName', 'hasIssues').get('selected')) ?
  212. Em.I18n.t('installer.step7.showingPropertiesWithIssues') : '';
  213. }.property('isSubmitDisabled', 'submitButtonClicked', 'filterColumns.@each.selected'),
  214. issuesFilterLinkText: function () {
  215. if (this.get('filterColumns').findProperty('attributeName', 'hasIssues').get('selected')) {
  216. return Em.I18n.t('installer.step7.showAllProperties');
  217. }
  218. return (this.get('isSubmitDisabled') && !this.get('submitButtonClicked')) ?
  219. (
  220. this.get('filterColumns').findProperty('attributeName', 'hasIssues').get('selected') ?
  221. Em.I18n.t('installer.step7.showAllProperties') : Em.I18n.t('installer.step7.showPropertiesWithIssues')
  222. ) : '';
  223. }.property('isSubmitDisabled', 'submitButtonClicked', 'filterColumns.@each.selected'),
  224. /**
  225. * Dropdown menu items in filter combobox
  226. */
  227. filterColumns: function () {
  228. return this.get('propertyFilters').map(function (filter) {
  229. return Ember.Object.create({
  230. attributeName: filter.attributeName,
  231. attributeValue: filter.attributeValue,
  232. name: this.t(filter.caption),
  233. selected: false
  234. });
  235. }, this);
  236. }.property('propertyFilters'),
  237. /**
  238. * Clear controller's properties:
  239. * <ul>
  240. * <li>stepConfigs</li>
  241. * <li>filter</li>
  242. * </ul>
  243. * and desect all <code>filterColumns</code>
  244. * @method clearStep
  245. */
  246. clearStep: function () {
  247. this.setProperties({
  248. configValidationGlobalMessage: [],
  249. submitButtonClicked: false,
  250. isSubmitDisabled: true,
  251. isRecommendedLoaded: false
  252. });
  253. this.get('stepConfigs').clear();
  254. this.set('filter', '');
  255. this.get('filterColumns').setEach('selected', false);
  256. },
  257. /**
  258. * Generate "finger-print" for current <code>stepConfigs[0]</code>
  259. * Used to determine, if user has some unsaved changes (comparing with <code>hash</code>)
  260. * @returns {string|null}
  261. * @method getHash
  262. */
  263. getHash: function () {
  264. if (!this.get('stepConfigs')[0]) {
  265. return null;
  266. }
  267. var hash = {};
  268. this.get('stepConfigs').forEach(function(stepConfig){
  269. stepConfig.configs.forEach(function (config) {
  270. hash[config.get('name')] = {value: config.get('value'), overrides: [], isFinal: config.get('isFinal')};
  271. if (!config.get('overrides')) return;
  272. if (!config.get('overrides.length')) return;
  273. config.get('overrides').forEach(function (override) {
  274. hash[config.get('name')].overrides.push(override.get('value'));
  275. });
  276. });
  277. });
  278. return JSON.stringify(hash);
  279. },
  280. /**
  281. * Are some changes available
  282. */
  283. hasChanges: function () {
  284. return this.get('hash') != this.getHash();
  285. },
  286. /**
  287. * Load config groups for installed services
  288. * One ajax-request for each service
  289. * @param {string[]} servicesNames
  290. * @method loadInstalledServicesConfigGroups
  291. */
  292. loadInstalledServicesConfigGroups: function (servicesNames) {
  293. servicesNames.forEach(function (serviceName) {
  294. App.ajax.send({
  295. name: 'config.tags_and_groups',
  296. sender: this,
  297. data: {
  298. serviceName: serviceName,
  299. serviceConfigsDef: App.config.get('preDefinedServiceConfigs').findProperty('serviceName', serviceName)
  300. },
  301. success: 'loadServiceTagsSuccess'
  302. });
  303. }, this);
  304. },
  305. /**
  306. * Create site to tag map. Format:
  307. * <code>
  308. * {
  309. * site1: tag1,
  310. * site1: tag2,
  311. * site2: tag3
  312. * ...
  313. * }
  314. * </code>
  315. * @param {object} desired_configs
  316. * @param {string[]} sites
  317. * @returns {object}
  318. * @private
  319. * @method _createSiteToTagMap
  320. */
  321. _createSiteToTagMap: function (desired_configs, sites) {
  322. var siteToTagMap = {};
  323. for (var site in desired_configs) {
  324. if (desired_configs.hasOwnProperty(site)) {
  325. if (!!sites[site]) {
  326. siteToTagMap[site] = desired_configs[site].tag;
  327. }
  328. }
  329. }
  330. return siteToTagMap;
  331. },
  332. /**
  333. * Load config groups success callback
  334. * @param {object} data
  335. * @param {object} opt
  336. * @param {object} params
  337. * @method loadServiceTagsSuccess
  338. */
  339. loadServiceTagsSuccess: function (data, opt, params) {
  340. var serviceName = params.serviceName,
  341. service = this.get('stepConfigs').findProperty('serviceName', serviceName),
  342. defaultConfigGroupHosts = this.get('wizardController.allHosts').mapProperty('hostName'),
  343. siteToTagMap = this._createSiteToTagMap(data.Clusters.desired_configs, params.serviceConfigsDef.get('configTypes'));
  344. this.set('loadedClusterSiteToTagMap', siteToTagMap);
  345. //parse loaded config groups
  346. var configGroups = [];
  347. if (data.config_groups.length) {
  348. data.config_groups.forEach(function (item) {
  349. item = item.ConfigGroup;
  350. if (item.tag === serviceName) {
  351. var groupHosts = item.hosts.mapProperty('host_name');
  352. configGroups.push({
  353. id: serviceName + item.id,
  354. config_group_id: item.id,
  355. name: item.group_name,
  356. description: item.description,
  357. is_default: false,
  358. parent_config_group_id: App.ServiceConfigGroup.getParentConfigGroupId(serviceName),
  359. service_id: serviceName,
  360. service_name: serviceName,
  361. hosts: groupHosts,
  362. desired_configs: item.desired_configs
  363. });
  364. groupHosts.forEach(function (host) {
  365. defaultConfigGroupHosts = defaultConfigGroupHosts.without(host);
  366. }, this);
  367. }
  368. }, this);
  369. }
  370. var defaultConfigGroup = App.configGroupsMapper.generateDefaultGroup(serviceName, defaultConfigGroupHosts);
  371. configGroups = configGroups.sortProperty('name');
  372. configGroups.unshift(defaultConfigGroup);
  373. App.store.loadMany(App.ServiceConfigGroup, configGroups);
  374. App.store.commit();
  375. service.set('configGroups', App.ServiceConfigGroup.find().filterProperty('serviceName', serviceName));
  376. var loadedGroupToOverrideSiteToTagMap = {};
  377. configGroups.forEach(function (item) {
  378. var groupName = item.name;
  379. loadedGroupToOverrideSiteToTagMap[groupName] = {};
  380. item.desired_configs.forEach(function (site) {
  381. loadedGroupToOverrideSiteToTagMap[groupName][site.type] = site.tag;
  382. }, this);
  383. }, this);
  384. this.set('preSelectedConfigGroup', App.ServiceConfigGroup.find(App.ServiceConfigGroup.getParentConfigGroupId(serviceName)));
  385. this.loadServiceConfigGroupOverrides(service.get('configs'), loadedGroupToOverrideSiteToTagMap, service.get('configGroups'));
  386. },
  387. /**
  388. * Get properties from server by type and tag with properties, that belong to group
  389. * push them to common {serviceConfigs} and call callback function
  390. */
  391. loadServiceConfigGroupOverrides: function (serviceConfigs, loadedGroupToOverrideSiteToTagMap, configGroups) {
  392. var configKeyToConfigMap = {};
  393. serviceConfigs.forEach(function (item) {
  394. if (!configKeyToConfigMap[item.filename]) {
  395. configKeyToConfigMap[item.filename] = {};
  396. }
  397. configKeyToConfigMap[item.filename][item.name] = item;
  398. });
  399. var typeTagToGroupMap = {};
  400. var urlParams = [];
  401. for (var group in loadedGroupToOverrideSiteToTagMap) {
  402. var overrideTypeTags = loadedGroupToOverrideSiteToTagMap[group];
  403. for (var type in overrideTypeTags) {
  404. var tag = overrideTypeTags[type];
  405. typeTagToGroupMap[type + "///" + tag] = configGroups.findProperty('name', group);
  406. urlParams.push('(type=' + type + '&tag=' + tag + ')');
  407. }
  408. }
  409. var params = urlParams.join('|');
  410. if (urlParams.length) {
  411. App.ajax.send({
  412. name: 'config.host_overrides',
  413. sender: this,
  414. data: {
  415. params: params,
  416. configKeyToConfigMap: configKeyToConfigMap,
  417. typeTagToGroupMap: typeTagToGroupMap,
  418. serviceConfigs: serviceConfigs
  419. },
  420. success: 'loadServiceConfigGroupOverridesSuccess'
  421. });
  422. } else {
  423. this.onLoadOverrides(serviceConfigs);
  424. }
  425. },
  426. loadServiceConfigGroupOverridesSuccess: function (data, opt, params) {
  427. data.items.forEach(function (config) {
  428. var group = params.typeTagToGroupMap[config.type + "///" + config.tag];
  429. var properties = config.properties;
  430. for (var prop in properties) {
  431. var fileName = App.config.getOriginalFileName(config.type);
  432. var serviceConfig = !!params.configKeyToConfigMap[fileName] ? params.configKeyToConfigMap[fileName][prop] : false;
  433. var hostOverrideValue = App.config.formatPropertyValue(serviceConfig, properties[prop]);
  434. var hostOverrideIsFinal = !!(config.properties_attributes && config.properties_attributes.final && config.properties_attributes.final[prop]);
  435. if (serviceConfig) {
  436. // Value of this property is different for this host.
  437. if (!Em.get(serviceConfig, 'overrides')) Em.set(serviceConfig, 'overrides', []);
  438. serviceConfig.overrides.pushObject({value: hostOverrideValue, group: group, isFinal: hostOverrideIsFinal});
  439. } else {
  440. params.serviceConfigs.push(App.config.createCustomGroupConfig(prop, fileName, config.properties[prop], group));
  441. }
  442. }
  443. });
  444. this.onLoadOverrides(params.serviceConfigs);
  445. },
  446. onLoadOverrides: function (configs) {
  447. var serviceName = configs[0].serviceName,
  448. service = this.get('stepConfigs').findProperty('serviceName', serviceName);
  449. var serviceConfig = App.config.createServiceConfig(serviceName);
  450. service.set('selectedConfigGroup', this.get('preSelectedConfigGroup'));
  451. this.loadComponentConfigs(service.get('configs'), serviceConfig, service);
  452. // override if a property isRequired or not
  453. this.overrideConfigIsRequired(service);
  454. service.set('configs', serviceConfig.get('configs'));
  455. },
  456. /**
  457. * Set <code>isEditable</code>-property to <code>serviceConfigProperty</code>
  458. * Based on user's permissions and selected config group
  459. * @param {Ember.Object} serviceConfigProperty
  460. * @param {bool} defaultGroupSelected
  461. * @returns {Ember.Object} Updated config-object
  462. * @method _updateIsEditableFlagForConfig
  463. */
  464. _updateIsEditableFlagForConfig: function (serviceConfigProperty, defaultGroupSelected) {
  465. if (App.isAuthorized('AMBARI.ADD_DELETE_CLUSTERS')) {
  466. if (defaultGroupSelected && !this.get('isHostsConfigsPage') && !Em.get(serviceConfigProperty, 'group')) {
  467. serviceConfigProperty.set('isEditable', serviceConfigProperty.get('isReconfigurable'));
  468. } else if (Em.get(serviceConfigProperty, 'group') && Em.get(serviceConfigProperty, 'group.name') == this.get('selectedConfigGroup.name')) {
  469. serviceConfigProperty.set('isEditable', true);
  470. } else {
  471. serviceConfigProperty.set('isEditable', false);
  472. }
  473. }
  474. else {
  475. serviceConfigProperty.set('isEditable', false);
  476. }
  477. return serviceConfigProperty;
  478. },
  479. /**
  480. * Set <code>overrides</code>-property to <code>serviceConfigProperty<code>
  481. * @param {Ember.Object} serviceConfigProperty
  482. * @param {Ember.Object} component
  483. * @return {Ember.Object} Updated config-object
  484. * @method _updateOverridesForConfig
  485. */
  486. _updateOverridesForConfig: function (serviceConfigProperty, component) {
  487. var overrides = serviceConfigProperty.get('overrides');
  488. if (Em.isNone(overrides)) {
  489. serviceConfigProperty.set('overrides', Em.A([]));
  490. return serviceConfigProperty;
  491. }
  492. serviceConfigProperty.set('overrides', null);
  493. var defaultGroupSelected = component.get('selectedConfigGroup.isDefault');
  494. // Wrap each override to App.ServiceConfigProperty
  495. overrides.forEach(function (override) {
  496. var newSCP = App.ServiceConfigProperty.create(serviceConfigProperty);
  497. newSCP.set('value', override.value);
  498. newSCP.set('isOriginalSCP', false); // indicated this is overridden value,
  499. newSCP.set('parentSCP', serviceConfigProperty);
  500. if (defaultGroupSelected) {
  501. var group = component.get('configGroups').findProperty('name', override.group.get('name'));
  502. // prevent cycle in proto object, clean link
  503. if (group.get('properties').length == 0) {
  504. group.set('properties', Em.A([]));
  505. }
  506. group.get('properties').push(newSCP);
  507. newSCP.set('group', override.group);
  508. newSCP.set('isEditable', false);
  509. }
  510. var parentOverridesArray = serviceConfigProperty.get('overrides');
  511. if (Em.isNone(parentOverridesArray)) {
  512. parentOverridesArray = Em.A([]);
  513. serviceConfigProperty.set('overrides', parentOverridesArray);
  514. }
  515. serviceConfigProperty.get('overrides').pushObject(newSCP);
  516. newSCP.validate();
  517. }, this);
  518. return serviceConfigProperty;
  519. },
  520. /**
  521. * Set configs with overrides, recommended defaults to component
  522. * @param {Ember.Object[]} configs
  523. * @param {Ember.Object} componentConfig
  524. * @param {Ember.Object} component
  525. * @method loadComponentConfigs
  526. */
  527. loadComponentConfigs: function (configs, componentConfig, component) {
  528. var defaultGroupSelected = component.get('selectedConfigGroup.isDefault');
  529. configs.forEach(function (serviceConfigProperty) {
  530. if (!serviceConfigProperty) return;
  531. if (Em.isNone(serviceConfigProperty.get('isOverridable'))) {
  532. serviceConfigProperty.set('isOverridable', true);
  533. }
  534. this._updateOverridesForConfig(serviceConfigProperty, component);
  535. this._updateIsEditableFlagForConfig(serviceConfigProperty, defaultGroupSelected);
  536. componentConfig.get('configs').pushObject(serviceConfigProperty);
  537. serviceConfigProperty.validate();
  538. }, this);
  539. component.get('configGroups').filterProperty('isDefault', false).forEach(function (configGroup) {
  540. configGroup.set('hash', this.get('wizardController').getConfigGroupHash(configGroup));
  541. }, this);
  542. var overrideToAdd = this.get('overrideToAdd');
  543. if (overrideToAdd) {
  544. overrideToAdd = componentConfig.get('configs').findProperty('name', overrideToAdd.name);
  545. if (overrideToAdd) {
  546. var group = this.get('selectedService.configGroups').findProperty('name', this.get('selectedConfigGroup.name'));
  547. var newSCP = App.config.createOverride(overrideToAdd, {isEditable: true}, group);
  548. group.get('properties').pushObject(newSCP);
  549. component.set('overrideToAdd', null);
  550. }
  551. }
  552. },
  553. /**
  554. * On load function
  555. * @method loadStep
  556. */
  557. loadStep: function () {
  558. if (!this.get('isConfigsLoaded')) {
  559. return;
  560. }
  561. console.time('wizard loadStep: ');
  562. this.clearStep();
  563. var self = this;
  564. App.config.setPreDefinedServiceConfigs(this.get('addMiscTabToPage'));
  565. var storedConfigs = this.get('content.serviceConfigProperties');
  566. var configs = (storedConfigs && storedConfigs.length) ? storedConfigs : App.configsCollection.getAll();
  567. this.set('groupsToDelete', this.get('wizardController').getDBProperty('groupsToDelete') || []);
  568. if (this.get('wizardController.name') === 'addServiceController' && !this.get('content.serviceConfigProperties.length')) {
  569. App.router.get('configurationController').getConfigsByTags(this.get('serviceConfigTags')).done(function (loadedConfigs) {
  570. configs = self.setInstalledServiceConfigs(configs, loadedConfigs, self.get('installedServiceNames'));
  571. self.applyServicesConfigs(configs);
  572. });
  573. } else {
  574. this.applyServicesConfigs(configs);
  575. }
  576. },
  577. /**
  578. * Resolve config theme conditions
  579. * in order to correctly calculate config errors number of service
  580. * @param {Array} configs
  581. */
  582. resolveConfigThemeConditions: function (configs) {
  583. App.ThemeCondition.find().forEach(function (configCondition) {
  584. var _configs = Em.A(configCondition.get('configs'));
  585. if (configCondition.get("resource") === 'config' && _configs.length > 0) {
  586. var isConditionTrue = App.config.calculateConfigCondition(configCondition.get("if"), configs);
  587. var action = isConditionTrue ? configCondition.get("then") : configCondition.get("else");
  588. if (configCondition.get('id')) {
  589. var valueAttributes = action.property_value_attributes;
  590. if (valueAttributes && !Em.none(valueAttributes['visible'])) {
  591. var themeResource;
  592. if (configCondition.get('type') === 'subsection') {
  593. themeResource = App.SubSection.find().findProperty('name', configCondition.get('name'));
  594. } else if (configCondition.get('type') === 'subsectionTab') {
  595. themeResource = App.SubSectionTab.find().findProperty('name', configCondition.get('name'));
  596. } else if (configCondition.get('type') === 'config') {
  597. //simulate section wrapper for condition type "config"
  598. themeResource = Em.Object.create({
  599. configProperties: [App.config.configId(configCondition.get('configName'), configCondition.get('fileName'))]
  600. });
  601. }
  602. if (themeResource) {
  603. themeResource.get('configProperties').forEach(function (_configId) {
  604. configs.forEach(function (item) {
  605. if (App.config.configId(item.name, item.filename) === _configId) {
  606. // if config has already been hidden by condition with "subsection" or "subsectionTab" type
  607. // then ignore condition of "config" type
  608. if (configCondition.get('type') === 'config' && item.hiddenBySection) return false;
  609. item.hiddenBySection = !valueAttributes['visible'];
  610. }
  611. });
  612. }, this);
  613. }
  614. }
  615. }
  616. }
  617. });
  618. },
  619. /**
  620. * Update hawq configuration depending on the state of the cluster
  621. * @param {Array} configs
  622. */
  623. updateHawqConfigs: function (configs) {
  624. if (this.get('wizardController.name') == 'addServiceController') {
  625. if (App.get('isHaEnabled')) this.addHawqConfigsOnNnHa(configs);
  626. if (App.get('isRMHaEnabled')) this.addHawqConfigsOnRMHa(configs);
  627. }
  628. if (App.get('isSingleNode')) this.removeHawqStandbyHostAddressConfig(configs);
  629. return configs
  630. },
  631. /**
  632. * Remove hawq_standby_address_host config from HAWQ configs
  633. * @param {Array} configs
  634. */
  635. removeHawqStandbyHostAddressConfig: function(configs) {
  636. var hawqStandbyAddressHostIndex = configs.indexOf(configs.findProperty('name', 'hawq_standby_address_host'));
  637. if (hawqStandbyAddressHostIndex > -1) configs.removeAt(hawqStandbyAddressHostIndex) ;
  638. return configs
  639. },
  640. applyServicesConfigs: function (configs) {
  641. if (this.get('allSelectedServiceNames').contains('YARN')) {
  642. configs = App.config.fileConfigsIntoTextarea(configs, 'capacity-scheduler.xml', []);
  643. }
  644. if (!this.get('installedServiceNames').contains('HAWQ') && this.get('allSelectedServiceNames').contains('HAWQ')) {
  645. this.updateHawqConfigs(configs);
  646. }
  647. if (App.get('isKerberosEnabled') && this.get('wizardController.name') == 'addServiceController') {
  648. this.addKerberosDescriptorConfigs(configs, this.get('wizardController.kerberosDescriptorConfigs') || []);
  649. }
  650. this.resolveConfigThemeConditions(configs);
  651. var stepConfigs = this.createStepConfigs();
  652. var serviceConfigs = this.renderConfigs(stepConfigs, configs);
  653. // if HA is enabled -> Make some reconfigurations
  654. if (this.get('wizardController.name') === 'addServiceController' && App.get('isHaEnabled')) {
  655. serviceConfigs = this._reconfigureServicesOnNnHa(serviceConfigs);
  656. }
  657. this.set('stepConfigs', serviceConfigs);
  658. this.checkHostOverrideInstaller();
  659. this.selectProperService();
  660. var self = this;
  661. var rangerService = App.StackService.find().findProperty('serviceName', 'RANGER');
  662. if (rangerService && !rangerService.get('isInstalled') && !rangerService.get('isSelected')) {
  663. App.config.removeRangerConfigs(self.get('stepConfigs'));
  664. }
  665. this.loadConfigRecommendations(null, this.completeConfigLoading.bind(this));
  666. },
  667. completeConfigLoading: function() {
  668. this.clearRecommendationsByServiceName(App.StackService.find().filterProperty('isSelected').mapProperty('serviceName'));
  669. console.timeEnd('wizard loadStep: ');
  670. this.set('isRecommendedLoaded', true);
  671. if (this.get('content.skipConfigStep')) {
  672. App.router.send('next');
  673. }
  674. this.set('hash', this.getHash());
  675. },
  676. /**
  677. * Update initialValues only while loading recommendations first time
  678. *
  679. * @param serviceName
  680. * @returns {boolean}
  681. * @override
  682. */
  683. updateInitialOnRecommendations: function(serviceName) {
  684. return this._super(serviceName) && !this.get('isRecommendedLoaded');
  685. },
  686. /**
  687. * Mark descriptor properties in configuration object.
  688. *
  689. * @param {Object[]} configs - config properties to change
  690. * @param {App.ServiceConfigProperty[]} descriptor - parsed kerberos descriptor
  691. * @method addKerberosDescriptorConfigs
  692. */
  693. addKerberosDescriptorConfigs: function (configs, descriptor) {
  694. descriptor.forEach(function (item) {
  695. var property = configs.findProperty('name', item.get('name'));
  696. if (property) {
  697. Em.setProperties(property, {
  698. isSecureConfig: true,
  699. displayName: Em.get(item, 'name'),
  700. isUserProperty: false,
  701. isOverridable: false,
  702. category: 'Advanced ' + Em.get(item, 'filename')
  703. });
  704. }
  705. });
  706. },
  707. /**
  708. * Load config groups
  709. * and (if some services are already installed) load config groups for installed services
  710. * @method checkHostOverrideInstaller
  711. */
  712. checkHostOverrideInstaller: function () {
  713. if (this.get('wizardController.name') !== 'kerberosWizardController') {
  714. this.loadConfigGroups(this.get('content.configGroups'));
  715. }
  716. if (this.get('installedServiceNames').length > 0 && !this.get('wizardController.areInstalledConfigGroupsLoaded')) {
  717. this.loadInstalledServicesConfigGroups(this.get('installedServiceNames'));
  718. }
  719. },
  720. /**
  721. * Create stepConfigs array with all info except configs list
  722. *
  723. * @return {Object[]}
  724. * @method createStepConfigs
  725. */
  726. createStepConfigs: function() {
  727. var stepConfigs = [];
  728. App.config.get('preDefinedServiceConfigs').forEach(function (service) {
  729. var serviceName = service.get('serviceName');
  730. if (['MISC'].concat(this.get('allSelectedServiceNames')).contains(serviceName)) {
  731. var serviceConfig = App.config.createServiceConfig(serviceName);
  732. serviceConfig.set('showConfig', App.StackService.find(serviceName).get('isInstallable'));
  733. if (this.get('wizardController.name') == 'addServiceController') {
  734. serviceConfig.set('selected', !this.get('installedServiceNames').concat('MISC').contains(serviceName));
  735. if (serviceName === 'MISC') {
  736. serviceConfig.set('configCategories', serviceConfig.get('configCategories').rejectProperty('name', 'Notifications'));
  737. }
  738. } else if (this.get('wizardController.name') == 'kerberosWizardController') {
  739. serviceConfig.set('showConfig', true);
  740. }
  741. stepConfigs.pushObject(serviceConfig);
  742. }
  743. }, this);
  744. return stepConfigs;
  745. },
  746. /**
  747. * For Namenode HA, HAWQ service requires additional config parameters in hdfs-client.xml
  748. * This method ensures that these additional parameters are added to hdfs-client.xml
  749. * @param configs existing configs on cluster
  750. * @returns {Object[]} existing configs + additional config parameters in hdfs-client.xml
  751. */
  752. addHawqConfigsOnNnHa: function(configs) {
  753. var nameService = configs.findProperty('id', 'dfs.nameservices__hdfs-site').value;
  754. var propertyNames = [
  755. 'dfs.nameservices',
  756. 'dfs.ha.namenodes.' + nameService,
  757. 'dfs.namenode.rpc-address.'+ nameService +'.nn1',
  758. 'dfs.namenode.rpc-address.'+ nameService +'.nn2',
  759. 'dfs.namenode.http-address.'+ nameService +'.nn1',
  760. 'dfs.namenode.http-address.'+ nameService +'.nn2'
  761. ];
  762. propertyNames.forEach(function(propertyName, propertyIndex) {
  763. var propertyFromHdfs = configs.findProperty('id', propertyName + '__hdfs-site');
  764. var newProperty = App.config.createDefaultConfig(propertyName, 'HAWQ', 'hdfs-client.xml', true);
  765. Em.setProperties(newProperty, {
  766. description: propertyFromHdfs.description,
  767. displayName: propertyFromHdfs.displayName,
  768. displayType: 'string',
  769. index: propertyIndex,
  770. isOverridable: false,
  771. isReconfigurable: false,
  772. name: propertyFromHdfs.name,
  773. value: propertyFromHdfs.value,
  774. recommendedValue: propertyFromHdfs.recommendedValue
  775. });
  776. configs.push(App.ServiceConfigProperty.create(newProperty));
  777. });
  778. return configs;
  779. },
  780. /**
  781. * For ResourceManager HA, HAWQ service requires additional config parameters in yarn-client.xml
  782. * This method ensures that these additional parameters are added to yarn-client.xml
  783. * @param configs existing configs on cluster
  784. * @returns {Object[]} existing configs + additional config parameters in yarn-client.xml
  785. */
  786. addHawqConfigsOnRMHa: function(configs) {
  787. rmHost1 = configs.findProperty('id', 'yarn.resourcemanager.hostname.rm1__yarn-site').value ;
  788. rmHost2 = configs.findProperty('id', 'yarn.resourcemanager.hostname.rm2__yarn-site').value ;
  789. var yarnConfigToBeAdded = [
  790. {
  791. name: 'yarn.resourcemanager.ha',
  792. displayName: 'yarn.resourcemanager.ha',
  793. description: 'Comma separated yarn resourcemanager host addresses with port',
  794. port: '8032'
  795. },
  796. {
  797. name: 'yarn.resourcemanager.scheduler.ha',
  798. displayName: 'yarn.resourcemanager.scheduler.ha',
  799. description: 'Comma separated yarn resourcemanager scheduler addresses with port',
  800. port: '8030'
  801. }
  802. ];
  803. yarnConfigToBeAdded.forEach(function(propertyDetails) {
  804. var newProperty = App.config.createDefaultConfig(propertyDetails.name, 'HAWQ', 'yarn-client.xml', true);
  805. var value = rmHost1 + ':' + propertyDetails.port + ',' + rmHost2 + ':' + propertyDetails.port;
  806. Em.setProperties(newProperty, {
  807. name: propertyDetails.name,
  808. description: propertyDetails.description,
  809. displayName: propertyDetails.displayName,
  810. isOverridable: false,
  811. isReconfigurable: false,
  812. value: value,
  813. recommendedValue: value
  814. });
  815. configs.push(App.ServiceConfigProperty.create(newProperty));
  816. });
  817. return configs;
  818. },
  819. /**
  820. * render configs, distribute them by service
  821. * and wrap each in ServiceConfigProperty object
  822. * @param stepConfigs
  823. * @param configs
  824. * @return {App.ServiceConfig[]}
  825. */
  826. renderConfigs: function (stepConfigs, configs) {
  827. var localDB = {
  828. hosts: this.get('wizardController.content.hosts'),
  829. masterComponentHosts: this.get('wizardController.content.masterComponentHosts'),
  830. slaveComponentHosts: this.get('wizardController.content.slaveComponentHosts')
  831. };
  832. var configsByService = {}, dependencies = this.get('configDependencies');
  833. configs.forEach(function (_config) {
  834. if (!configsByService[_config.serviceName]) {
  835. configsByService[_config.serviceName] = [];
  836. }
  837. var serviceConfigProperty = App.ServiceConfigProperty.create(_config);
  838. this.updateHostOverrides(serviceConfigProperty, _config);
  839. if (this.get('wizardController.name') === 'addServiceController') {
  840. this._updateIsEditableFlagForConfig(serviceConfigProperty, true);
  841. }
  842. if (!this.get('content.serviceConfigProperties.length') && !serviceConfigProperty.get('hasInitialValue')) {
  843. App.ConfigInitializer.initialValue(serviceConfigProperty, localDB, dependencies);
  844. }
  845. serviceConfigProperty.validate();
  846. configsByService[_config.serviceName].pushObject(serviceConfigProperty);
  847. }, this);
  848. stepConfigs.forEach(function (service) {
  849. service.set('configs', configsByService[service.get('serviceName')]);
  850. if (['addServiceController', 'installerController'].contains(this.get('wizardController.name'))) {
  851. this.addHostNamesToConfigs(service, localDB.masterComponentHosts, localDB.slaveComponentHosts);
  852. }
  853. }, this);
  854. return stepConfigs;
  855. },
  856. /**
  857. * Add host name properties to appropriate categories (for installer and add service)
  858. *
  859. * @param {Object} serviceConfig
  860. * @param {Object[]} masterComponents - info from localStorage
  861. * @param {Object[]} slaveComponents - info from localStorage
  862. */
  863. addHostNamesToConfigs: function(serviceConfig, masterComponents, slaveComponents) {
  864. serviceConfig.get('configCategories').forEach(function(c) {
  865. if (c.showHost) {
  866. var value = [];
  867. var componentName = c.name;
  868. var masters = masterComponents && masterComponents.filterProperty('component', componentName);
  869. if (masters.length) {
  870. value = masters.mapProperty('hostName');
  871. } else {
  872. var slaves = slaveComponents && slaveComponents.findProperty('componentName', componentName);
  873. if (slaves) {
  874. value = slaves.hosts.mapProperty('hostName');
  875. }
  876. }
  877. var stackComponent = App.StackServiceComponent.find(componentName);
  878. var hProperty = App.config.createHostNameProperty(serviceConfig.get('serviceName'), componentName, value, stackComponent);
  879. var newConfigName = Em.get(hProperty, 'name');
  880. if (!serviceConfig.get('configs').someProperty('name', newConfigName)) {
  881. serviceConfig.get('configs').push(App.ServiceConfigProperty.create(hProperty));
  882. }
  883. }
  884. }, this);
  885. },
  886. /**
  887. * create new child configs from overrides, attach them to parent config
  888. * override - value of config, related to particular host(s)
  889. * @param configProperty
  890. * @param storedConfigProperty
  891. */
  892. updateHostOverrides: function (configProperty, storedConfigProperty) {
  893. if (storedConfigProperty.overrides != null && storedConfigProperty.overrides.length > 0) {
  894. var overrides = [];
  895. storedConfigProperty.overrides.forEach(function (overrideEntry) {
  896. // create new override with new value
  897. var newSCP = App.ServiceConfigProperty.create(configProperty);
  898. newSCP.set('value', overrideEntry.value);
  899. newSCP.set('isOriginalSCP', false); // indicated this is overridden value,
  900. newSCP.set('parentSCP', configProperty);
  901. overrides.pushObject(newSCP);
  902. });
  903. configProperty.set('overrides', overrides);
  904. }
  905. },
  906. /**
  907. * When NameNode HA is enabled some configs based on <code>dfs.nameservices</code> should be changed
  908. * This happens only if service is added AFTER NN HA is enabled
  909. *
  910. * @param {App.ServiceConfig[]} serviceConfigs
  911. * @method _reconfigureServiceOnNnHa
  912. * @private
  913. * @returns {App.ServiceConfig[]}
  914. */
  915. _reconfigureServicesOnNnHa: function (serviceConfigs) {
  916. var selectedServiceNames = this.get('selectedServiceNames');
  917. var nameServiceId = serviceConfigs.findProperty('serviceName', 'HDFS').configs.findProperty('name', 'dfs.nameservices');
  918. Em.A([
  919. {
  920. serviceName: 'HBASE',
  921. configToUpdate: 'hbase.rootdir'
  922. },
  923. {
  924. serviceName: 'ACCUMULO',
  925. configToUpdate: 'instance.volumes'
  926. },
  927. {
  928. serviceName: 'HAWQ',
  929. configToUpdate: 'hawq_dfs_url',
  930. regexPattern: /(^.*:[0-9]+)(?=\/)/,
  931. replacementValue: nameServiceId.get('value')
  932. }
  933. ]).forEach(function (c) {
  934. if (selectedServiceNames.contains(c.serviceName) && nameServiceId) {
  935. var cfg = serviceConfigs.findProperty('serviceName', c.serviceName).configs.findProperty('name', c.configToUpdate);
  936. var regexPattern = /\/\/.*:[0-9]+/i;
  937. var replacementValue = '//' + nameServiceId.get('value');
  938. if (typeof(c.regexPattern) !== "undefined" && typeof(c.replacementValue) !== "undefined") {
  939. regexPattern = c.regexPattern;
  940. replacementValue = c.replacementValue;
  941. }
  942. var newValue = cfg.get('value').replace(regexPattern, replacementValue);
  943. cfg.setProperties({
  944. value: newValue,
  945. recommendedValue: newValue
  946. });
  947. }
  948. });
  949. return serviceConfigs;
  950. },
  951. /**
  952. * Select first addable service for <code>addServiceWizard</code>
  953. * Select first service at all in other cases
  954. * @method selectProperService
  955. */
  956. selectProperService: function () {
  957. if (this.get('wizardController.name') === 'addServiceController') {
  958. this.set('selectedService', this.get('stepConfigs').filterProperty('selected', true).get('firstObject'));
  959. } else {
  960. this.set('selectedService', this.get('stepConfigs').filterProperty('showConfig', true).objectAt(0));
  961. }
  962. },
  963. /**
  964. * Load config tags
  965. * @return {$.ajax|null}
  966. * @method getConfigTags
  967. */
  968. getConfigTags: function () {
  969. this.set('isAppliedConfigLoaded', false);
  970. return App.ajax.send({
  971. name: 'config.tags',
  972. sender: this,
  973. success: 'getConfigTagsSuccess'
  974. });
  975. },
  976. /**
  977. * Success callback for config tags request
  978. * Updates <code>serviceConfigTags</code> with tags received from server
  979. * @param {object} data
  980. * @method getConfigTagsSuccess
  981. */
  982. getConfigTagsSuccess: function (data) {
  983. var installedServiceSites = [];
  984. App.StackService.find().filterProperty('isInstalled').forEach(function (service) {
  985. if (!service.get('configTypes')) return;
  986. var configTypes = Object.keys(service.get('configTypes'));
  987. installedServiceSites = installedServiceSites.concat(configTypes);
  988. }, this);
  989. installedServiceSites = installedServiceSites.uniq();
  990. var serviceConfigTags = [];
  991. for (var site in data.Clusters.desired_configs) {
  992. if (data.Clusters.desired_configs.hasOwnProperty(site)) {
  993. if (installedServiceSites.contains(site) || site == 'cluster-env') {
  994. serviceConfigTags.push({
  995. siteName: site,
  996. tagName: data.Clusters.desired_configs[site].tag,
  997. newTagName: null
  998. });
  999. }
  1000. }
  1001. }
  1002. this.set('serviceConfigTags', serviceConfigTags);
  1003. this.set('isAppliedConfigLoaded', true);
  1004. },
  1005. /**
  1006. * set configs actual values from server
  1007. * @param configs
  1008. * @param configsByTags
  1009. * @param installedServiceNames
  1010. * @method setInstalledServiceConfigs
  1011. */
  1012. setInstalledServiceConfigs: function (configs, configsByTags, installedServiceNames) {
  1013. var configsMap = {};
  1014. configsByTags.forEach(function (configSite) {
  1015. configsMap[configSite.type] = configSite.properties || {};
  1016. });
  1017. var allConfigs = configs.filter(function (_config) {
  1018. // filter out alert_notification configs on add service //TODO find better place for this!
  1019. if (_config.filename === 'alert_notification') return false;
  1020. if ((['MISC'].concat(installedServiceNames).contains(_config.serviceName))) {
  1021. var type = _config.filename ? App.config.getConfigTagFromFileName(_config.filename) : null;
  1022. var mappedConfigValue = type && configsMap[type] ? configsMap[type][_config.name] : null;
  1023. if (Em.isNone(mappedConfigValue)) {
  1024. //for now ranger plugin properties are not sending by recommendations if they are missed - it should be added
  1025. return _config.serviceName == 'MISC' || /^ranger-/.test(_config.filename);
  1026. } else {
  1027. if (_config.savedValue != mappedConfigValue) {
  1028. _config.savedValue = App.config.formatPropertyValue(_config, mappedConfigValue);
  1029. }
  1030. _config.value = App.config.formatPropertyValue(_config, mappedConfigValue);
  1031. _config.hasInitialValue = true;
  1032. this.updateDependencies(_config);
  1033. delete configsMap[type][_config.name];
  1034. return true;
  1035. }
  1036. } else {
  1037. return true;
  1038. }
  1039. }, this);
  1040. //add user properties
  1041. Em.keys(configsMap).forEach(function (filename) {
  1042. Em.keys(configsMap[filename]).forEach(function (propertyName) {
  1043. allConfigs.push(App.config.createDefaultConfig(propertyName,
  1044. App.config.getServiceByConfigType(filename) ? App.config.getServiceByConfigType(filename).get('serviceName') : 'MISC',
  1045. App.config.getOriginalFileName(filename),
  1046. false, {
  1047. value: configsMap[filename][propertyName],
  1048. savedValue: configsMap[filename][propertyName],
  1049. hasInitialValue: true
  1050. }));
  1051. });
  1052. });
  1053. return allConfigs;
  1054. },
  1055. /**
  1056. * update dependencies according to current config value
  1057. *
  1058. * @param config
  1059. */
  1060. updateDependencies: function(config) {
  1061. if (config.name === 'hive.metastore.uris' && config.filename === 'hive-site.xml') {
  1062. this.get('configDependencies')['hive.metastore.uris'] = config.savedValue;
  1063. } else if (config.name === 'clientPort' && config.filename === 'hive-site.xml') {
  1064. this.get('configDependencies')['clientPort'] = config.savedValue;
  1065. }
  1066. },
  1067. /**
  1068. * Add group ids to <code>groupsToDelete</code>
  1069. * Also save <code>groupsToDelete</code> to local storage
  1070. * @param {Ember.Object[]} groups
  1071. * @method setGroupsToDelete
  1072. */
  1073. setGroupsToDelete: function (groups) {
  1074. var groupsToDelete = this.get('groupsToDelete');
  1075. groups.forEach(function (group) {
  1076. if (group.get('id'))
  1077. groupsToDelete.push({
  1078. id: group.get('id')
  1079. });
  1080. });
  1081. this.get('wizardController').setDBProperty('groupsToDelete', groupsToDelete);
  1082. },
  1083. /**
  1084. * Update <code>configGroups</code> with selected service configGroups
  1085. * Also set default group to first position
  1086. * Update <code>selectedConfigGroup</code> with new default group
  1087. * @method selectedServiceObserver
  1088. */
  1089. selectedServiceObserver: function () {
  1090. if (this.get('selectedService') && (this.get('selectedService.serviceName') !== 'MISC')) {
  1091. var serviceGroups = this.get('selectedService.configGroups');
  1092. serviceGroups.forEach(function (item, index, array) {
  1093. if (item.isDefault) {
  1094. array.unshift(item);
  1095. array.splice(index + 1, 1);
  1096. }
  1097. });
  1098. this.set('configGroups', serviceGroups);
  1099. this.set('selectedConfigGroup', serviceGroups.findProperty('isDefault'));
  1100. }
  1101. }.observes('selectedService.configGroups.@each'),
  1102. /**
  1103. * load default groups for each service in case of initial load
  1104. * @param serviceConfigGroups
  1105. * @method loadConfigGroups
  1106. */
  1107. loadConfigGroups: function (serviceConfigGroups) {
  1108. var services = this.get('stepConfigs');
  1109. var hosts = this.get('wizardController.allHosts').mapProperty('hostName');
  1110. services.forEach(function (service) {
  1111. if (service.get('serviceName') === 'MISC') return;
  1112. var serviceRawGroups = serviceConfigGroups.filterProperty('service_name', service.serviceName);
  1113. var id = App.ServiceConfigGroup.getParentConfigGroupId(service.get('serviceName'));
  1114. if (!serviceRawGroups.length) {
  1115. App.store.load(App.ServiceConfigGroup, App.configGroupsMapper.generateDefaultGroup(service.get('serviceName'), hosts));
  1116. App.store.commit();
  1117. service.set('configGroups', [App.ServiceConfigGroup.find(id)]);
  1118. }
  1119. else {
  1120. App.store.loadMany(App.ServiceConfigGroup, serviceRawGroups);
  1121. App.store.commit();
  1122. serviceRawGroups.forEach(function(item){
  1123. var modelGroup = App.ServiceConfigGroup.find(item.id);
  1124. var wrappedProperties = [];
  1125. item.properties.forEach(function (propertyData) {
  1126. var parentSCP = service.configs.filterProperty('filename', propertyData.filename).findProperty('name', propertyData.name);
  1127. var overriddenSCP = App.ServiceConfigProperty.create(parentSCP);
  1128. overriddenSCP.set('isOriginalSCP', false);
  1129. overriddenSCP.set('parentSCP', parentSCP);
  1130. overriddenSCP.set('group', modelGroup);
  1131. overriddenSCP.setProperties(propertyData);
  1132. wrappedProperties.pushObject(App.ServiceConfigProperty.create(overriddenSCP));
  1133. });
  1134. modelGroup.set('properties', wrappedProperties);
  1135. }, this);
  1136. service.set('configGroups', App.ServiceConfigGroup.find().filterProperty('serviceName', service.get('serviceName')));
  1137. }
  1138. });
  1139. },
  1140. /**
  1141. * Click-handler on config-group to make it selected
  1142. * @param {object} event
  1143. * @method selectConfigGroup
  1144. */
  1145. selectConfigGroup: function (event) {
  1146. this.set('selectedConfigGroup', event.context);
  1147. },
  1148. /**
  1149. * Rebuild list of configs switch of config group:
  1150. * on default - display all configs from default group and configs from non-default groups as disabled
  1151. * on non-default - display all from default group as disabled and configs from selected non-default group
  1152. * @method switchConfigGroupConfigs
  1153. */
  1154. switchConfigGroupConfigs: function () {
  1155. var serviceConfigs = this.get('selectedService.configs'),
  1156. selectedGroup = this.get('selectedConfigGroup'),
  1157. overrideToAdd = this.get('overrideToAdd'),
  1158. overrides = [];
  1159. if (!selectedGroup) return;
  1160. var displayedConfigGroups = this._getDisplayedConfigGroups();
  1161. displayedConfigGroups.forEach(function (group) {
  1162. overrides.pushObjects(group.get('properties'));
  1163. });
  1164. serviceConfigs.forEach(function (config) {
  1165. this._setEditableValue(config);
  1166. this._setOverrides(config, overrides);
  1167. }, this);
  1168. }.observes('selectedConfigGroup'),
  1169. /**
  1170. * Get list of config groups to display
  1171. * Returns empty array if no <code>selectedConfigGroup</code>
  1172. * @return {Array}
  1173. * @method _getDisplayedConfigGroups
  1174. */
  1175. _getDisplayedConfigGroups: function () {
  1176. var selectedGroup = this.get('selectedConfigGroup');
  1177. if (!selectedGroup) return [];
  1178. return (selectedGroup.get('isDefault')) ?
  1179. this.get('selectedService.configGroups').filterProperty('isDefault', false) :
  1180. [this.get('selectedConfigGroup')];
  1181. },
  1182. /**
  1183. * Set <code>isEditable</code> property to <code>config</code>
  1184. * @param {Ember.Object} config
  1185. * @return {Ember.Object} updated config-object
  1186. * @method _setEditableValue
  1187. */
  1188. _setEditableValue: function (config) {
  1189. var selectedGroup = this.get('selectedConfigGroup');
  1190. if (!selectedGroup) return config;
  1191. var isEditable = config.get('isEditable'),
  1192. isServiceInstalled = this.get('installedServiceNames').contains(this.get('selectedService.serviceName'));
  1193. if (isServiceInstalled) {
  1194. isEditable = (!isEditable && !config.get('isReconfigurable')) ? false : selectedGroup.get('isDefault');
  1195. }
  1196. else {
  1197. isEditable = selectedGroup.get('isDefault');
  1198. }
  1199. if (config.get('group')) {
  1200. isEditable = config.get('group.name') == this.get('selectedConfigGroup.name');
  1201. }
  1202. config.set('isEditable', isEditable);
  1203. return config;
  1204. },
  1205. /**
  1206. * Set <code>overrides</code> property to <code>config</code>
  1207. * @param {Ember.Object} config
  1208. * @param {Ember.Enumerable} overrides
  1209. * @returns {Ember.Object}
  1210. * @method _setOverrides
  1211. */
  1212. _setOverrides: function (config, overrides) {
  1213. var selectedGroup = this.get('selectedConfigGroup'),
  1214. overrideToAdd = this.get('overrideToAdd'),
  1215. configOverrides = overrides.filterProperty('name', config.get('name'));
  1216. if (!selectedGroup) return config;
  1217. if (overrideToAdd && overrideToAdd.get('name') === config.get('name')) {
  1218. var valueForOverride = (config.get('widget') || config.get('displayType') == 'checkbox') ? config.get('value') : '';
  1219. var group = this.get('selectedService.configGroups').findProperty('name', selectedGroup.get('name'));
  1220. var newSCP = App.config.createOverride(config, {value: valueForOverride, recommendedValue: valueForOverride}, group);
  1221. configOverrides.push(newSCP);
  1222. group.get('properties').pushObject(newSCP);
  1223. this.set('overrideToAdd', null);
  1224. }
  1225. configOverrides.setEach('isEditable', !selectedGroup.get('isDefault'));
  1226. configOverrides.setEach('parentSCP', config);
  1227. config.set('overrides', configOverrides);
  1228. return config;
  1229. },
  1230. /**
  1231. * @param serviceName
  1232. * @returns {boolean}
  1233. * @override
  1234. */
  1235. useInitialValue: function(serviceName) {
  1236. return !App.Service.find(serviceName).get('serviceName', serviceName);
  1237. },
  1238. /**
  1239. *
  1240. * @param parentProperties
  1241. * @param name
  1242. * @param fileName
  1243. * @returns {*}
  1244. * @override
  1245. */
  1246. allowUpdateProperty: function(parentProperties, name, fileName) {
  1247. if (['installerController'].contains(this.get('wizardController.name')) || !!(parentProperties && parentProperties.length)) {
  1248. return true;
  1249. } else if (['addServiceController'].contains(this.get('wizardController.name'))) {
  1250. var stackProperty = App.configsCollection.getConfigByName(name, fileName);
  1251. if (!stackProperty || !this.get('installedServices')[stackProperty.serviceName]) {
  1252. return true;
  1253. } else if (stackProperty.propertyDependsOn.length) {
  1254. return !!stackProperty.propertyDependsOn.filter(function (p) {
  1255. var service = App.config.getServiceByConfigType(p.type);
  1256. return service && !this.get('installedServices')[service.get('serviceName')];
  1257. }, this).length;
  1258. } else {
  1259. return false;
  1260. }
  1261. }
  1262. return true;
  1263. },
  1264. /**
  1265. * remove config based on recommendations
  1266. * @param config
  1267. * @param configsCollection
  1268. * @param parentProperties
  1269. * @protected
  1270. * @override
  1271. */
  1272. _removeConfigByRecommendation: function (config, configsCollection, parentProperties) {
  1273. this._super(config, configsCollection, parentProperties);
  1274. /**
  1275. * need to update wizard info when removing configs for installed services;
  1276. */
  1277. var installedServices = this.get('installedServices'), wizardController = this.get('wizardController'),
  1278. fileNamesToUpdate = wizardController ? wizardController.getDBProperty('fileNamesToUpdate') || [] : [],
  1279. fileName = Em.get(config, 'filename'), serviceName = Em.get(config, 'serviceName');
  1280. var modifiedFileNames = this.get('modifiedFileNames');
  1281. if (modifiedFileNames && !modifiedFileNames.contains(fileName)) {
  1282. modifiedFileNames.push(fileName);
  1283. } else if (wizardController && installedServices[serviceName]) {
  1284. if (!fileNamesToUpdate.contains(fileName)) {
  1285. fileNamesToUpdate.push(fileName);
  1286. }
  1287. }
  1288. if (wizardController) {
  1289. wizardController.setDBProperty('fileNamesToUpdate', fileNamesToUpdate.uniq());
  1290. }
  1291. },
  1292. /**
  1293. * @method manageConfigurationGroup
  1294. */
  1295. manageConfigurationGroup: function () {
  1296. App.router.get('manageConfigGroupsController').manageConfigurationGroups(this);
  1297. },
  1298. /**
  1299. * Check whether hive New MySQL database is on the same host as Ambari server MySQL server
  1300. * @return {$.ajax|null}
  1301. * @method checkMySQLHost
  1302. */
  1303. checkMySQLHost: function () {
  1304. // get ambari database type and hostname
  1305. return App.ajax.send({
  1306. name: 'ambari.service',
  1307. data: {
  1308. fields : "?fields=hostComponents/RootServiceHostComponents/properties/server.jdbc.database_name,hostComponents/RootServiceHostComponents/properties/server.jdbc.url,hostComponents/RootServiceHostComponents/properties/server.jdbc.database"
  1309. },
  1310. sender: this,
  1311. success: 'getAmbariDatabaseSuccess'
  1312. });
  1313. },
  1314. /**
  1315. * Success callback for ambari database, get Ambari DB type and DB server hostname, then
  1316. * Check whether hive New MySQL database is on the same host as Ambari server MySQL server
  1317. * @param {object} data
  1318. * @method getAmbariDatabaseSuccess
  1319. */
  1320. getAmbariDatabaseSuccess: function (data) {
  1321. var ambariServerDBType = Em.getWithDefault(data.hostComponents, '0.RootServiceHostComponents.properties', {})['server.jdbc.database'],
  1322. ambariServerHostName = Em.getWithDefault(data.hostComponents, '0.RootServiceHostComponents.host_name', false),
  1323. hiveConnectionURL = Em.getWithDefault(App.config.findConfigProperty(this.get('stepConfigs'), 'javax.jdo.option.ConnectionURL', 'hive-site.xml') || {}, 'value', '');
  1324. if (ambariServerHostName) {
  1325. this.set('mySQLServerConflict', ambariServerDBType.contains('mysql') && hiveConnectionURL.contains(ambariServerHostName));
  1326. } else {
  1327. this.set('mySQLServerConflict', false);
  1328. }
  1329. },
  1330. /**
  1331. * Check if new MySql database was chosen for Hive service
  1332. * and it is not located on the same host as Ambari server
  1333. * that using MySql database too.
  1334. *
  1335. * @method resolveHiveMysqlDatabase
  1336. **/
  1337. resolveHiveMysqlDatabase: function () {
  1338. var hiveService = this.get('content.services').findProperty('serviceName', 'HIVE');
  1339. if (!hiveService || !hiveService.get('isSelected') || hiveService.get('isInstalled')) {
  1340. this.moveNext();
  1341. return;
  1342. }
  1343. var hiveDBType = this.get('stepConfigs').findProperty('serviceName', 'HIVE').configs.findProperty('name', 'hive_database').value;
  1344. if (hiveDBType == 'New MySQL Database') {
  1345. var self = this;
  1346. return this.checkMySQLHost().done(function () {
  1347. self.mySQLWarningHandler();
  1348. });
  1349. }
  1350. else {
  1351. this.moveNext();
  1352. }
  1353. },
  1354. /**
  1355. * Show warning popup about MySQL-DB issues (on post-submit)
  1356. *
  1357. * @returns {*}
  1358. * @method mySQLWarningHandler
  1359. */
  1360. mySQLWarningHandler: function () {
  1361. var self = this;
  1362. if (this.get('mySQLServerConflict')) {
  1363. // error popup before you can proceed
  1364. return App.ModalPopup.show({
  1365. header: Em.I18n.t('installer.step7.popup.mySQLWarning.header'),
  1366. body:Em.I18n.t('installer.step7.popup.mySQLWarning.body'),
  1367. secondary: Em.I18n.t('installer.step7.popup.mySQLWarning.button.gotostep5'),
  1368. primary: Em.I18n.t('installer.step7.popup.mySQLWarning.button.dismiss'),
  1369. encodeBody: false,
  1370. onPrimary: function () {
  1371. this._super();
  1372. self.set('submitButtonClicked', false);
  1373. },
  1374. onSecondary: function () {
  1375. var parent = this;
  1376. return App.ModalPopup.show({
  1377. header: Em.I18n.t('installer.step7.popup.mySQLWarning.confirmation.header'),
  1378. body: Em.I18n.t('installer.step7.popup.mySQLWarning.confirmation.body'),
  1379. onPrimary: function () {
  1380. this.hide();
  1381. parent.hide();
  1382. // go back to step 5: assign masters and disable default navigation warning
  1383. if ('installerController' === self.get('content.controllerName')) {
  1384. App.router.get('installerController').gotoStep(5, true);
  1385. }
  1386. else {
  1387. if ('addServiceController' === self.get('content.controllerName')) {
  1388. App.router.get('addServiceController').gotoStep(2, true);
  1389. }
  1390. }
  1391. },
  1392. onSecondary: function () {
  1393. this._super();
  1394. self.set('submitButtonClicked', false);
  1395. }
  1396. });
  1397. }
  1398. });
  1399. }
  1400. else {
  1401. return this.moveNext();
  1402. }
  1403. },
  1404. checkDatabaseConnectionTest: function () {
  1405. var deferred = $.Deferred();
  1406. var configMap = [
  1407. {
  1408. serviceName: 'OOZIE',
  1409. ignored: [Em.I18n.t('installer.step7.oozie.database.new')]
  1410. },
  1411. {
  1412. serviceName: 'HIVE',
  1413. ignored: [Em.I18n.t('installer.step7.hive.database.new.mysql'), Em.I18n.t('installer.step7.hive.database.new.postgres')]
  1414. }
  1415. ];
  1416. configMap.forEach(function (config) {
  1417. var isConnectionNotTested = false;
  1418. var service = this.get('content.services').findProperty('serviceName', config.serviceName);
  1419. if (service && service.get('isSelected') && !service.get('isInstalled')) {
  1420. var serviceConfigs = this.get('stepConfigs').findProperty('serviceName', config.serviceName).configs;
  1421. var serviceDatabase = serviceConfigs.findProperty('name', config.serviceName.toLowerCase() + '_database').get('value');
  1422. if (!config.ignored.contains(serviceDatabase)) {
  1423. var filledProperties = App.db.get('tmp', config.serviceName + '_connection');
  1424. if (!filledProperties || App.isEmptyObject(filledProperties)) {
  1425. isConnectionNotTested = true;
  1426. } else {
  1427. for (var key in filledProperties) {
  1428. if (serviceConfigs.findProperty('name', key).get('value') !== filledProperties[key])
  1429. isConnectionNotTested = true;
  1430. }
  1431. }
  1432. }
  1433. }
  1434. config.isCheckIgnored = isConnectionNotTested;
  1435. }, this);
  1436. var ignoredServices = configMap.filterProperty('isCheckIgnored', true);
  1437. if (ignoredServices.length) {
  1438. var displayedServiceNames = ignoredServices.mapProperty('serviceName').map(function (serviceName) {
  1439. return this.get('content.services').findProperty('serviceName', serviceName).get('displayName');
  1440. }, this);
  1441. this.showDatabaseConnectionWarningPopup(displayedServiceNames, deferred);
  1442. }
  1443. else {
  1444. deferred.resolve();
  1445. }
  1446. return deferred;
  1447. },
  1448. showChangesWarningPopup: function(goToNextStep) {
  1449. return App.ModalPopup.show({
  1450. header: Em.I18n.t('common.warning'),
  1451. body: Em.I18n.t('services.service.config.exitChangesPopup.body'),
  1452. secondary: Em.I18n.t('common.cancel'),
  1453. primary: Em.I18n.t('yes'),
  1454. onPrimary: function () {
  1455. if (goToNextStep) {
  1456. goToNextStep();
  1457. this.hide();
  1458. }
  1459. },
  1460. onSecondary: function () {
  1461. this.hide();
  1462. }
  1463. });
  1464. },
  1465. showDatabaseConnectionWarningPopup: function (serviceNames, deferred) {
  1466. var self = this;
  1467. return App.ModalPopup.show({
  1468. header: Em.I18n.t('installer.step7.popup.database.connection.header'),
  1469. body: Em.I18n.t('installer.step7.popup.database.connection.body').format(serviceNames.join(', ')),
  1470. secondary: Em.I18n.t('common.cancel'),
  1471. primary: Em.I18n.t('common.proceedAnyway'),
  1472. onPrimary: function () {
  1473. deferred.resolve();
  1474. this._super();
  1475. },
  1476. onSecondary: function () {
  1477. self.set('submitButtonClicked', false);
  1478. deferred.reject();
  1479. this._super();
  1480. }
  1481. });
  1482. },
  1483. showOozieDerbyWarningPopup: function(callback) {
  1484. var self = this;
  1485. if (this.get('selectedServiceNames').contains('OOZIE')) {
  1486. var databaseType = Em.getWithDefault(App.config.findConfigProperty(this.get('stepConfigs'), 'oozie_database', 'oozie-env.xml') || {}, 'value', '');
  1487. if (databaseType == Em.I18n.t('installer.step7.oozie.database.new')) {
  1488. return App.ModalPopup.show({
  1489. header: Em.I18n.t('common.warning'),
  1490. body: Em.I18n.t('installer.step7.popup.oozie.derby.warning'),
  1491. secondary: Em.I18n.t('common.cancel'),
  1492. primary: Em.I18n.t('common.proceedAnyway'),
  1493. onPrimary: function() {
  1494. this.hide();
  1495. if (callback) {
  1496. callback();
  1497. }
  1498. },
  1499. onSecondary: function() {
  1500. self.set('submitButtonClicked', false);
  1501. this.hide();
  1502. },
  1503. onClose: function() {
  1504. this.onSecondary();
  1505. }
  1506. });
  1507. }
  1508. }
  1509. if (callback) {
  1510. callback();
  1511. }
  1512. return false;
  1513. },
  1514. /**
  1515. * Proceed to the next step
  1516. **/
  1517. moveNext: function () {
  1518. App.router.send('next');
  1519. this.set('submitButtonClicked', false);
  1520. },
  1521. /**
  1522. * Click-handler on Next button
  1523. * Disable "Submit"-button while server-side processes are running
  1524. * @method submit
  1525. */
  1526. submit: function () {
  1527. if (this.get('isSubmitDisabled') || App.router.nextBtnClickInProgress) {
  1528. return false;
  1529. }
  1530. App.router.nextBtnClickInProgress = true;
  1531. var preInstallChecksController = App.router.get('preInstallChecksController');
  1532. if (this.get('supportsPreInstallChecks')) {
  1533. if (preInstallChecksController.get('preInstallChecksWhereRun')) {
  1534. return this.postSubmit();
  1535. }
  1536. return preInstallChecksController.notRunChecksWarnPopup(this.postSubmit.bind(this));
  1537. }
  1538. return this.postSubmit();
  1539. },
  1540. postSubmit: function () {
  1541. var self = this;
  1542. this.set('submitButtonClicked', true);
  1543. this.serverSideValidation().done(function() {
  1544. self.serverSideValidationCallback();
  1545. })
  1546. .fail(function (value) {
  1547. if ("invalid_configs" == value) {
  1548. self.set('submitButtonClicked', false);
  1549. App.router.nextBtnClickInProgress = false;
  1550. } else {
  1551. // Failed due to validation mechanism failure.
  1552. // Should proceed with other checks
  1553. self.serverSideValidationCallback();
  1554. }
  1555. });
  1556. },
  1557. /**
  1558. * @method serverSideValidationCallback
  1559. */
  1560. serverSideValidationCallback: function() {
  1561. var self = this;
  1562. this.showOozieDerbyWarningPopup(function() {
  1563. self.checkDatabaseConnectionTest().done(function () {
  1564. self.resolveHiveMysqlDatabase();
  1565. });
  1566. });
  1567. },
  1568. toggleIssuesFilter: function () {
  1569. this.get('filterColumns').findProperty('attributeName', 'hasIssues').toggleProperty('selected');
  1570. // if currently selected service does not have issue, jump to the first service with issue.
  1571. if (this.get('selectedService.errorCount') == 0 )
  1572. {
  1573. var errorServices = this.get('stepConfigs').filterProperty('errorCount');
  1574. if (errorServices.length > 0)
  1575. {
  1576. var service = errorServices[0];
  1577. this.set('selectedService', service);
  1578. $('a[href="#' + service.serviceName + '"]').tab('show');
  1579. }
  1580. }
  1581. }
  1582. });