You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ab...@apache.org on 2015/11/20 15:22:51 UTC
[2/2] ambari git commit: AMBARI-13996 Some config refactor on
wizards. (ababiichuk)
AMBARI-13996 Some config refactor on wizards. (ababiichuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ef208aaa
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ef208aaa
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ef208aaa
Branch: refs/heads/trunk
Commit: ef208aaac1bd5b3919297012308986262ac6dc88
Parents: 9de11b0
Author: aBabiichuk <ab...@cybervisiontech.com>
Authored: Fri Nov 20 16:16:34 2015 +0200
Committer: aBabiichuk <ab...@cybervisiontech.com>
Committed: Fri Nov 20 16:22:45 2015 +0200
----------------------------------------------------------------------
ambari-web/app/assets/test/tests.js | 4 +-
.../app/controllers/main/admin/kerberos.js | 2 +-
.../main/admin/kerberos/step2_controller.js | 4 +-
.../main/admin/kerberos/step4_controller.js | 5 +-
.../main/admin/serviceAccounts_controller.js | 28 +-
.../controllers/main/service/add_controller.js | 4 +-
.../controllers/main/service/info/configs.js | 10 +-
.../app/controllers/wizard/step7_controller.js | 351 +++++++++----------
ambari-web/app/data/HDP2/site_properties.js | 2 +-
ambari-web/app/mappers.js | 3 +-
.../mappers/configs/config_versions_mapper.js | 143 --------
.../configs/service_config_version_mapper.js | 116 ++++++
.../configs/stack_config_properties_mapper.js | 2 +-
.../mappers/service_config_version_mapper.js | 116 ------
ambari-web/app/mixins/common/serverValidator.js | 1 -
ambari-web/app/models.js | 1 -
.../app/models/configs/config_property.js | 236 -------------
ambari-web/app/models/configs/config_version.js | 34 --
.../app/models/configs/stack_config_property.js | 2 +-
ambari-web/app/models/stack_service.js | 6 +-
ambari-web/app/utils/config.js | 70 +---
.../app/utils/configs/config_initializer.js | 21 +-
.../admin/kerberos/step4_controller_test.js | 4 +-
.../controllers/main/admin/kerberos_test.js | 4 +-
.../admin/serviceAccounts_controller_test.js | 82 -----
.../test/controllers/wizard/step7_test.js | 233 +-----------
.../test/data/HDP2.2/site_properties_test.js | 2 +-
.../test/data/HDP2.3/site_properties_test.js | 3 +-
.../test/data/HDP2/site_properties_test.js | 2 +-
.../configs/config_versions_mapper_test.js | 119 -------
.../service_config_version_mapper_test.js | 119 +++++++
.../test/mappers/configs/themes_mapper_test.js | 1 -
.../test/models/configs/config_property_test.js | 66 ----
.../widgets/slider_config_widget_view_test.js | 2 +-
.../widgets/time_interval_spinner_view_test.js | 4 +-
35 files changed, 466 insertions(+), 1336 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/ef208aaa/ambari-web/app/assets/test/tests.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/assets/test/tests.js b/ambari-web/app/assets/test/tests.js
index 2155ce5..f8d59f1 100644
--- a/ambari-web/app/assets/test/tests.js
+++ b/ambari-web/app/assets/test/tests.js
@@ -131,9 +131,8 @@ var files = [
'test/mappers/users_mapper_test',
'test/mappers/stack_mapper_test',
'test/mappers/stack_service_mapper_test',
- 'test/mappers/configs/stack_config_properties_mapper_test',
'test/mappers/configs/config_groups_mapper_test',
- 'test/mappers/configs/config_versions_mapper_test',
+ 'test/mappers/configs/service_config_version_mapper_test',
'test/mappers/configs/themes_mapper_test',
'test/mixins/common/configs/enhanced_configs_test',
'test/mixins/common/configs/configs_saver_test',
@@ -321,7 +320,6 @@ var files = [
'test/models/configs/sub_section_test',
'test/models/configs/section_test',
'test/models/configs/service_config_version_test',
- 'test/models/configs/config_property_test',
'test/models/configs/objects/service_config_test',
'test/models/configs/objects/service_config_category_test',
'test/models/configs/objects/service_config_property_test',
http://git-wip-us.apache.org/repos/asf/ambari/blob/ef208aaa/ambari-web/app/controllers/main/admin/kerberos.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/kerberos.js b/ambari-web/app/controllers/main/admin/kerberos.js
index 223dc91..86e540c 100644
--- a/ambari-web/app/controllers/main/admin/kerberos.js
+++ b/ambari-web/app/controllers/main/admin/kerberos.js
@@ -351,7 +351,7 @@ App.MainAdminKerberosController = App.KerberosWizardStep4Controller.extend({
prepareConfigProperties: function (configs) {
var self = this;
var configProperties = configs.slice(0);
- var siteProperties = App.config.get('preDefinedSiteProperties');
+ var siteProperties = App.configsCollection.getAll();
var installedServiceNames = ['Cluster'].concat(App.Service.find().mapProperty('serviceName'));
configProperties = configProperties.filter(function (item) {
return installedServiceNames.contains(item.get('serviceName'));
http://git-wip-us.apache.org/repos/asf/ambari/blob/ef208aaa/ambari-web/app/controllers/main/admin/kerberos/step2_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/kerberos/step2_controller.js b/ambari-web/app/controllers/main/admin/kerberos/step2_controller.js
index 96f90f8..adddd2f 100644
--- a/ambari-web/app/controllers/main/admin/kerberos/step2_controller.js
+++ b/ambari-web/app/controllers/main/admin/kerberos/step2_controller.js
@@ -85,8 +85,6 @@ App.KerberosWizardStep2Controller = App.WizardStep7Controller.extend(App.KDCCred
return;
}
this.clearStep();
- //STEP 2: Load on-site configs by service from local DB
- var storedConfigs = this.get('content.serviceConfigProperties');
//STEP 3: Merge pre-defined configs with loaded on-site configs
this.set('configs', App.configsCollection.getAll());
App.config.setPreDefinedServiceConfigs(this.get('addMiscTabToPage'));
@@ -95,7 +93,7 @@ App.KerberosWizardStep2Controller = App.WizardStep7Controller.extend(App.KDCCred
if (App.get('supports.storeKDCCredentials') && !this.get('wizardController.skipClientInstall')) {
this.initilizeKDCStoreProperties(this.get('configs'));
}
- this.applyServicesConfigs(this.get('configs'), storedConfigs);
+ this.applyServicesConfigs(this.get('configs'));
},
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/ef208aaa/ambari-web/app/controllers/main/admin/kerberos/step4_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/kerberos/step4_controller.js b/ambari-web/app/controllers/main/admin/kerberos/step4_controller.js
index 1356766..6a324d1 100644
--- a/ambari-web/app/controllers/main/admin/kerberos/step4_controller.js
+++ b/ambari-web/app/controllers/main/admin/kerberos/step4_controller.js
@@ -173,7 +173,7 @@ App.KerberosWizardStep4Controller = App.WizardStep7Controller.extend(App.AddSecu
var installedServiceNames = ['Cluster'].concat(App.Service.find().mapProperty('serviceName'));
var adminProps = [];
var configProperties = configs.slice(0);
- var siteProperties = App.config.get('preDefinedSiteProperties');
+ var siteProperties = App.configsCollection.getAll();
// override stored values
App.config.mergeStoredValue(configProperties, this.get('wizardController').loadCachedStepConfigValues(this));
@@ -182,6 +182,9 @@ App.KerberosWizardStep4Controller = App.WizardStep7Controller.extend(App.AddSecu
installedServiceNames = installedServiceNames.concat(this.get('selectedServiceNames'));
this.get('adminPropertyNames').forEach(function(item) {
var property = storedServiceConfigs.filterProperty('filename', 'krb5-conf.xml').findProperty('name', item.name);
+ if (!property) {
+ property = siteProperties.filterProperty('filename', 'krb5-conf.xml').findProperty('name', item.name);
+ }
if (!!property) {
var _prop = App.ServiceConfigProperty.create($.extend({}, property, { name: item.name, value: '', recommendedValue: '', serviceName: 'Cluster', displayName: item.displayName}));
if (App.router.get('mainAdminKerberosController.isManualKerberos')) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/ef208aaa/ambari-web/app/controllers/main/admin/serviceAccounts_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/serviceAccounts_controller.js b/ambari-web/app/controllers/main/admin/serviceAccounts_controller.js
index 92a4087..45cfbcf 100644
--- a/ambari-web/app/controllers/main/admin/serviceAccounts_controller.js
+++ b/ambari-web/app/controllers/main/admin/serviceAccounts_controller.js
@@ -106,34 +106,10 @@ App.MainAdminServiceAccountsController = App.MainServiceInfoConfigsController.ex
var configs = App.config.mergePredefinedWithSaved(serverConfigs, this.get('selectedService'));
var miscConfigs = configs.filterProperty('displayType', 'user').filterProperty('category', 'Users and Groups');
miscConfigs.setEach('isVisible', true);
-
- // load specific users along the wizards which called <code>loadUsers</code> method
- var wizardContentProperties = [
- {key: 'group', configName: 'user_group'},
- {key: 'smokeuser', configName: 'smokeuser'},
- {key: 'hdfsUser', configName: 'hdfs_user'}
- ];
- wizardContentProperties.forEach(function(item) {
- this.setContentProperty(item.key, item.configName, miscConfigs);
- }, this);
- this.set('users', miscConfigs.filterProperty('isVisible'));
+ this.set('users', miscConfigs);
this.set('dataIsLoaded', true);
},
- /**
- * set config value to property of "content"
- * @param key
- * @param configName
- * @param misc_configs
- * @return {Boolean}
- */
- setContentProperty: function (key, configName, misc_configs) {
- var content = this.get('content');
- if (key && configName && misc_configs.someProperty('name', configName) && content.get(key)) {
- content.set(key, misc_configs.findProperty('name', configName).get("value"));
- return true;
- }
- return false;
- },
+
/**
* sort miscellaneous configs by specific order
* @param sortOrder
http://git-wip-us.apache.org/repos/asf/ambari/blob/ef208aaa/ambari-web/app/controllers/main/service/add_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/add_controller.js b/ambari-web/app/controllers/main/service/add_controller.js
index 6fe3ff6..634aa07 100644
--- a/ambari-web/app/controllers/main/service/add_controller.js
+++ b/ambari-web/app/controllers/main/service/add_controller.js
@@ -70,9 +70,7 @@ App.AddServiceController = App.WizardController.extend(App.AddSecurityConfigs, {
controllerName: 'addServiceController',
configGroups: [],
clients: [],
- additionalClients: [],
- smokeuser: "ambari-qa",
- group: "hadoop"
+ additionalClients: []
}),
loadMap: {
http://git-wip-us.apache.org/repos/asf/ambari/blob/ef208aaa/ambari-web/app/controllers/main/service/info/configs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/info/configs.js b/ambari-web/app/controllers/main/service/info/configs.js
index 6891d65..7cd8d5e 100644
--- a/ambari-web/app/controllers/main/service/info/configs.js
+++ b/ambari-web/app/controllers/main/service/info/configs.js
@@ -191,7 +191,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ConfigsLoader, A
/**
* get array of config properties that are shown in settings tab
- * @type {App.StackConfigProperty[]}
+ * @type {String[]}
*/
settingsTabProperties: function() {
var properties = [];
@@ -491,14 +491,6 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ConfigsLoader, A
return serviceNames.contains(c.get('serviceName'));
});
var serviceConfig = App.config.createServiceConfig(serviceName, configGroups, configsByService, configsByService.length);
- if (serviceConfig.get('serviceName') === 'HDFS') {
- if (App.get('isHaEnabled')) {
- var c = serviceConfig.configs,
- removedConfigs = c.filterProperty('category', 'SECONDARY_NAMENODE');
- removedConfigs.setEach('isVisible', false);
- serviceConfig.configs = c;
- }
- }
this.addHostNamesToConfigs(serviceConfig);
this.get('stepConfigs').pushObject(serviceConfig);
}, this);
http://git-wip-us.apache.org/repos/asf/ambari/blob/ef208aaa/ambari-web/app/controllers/wizard/step7_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step7_controller.js b/ambari-web/app/controllers/wizard/step7_controller.js
index 6ad873f..9209add 100644
--- a/ambari-web/app/controllers/wizard/step7_controller.js
+++ b/ambari-web/app/controllers/wizard/step7_controller.js
@@ -205,6 +205,23 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E
filter: '',
/**
+ * list of dependencies that are user to set init value of config
+ *
+ * @type {Object}
+ */
+ configDependencies: function() {
+ var dependencies = {
+ 'sliderSelected': this.get('allSelectedServiceNames').contains('SLIDER')
+ };
+ var hiveMetastore = App.configsCollection.getConfigByName('hive.metastore.uris', 'hive-site.xml');
+ var clientPort = App.configsCollection.getConfigByName('clientPort', 'zoo.cfg.xml');
+
+ if (hiveMetastore) dependencies['hive.metastore.uris'] = hiveMetastore.recommendedValue;
+ if (clientPort) dependencies['clientPort'] = clientPort.recommendedValue;
+ return dependencies
+ }.property('allSelectedServiceNames'),
+
+ /**
* List of filters for config properties to populate filter combobox
*/
propertyFilters: [
@@ -415,9 +432,71 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E
}, this);
}, this);
this.set('preSelectedConfigGroup', App.ServiceConfigGroup.find(App.ServiceConfigGroup.getParentConfigGroupId(serviceName)));
- App.config.loadServiceConfigGroupOverrides(service.get('configs'), loadedGroupToOverrideSiteToTagMap, service.get('configGroups'), this.onLoadOverrides, this);
+ this.loadServiceConfigGroupOverrides(service.get('configs'), loadedGroupToOverrideSiteToTagMap, service.get('configGroups'));
+ },
+
+ /**
+ * Get properties from server by type and tag with properties, that belong to group
+ * push them to common {serviceConfigs} and call callback function
+ */
+ loadServiceConfigGroupOverrides: function (serviceConfigs, loadedGroupToOverrideSiteToTagMap, configGroups) {
+ var configKeyToConfigMap = {};
+ serviceConfigs.forEach(function (item) {
+ if (!configKeyToConfigMap[item.filename]) {
+ configKeyToConfigMap[item.filename] = {};
+ }
+ configKeyToConfigMap[item.filename][item.name] = item;
+ });
+ var typeTagToGroupMap = {};
+ var urlParams = [];
+ for (var group in loadedGroupToOverrideSiteToTagMap) {
+ var overrideTypeTags = loadedGroupToOverrideSiteToTagMap[group];
+ for (var type in overrideTypeTags) {
+ var tag = overrideTypeTags[type];
+ typeTagToGroupMap[type + "///" + tag] = configGroups.findProperty('name', group);
+ urlParams.push('(type=' + type + '&tag=' + tag + ')');
+ }
+ }
+ var params = urlParams.join('|');
+ if (urlParams.length) {
+ App.ajax.send({
+ name: 'config.host_overrides',
+ sender: this,
+ data: {
+ params: params,
+ configKeyToConfigMap: configKeyToConfigMap,
+ typeTagToGroupMap: typeTagToGroupMap,
+ serviceConfigs: serviceConfigs
+ },
+ success: 'loadServiceConfigGroupOverridesSuccess'
+ });
+ } else {
+ this.onLoadOverrides(serviceConfigs);
+ }
+ },
+
+ loadServiceConfigGroupOverridesSuccess: function (data, opt, params) {
+ data.items.forEach(function (config) {
+ var group = params.typeTagToGroupMap[config.type + "///" + config.tag];
+ var properties = config.properties;
+ for (var prop in properties) {
+ var fileName = App.config.getOriginalFileName(config.type);
+ var serviceConfig = !!params.configKeyToConfigMap[fileName] ? params.configKeyToConfigMap[fileName][prop] : false;
+ var hostOverrideValue = App.config.formatPropertyValue(serviceConfig, properties[prop]);
+ var hostOverrideIsFinal = !!(config.properties_attributes && config.properties_attributes.final && config.properties_attributes.final[prop]);
+ if (serviceConfig) {
+ // Value of this property is different for this host.
+ if (!Em.get(serviceConfig, 'overrides')) Em.set(serviceConfig, 'overrides', []);
+ serviceConfig.overrides.pushObject({value: hostOverrideValue, group: group, isFinal: hostOverrideIsFinal});
+ } else {
+ params.serviceConfigs.push(App.config.createCustomGroupConfig(prop, config, group));
+ }
+ }
+ });
+ this.onLoadOverrides(params.serviceConfigs);
},
+
onLoadOverrides: function (configs) {
var serviceName = configs[0].serviceName,
service = this.get('stepConfigs').findProperty('serviceName', serviceName);
@@ -537,37 +616,6 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E
},
/**
- * Resolve dependency between configs.
- * @param serviceName {String}
- * @param configs {Ember.Enumerable}
- */
- resolveServiceDependencyConfigs: function (serviceName, configs) {
- switch (serviceName) {
- case 'YARN':
- this.resolveYarnConfigs(configs);
- break;
- }
- },
-
- /**
- * Update some Storm configs
- * If SLIDER is selected to install or already installed,
- * some Yarn properties must be changed
- * @param {Ember.Enumerable} configs
- * @method resolveYarnConfigs
- */
- resolveYarnConfigs: function (configs) {
- var cfgToChange = configs.findProperty('name', 'hadoop.registry.rm.enabled');
- if (cfgToChange) {
- var res = this.get('allSelectedServiceNames').contains('SLIDER').toString();
- if (Em.get(cfgToChange, 'value') !== res) {
- Em.set(cfgToChange, 'recommendedValue', res);
- Em.set(cfgToChange, 'value', res);
- }
- }
- },
-
- /**
* On load function
* @method loadStep
*/
@@ -589,13 +637,13 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E
this.resolveConfigThemeConditions(configs);
this.set('groupsToDelete', this.get('wizardController').getDBProperty('groupsToDelete') || []);
- if (this.get('wizardController.name') === 'addServiceController') {
+ if (this.get('wizardController.name') === 'addServiceController' && !this.get('content.serviceConfigProperties.length')) {
App.router.get('configurationController').getConfigsByTags(this.get('serviceConfigTags')).done(function (loadedConfigs) {
configs = self.setInstalledServiceConfigs(configs, loadedConfigs, self.get('installedServiceNames'));
- self.applyServicesConfigs(configs, storedConfigs);
+ self.applyServicesConfigs(configs);
});
} else {
- this.applyServicesConfigs(configs, storedConfigs);
+ this.applyServicesConfigs(configs);
}
},
@@ -636,47 +684,50 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E
});
},
- applyServicesConfigs: function (configs, storedConfigs) {
+ applyServicesConfigs: function (configs) {
if (this.get('allSelectedServiceNames').contains('YARN')) {
configs = App.config.fileConfigsIntoTextarea(configs, 'capacity-scheduler.xml', []);
}
-
- ["YARN"].forEach(function (serviceName) {
- if (this.get('allSelectedServiceNames').contains(serviceName)) {
- this.resolveServiceDependencyConfigs(serviceName, configs);
- }
- }, this);
- //STEP 6: Distribute configs by service and wrap each one in App.ServiceConfigProperty (configs -> serviceConfigs)
if (App.get('isKerberosEnabled') && this.get('wizardController.name') == 'addServiceController') {
this.addKerberosDescriptorConfigs(configs, this.get('wizardController.kerberosDescriptorConfigs') || []);
}
- var serviceConfigs = this.renderConfigs(configs, storedConfigs, this.get('allSelectedServiceNames'), this.get('installedServiceNames'));
- this.setStepConfigs(serviceConfigs);
+ var stepConfigs = this.createStepConfigs();
+ var serviceConfigs = this.renderConfigs(stepConfigs, configs);
+ // if HA is enabled -> Make some reconfigurations
+ if (this.get('wizardController.name') === 'addServiceController' && App.get('isHaEnabled')) {
+ serviceConfigs = this._reconfigureServicesOnNnHa(serviceConfigs);
+ }
+ this.set('stepConfigs', serviceConfigs);
this.checkHostOverrideInstaller();
- this.activateSpecialConfigs();
this.selectProperService();
var self = this;
var rangerService = App.StackService.find().findProperty('serviceName', 'RANGER');
if (rangerService && !rangerService.get('isInstalled') && !rangerService.get('isSelected')) {
App.config.removeRangerConfigs(self.get('stepConfigs'));
}
- if (this.get('content.serviceConfigProperties.length') > 0) {
- this.completeConfigLoading();
- } else {
- this.loadServerSideConfigsRecommendations().always(function () {
- if (self.get('wizardController.name') == 'addServiceController') {
- // for Add Service just remove or add dependent properties and ignore config values changes
- // for installed services only
- self.addRemoveDependentConfigs(self.get('installedServiceNames'));
- self.clearDependenciesForInstalledServices(self.get('installedServiceNames'), self.get('stepConfigs'));
- }
- // * add dependencies based on recommendations
- // * update config values with recommended
- // * remove properties received from recommendations
- self.updateDependentConfigs();
- self.completeConfigLoading();
- });
+ this.loadServerSideConfigsRecommendations().always(function() {
+ self.updateConfigsRecommendations();
+ self.completeConfigLoading();
+ });
+ },
+
+ /**
+ * update dependent configs based on recommendations from
+ * stack adviser
+ *
+ * @method updateConfigsRecommendations
+ */
+ updateConfigsRecommendations: function() {
+ if (this.get('wizardController.name') == 'addServiceController') {
+ // for Add Service just remove or add dependent properties and ignore config values changes
+ // for installed services only
+ this.addRemoveDependentConfigs(this.get('installedServiceNames'));
+ this.clearDependenciesForInstalledServices(this.get('installedServiceNames'), this.get('stepConfigs'));
}
+ // * add dependencies based on recommendations
+ // * update config values with recommended
+ // * remove properties received from recommendations
+ this.updateDependentConfigs();
},
completeConfigLoading: function() {
@@ -726,130 +777,88 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E
},
/**
- * Set init <code>stepConfigs</code> value
- * Set <code>selected</code> for addable services if addServiceController is used
- * Remove SNameNode if HA is enabled (and if addServiceController is used)
- * @param {Ember.Object[]} serviceConfigs
- * @method setStepConfigs
+ * Create stepConfigs array with all info except configs list
+ *
+ * @return {Object[]}
+ * @method createStepConfigs
*/
- setStepConfigs: function (serviceConfigs) {
- if (this.get('wizardController.name') === 'addServiceController') {
- serviceConfigs.setEach('showConfig', true);
- serviceConfigs.setEach('selected', false);
- this.get('selectedServiceNames').forEach(function (serviceName) {
- if (!serviceConfigs.findProperty('serviceName', serviceName)) return;
- serviceConfigs.findProperty('serviceName', serviceName).set('selected', true);
- }, this);
- this.get('installedServiceNames').forEach(function (serviceName) {
- var serviceConfigObj = serviceConfigs.findProperty('serviceName', serviceName);
- var isInstallableService = App.StackService.find(serviceName).get('isInstallable');
- if (!isInstallableService) serviceConfigObj.set('showConfig', false);
- }, this);
- // if HA is enabled -> Remove SNameNode
- if (App.get('isHaEnabled')) {
- var c = serviceConfigs.findProperty('serviceName', 'HDFS').configs,
- removedConfigs = c.filterProperty('category', 'SECONDARY_NAMENODE');
- removedConfigs.setEach('isVisible', false);
- serviceConfigs.findProperty('serviceName', 'HDFS').configs = c;
-
- serviceConfigs = this._reconfigureServicesOnNnHa(serviceConfigs);
- }
- }
-
- // Remove Notifications from MISC if it isn't Installer Controller
- if (this.get('wizardController.name') !== 'installerController') {
- var miscService = serviceConfigs.findProperty('serviceName', 'MISC');
- if (miscService) {
- c = miscService.configs;
- removedConfigs = c.filterProperty('category', 'Notifications');
- removedConfigs.map(function (config) {
- c = c.without(config);
- });
- miscService.configs = c;
+ createStepConfigs: function() {
+ var stepConfigs = [];
+ App.config.get('preDefinedServiceConfigs').forEach(function (service) {
+ var serviceName = service.get('serviceName');
+ if (['MISC'].concat(this.get('allSelectedServiceNames')).contains(serviceName)) {
+ var serviceConfig = App.config.createServiceConfig(serviceName);
+ if (this.get('wizardController.name') == 'addServiceController') {
+ serviceConfig.set('selected', !this.get('installedServiceNames').concat('MISC').contains(serviceName));
+ if (serviceName === 'MISC') {
+ serviceConfig.set('configCategories', serviceConfig.get('configCategories').rejectProperty('name', 'Notifications'));
+ }
+ }
+ serviceConfig.set('showConfig', App.StackService.find(serviceName).get('isInstallable'));
+ stepConfigs.pushObject(serviceConfig);
}
- }
- this.set('stepConfigs', serviceConfigs);
+ }, this);
+ return stepConfigs;
},
/**
* render configs, distribute them by service
* and wrap each in ServiceConfigProperty object
+ * @param stepConfigs
* @param configs
- * @param storedConfigs
- * @param allSelectedServiceNames
- * @param installedServiceNames
* @return {App.ServiceConfig[]}
*/
- renderConfigs: function (configs, storedConfigs, allSelectedServiceNames, installedServiceNames) {
+ renderConfigs: function (stepConfigs, configs) {
var localDB = {
hosts: this.get('wizardController.content.hosts'),
masterComponentHosts: this.get('wizardController.content.masterComponentHosts'),
slaveComponentHosts: this.get('wizardController.content.slaveComponentHosts')
};
- var renderedServiceConfigs = [];
- var services = [];
-
- App.config.get('preDefinedServiceConfigs').forEach(function (serviceConfig) {
- var serviceName = serviceConfig.get('serviceName');
- if (allSelectedServiceNames.contains(serviceName) || serviceName === 'MISC') {
- if (!installedServiceNames.contains(serviceName) || serviceName === 'MISC') {
- serviceConfig.set('showConfig', true);
- }
- services.push(serviceConfig);
+ var configsByService = {}, dependencies = this.get('configDependencies');
+
+ stepConfigs.forEach(function (service) {
+ if (!configsByService[service.get('serviceName')]) {
+ configsByService[service.get('serviceName')] = service.get('configs');
}
- });
- services.forEach(function (service) {
- var configsByService = [];
- var dependencies = {};
- var serviceConfigs = [];
+ if (['addServiceController', 'installerController'].contains(this.get('wizardController.name'))) {
+ this.addHostNamesToConfigs(service, localDB.masterComponentHosts, localDB.slaveComponentHosts);
+ }
+ }, this);
- configs.forEach(function (config) {
- if (config.serviceName === service.get('serviceName')) {
- serviceConfigs.push(config);
- }
- if (config.filename === 'hive-site.xml' && config.name === 'hive.metastore.uris') {
- dependencies['hive.metastore.uris'] = config.recommendedValue;
- }
- if (config.filename === 'zoo.cfg.xml' && config.name === 'clientPort') {
- dependencies['clientPort'] = config.recommendedValue;
- }
- }, this);
- serviceConfigs.forEach(function (_config) {
+ configs.forEach(function (_config) {
+ if (configsByService[_config.serviceName]) {
var serviceConfigProperty = App.ServiceConfigProperty.create(_config);
this.updateHostOverrides(serviceConfigProperty, _config);
- if (!storedConfigs && !serviceConfigProperty.get('hasInitialValue')) {
+ if (this.get('wizardController.name') === 'addServiceController') {
+ this._updateIsEditableFlagForConfig(serviceConfigProperty, true);
+ }
+ if (!this.get('content.serviceConfigProperties.length') && !serviceConfigProperty.get('hasInitialValue')) {
App.ConfigInitializer.initialValue(serviceConfigProperty, localDB, dependencies);
}
serviceConfigProperty.validate();
- configsByService.pushObject(serviceConfigProperty);
- }, this);
- var serviceConfig = App.config.createServiceConfig(service.get('serviceName'));
- serviceConfig.set('showConfig', service.get('showConfig'));
- serviceConfig.set('configs', configsByService);
- if (['addServiceController', 'installerController'].contains(this.get('wizardController.name'))) {
- this.addHostNamesToConfigs(serviceConfig, localDB.masterComponentHosts, localDB.slaveComponentHosts);
+ configsByService[_config.serviceName].pushObject(serviceConfigProperty);
}
- renderedServiceConfigs.push(serviceConfig);
}, this);
- return renderedServiceConfigs;
+ return stepConfigs;
},
/**
* Add host name properties to appropriate categories (for installer and add service)
- * @param serviceConfig
- * @param masterComponents
- * @param slaveComponents
+ *
+ * @param {Object} serviceConfig
+ * @param {Object[]} masterComponents - info from localStorage
+ * @param {Object[]} slaveComponents - info from localStorage
*/
addHostNamesToConfigs: function(serviceConfig, masterComponents, slaveComponents) {
serviceConfig.get('configCategories').forEach(function(c) {
if (c.showHost) {
var value = [];
var componentName = c.name;
- var masters = masterComponents.filterProperty('component', componentName);
+ var masters = masterComponents && masterComponents.filterProperty('component', componentName);
if (masters.length) {
value = masters.mapProperty('hostName');
} else {
- var slaves = slaveComponents.findProperty('componentName', componentName);
+ var slaves = slaveComponents && slaveComponents.findProperty('componentName', componentName);
if (slaves) {
value = slaves.hosts.mapProperty('hostName');
}
@@ -991,6 +1000,8 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E
configsMap[configSite.type] = configSite.properties || {};
});
var allConfigs = configs.filter(function (_config) {
+ // filter out alert_notification configs on add service //TODO find better place for this!
+ if (_config.filename === 'alert_notification') return false;
if ((['MISC'].concat(installedServiceNames).contains(_config.serviceName))) {
var type = _config.filename ? App.config.getConfigTagFromFileName(_config.filename) : null;
var mappedConfigValue = type && configsMap[type] ? configsMap[type][_config.name] : null;
@@ -1003,13 +1014,14 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E
}
_config.value = App.config.formatPropertyValue(_config, mappedConfigValue);
_config.hasInitialValue = true;
+ this.updateDependencies(_config);
delete configsMap[type][_config.name];
return true;
}
} else {
return true;
}
- });
+ }, this);
//add user properties
Em.keys(configsMap).forEach(function (filename) {
Em.keys(configsMap[filename]).forEach(function (propertyName) {
@@ -1027,6 +1039,19 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E
},
/**
+ * update dependencies according to current config value
+ *
+ * @param config
+ */
+ updateDependencies: function(config) {
+ if (config.name === 'hive.metastore.uris' && config.filename === 'hive-site.xml') {
+ this.get('configDependencies')['hive.metastore.uris'] = config.savedValue;
+ } else if (config.name === 'clientPort' && config.filename === 'hive-site.xml') {
+ this.get('configDependencies')['clientPort'] = config.savedValue;
+ }
+ },
+
+ /**
* Add group ids to <code>groupsToDelete</code>
* Also save <code>groupsToDelete</code> to local storage
* @param {Ember.Object[]} groups
@@ -1208,32 +1233,6 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E
},
/**
- * Make some configs visible depending on active services
- * @method activateSpecialConfigs
- */
- activateSpecialConfigs: function () {
- if (this.get('addMiscTabToPage')) {
- var serviceToShow = this.get('selectedServiceNames').concat('MISC');
- var miscConfigs = this.get('stepConfigs').findProperty('serviceName', 'MISC').configs;
- if (this.get('wizardController.name') == "addServiceController") {
- miscConfigs.findProperty('name', 'smokeuser').set('isEditable', false);
- miscConfigs.findProperty('name', 'user_group').set('isEditable', false);
- if (this.get('content.smokeuser')) {
- miscConfigs.findProperty('name', 'smokeuser').set('value', this.get('content.smokeuser'));
- }
- if (this.get('content.group')) {
- miscConfigs.findProperty('name', 'user_group').set('value', this.get('content.group'));
- }
- }
- }
- var wizardController = this.get('wizardController');
- if (wizardController.get('name') === "kerberosWizardController") {
- var kerberosConfigs = this.get('stepConfigs').findProperty('serviceName', 'KERBEROS').configs;
- kerberosConfigs.findProperty('name', 'kdc_type').set('value', wizardController.get('content.kerberosOption'));
- }
- },
-
- /**
* Check whether hive New MySQL database is on the same host as Ambari server MySQL server
* @return {$.ajax|null}
* @method checkMySQLHost
http://git-wip-us.apache.org/repos/asf/ambari/blob/ef208aaa/ambari-web/app/data/HDP2/site_properties.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/data/HDP2/site_properties.js b/ambari-web/app/data/HDP2/site_properties.js
index 30591ec..385b1bf 100644
--- a/ambari-web/app/data/HDP2/site_properties.js
+++ b/ambari-web/app/data/HDP2/site_properties.js
@@ -1846,7 +1846,7 @@ var hdp2properties = [
"filename": "storm-env.xml",
"index": 12
}
-].concat(require('data/HDP2/alert_notification')).concat(require('data/HDP2/gluster_fs_properties'));
+].concat(require('data/HDP2/gluster_fs_properties'));
if (App.get('isHadoopWindowsStack')) {
var excludedWindowsConfigs = [
http://git-wip-us.apache.org/repos/asf/ambari/blob/ef208aaa/ambari-web/app/mappers.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers.js b/ambari-web/app/mappers.js
index 4b76455..312128b 100644
--- a/ambari-web/app/mappers.js
+++ b/ambari-web/app/mappers.js
@@ -24,7 +24,7 @@ require('mappers/stack_version_mapper');
require('mappers/configs/themes_mapper');
require('mappers/configs/stack_config_properties_mapper');
require('mappers/configs/config_groups_mapper');
-require('mappers/configs/config_versions_mapper');
+require('mappers/configs/service_config_version_mapper');
require('mappers/repository_version_mapper');
require('mappers/hosts_mapper');
require('mappers/cluster_mapper');
@@ -35,7 +35,6 @@ require('mappers/service_metrics_mapper');
require('mappers/target_cluster_mapper');
require('mappers/component_config_mapper');
require('mappers/components_state_mapper');
-require('mappers/service_config_version_mapper');
require('mappers/alert_definitions_mapper');
require('mappers/alert_definition_summary_mapper');
require('mappers/alert_instances_mapper');
http://git-wip-us.apache.org/repos/asf/ambari/blob/ef208aaa/ambari-web/app/mappers/configs/config_versions_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/configs/config_versions_mapper.js b/ambari-web/app/mappers/configs/config_versions_mapper.js
deleted file mode 100644
index 7ad1e37..0000000
--- a/ambari-web/app/mappers/configs/config_versions_mapper.js
+++ /dev/null
@@ -1,143 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-var App = require('app');
-
-App.configVersionsMapper = App.QuickDataMapper.create({
- model: App.ConfigVersion,
- propertyModel: App.ConfigProperty,
- config: {
- service_name: 'service_name',
- service_id: 'service_name',
- version: "service_config_version",
- create_time: 'createtime',
- group_id: 'group_id',
- group_name: 'group_name',
- hosts: 'hosts',
- author: 'user',
- notes: 'service_config_version_note',
- is_current: 'is_current',
- index: 'index',
- is_for_compare: 'is_for_compare'
- },
-
- map: function (json, isForCompare) {
- console.time("App.configVersionsMapper execution time");
- var configVersions = [];
- var itemIds = {};
- var serviceToHostMap = {};
- var requestedProperties = [];
-
- if (json && json.items) {
- json.items.forEach(function (item, index) {
- var parsedItem = this.parseIt(item, this.get('config'));
- parsedItem.id = parsedItem.service_name + '_' + parsedItem.version;
- parsedItem.is_requested = true;
- itemIds[parsedItem.id] = true;
- parsedItem.index = index;
- parsedItem.config_properties = [];
- parsedItem.is_for_compare = Boolean(isForCompare);
-
- if (serviceToHostMap[item.service_name]) {
- serviceToHostMap[item.service_name] = serviceToHostMap[item.service_name].concat(item.hosts);
- } else {
- serviceToHostMap[item.service_name] = item.hosts;
- }
-
- /**
- * parsing config properties for config version
- * @type {Array}
- */
- var properties = [];
- if (item.configurations) {
- item.configurations.forEach(function(config) {
- var type = config.type;
- var properties_array = Object.keys(config.properties);
- for (var i = 0; i < properties_array.length; i++) {
- var key = properties_array[i];
-
- var property = {
- id: key + '_' + type + '_' + item.service_config_version,
- name: key,
- file_name: App.config.getOriginalFileName(type),
- config_version_id: parsedItem.id,
- stack_config_property_id: key + '_' + type
- };
- property.value = property.recommended_value = config.properties[key];
- property.is_final = property.recommended_is_final = !!item.properties_attributes && item.properties_attributes.final[key] === "true";
-
- properties.push(property);
- requestedProperties.push(property.id);
- }
- }, this);
- }
- parsedItem.config_properties = parsedItem.config_properties.concat(properties.mapProperty('id'));
-
- App.store.loadMany(this.get('propertyModel'), properties);
-
- configVersions.push(parsedItem);
- }, this);
-
- this.get('model').find().forEach(function (item) {
- if (!itemIds[item.get('id')]) {
- item.set('isRequested', false);
- }
- });
- var itemTotal = parseInt(json.itemTotal);
- if (!isNaN(itemTotal)) {
- App.router.set('mainConfigHistoryController.filteredCount', itemTotal);
- }
-
- /**
- * this code sets hostNames for default config group
- * by excluding hostNames that belongs to not default groups
- * from list of all hosts
- */
- Object.keys(serviceToHostMap).forEach(function(sName) {
- var defaultHostNames = App.get('allHostNames');
- for (var i = 0; i < serviceToHostMap[sName].length; i++) {
- defaultHostNames = defaultHostNames.without(serviceToHostMap[sName][i]);
- }
- var defVer = configVersions.find(function(v) {
- return v.is_current && v.group_id == -1 && v.service_name == sName;
- });
- if (defVer) {
- defVer.hosts = defaultHostNames;
- }
- });
- App.store.commit();
- App.store.loadMany(this.get('model'), configVersions);
-
- this.deleteUnusedProperties(requestedProperties);
- }
- console.timeEnd("App.configVersionsMapper execution time");
- },
-
-
- /**
- * delete unused Properties
- * @param requestedProperties
- */
- deleteUnusedProperties: function(requestedProperties) {
- App.ConfigProperty.find().filterProperty('id').forEach(function(p) {
- if (!requestedProperties.contains(p.get('id'))) {
- this.deleteRecord(p);
- }
- }, this);
- }
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/ef208aaa/ambari-web/app/mappers/configs/service_config_version_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/configs/service_config_version_mapper.js b/ambari-web/app/mappers/configs/service_config_version_mapper.js
new file mode 100644
index 0000000..e58a7c3
--- /dev/null
+++ b/ambari-web/app/mappers/configs/service_config_version_mapper.js
@@ -0,0 +1,116 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+
+App.serviceConfigVersionsMapper = App.QuickDataMapper.create({
+ model: App.ServiceConfigVersion,
+ config: {
+ service_name: 'service_name',
+ service_id: 'service_name',
+ version: "service_config_version",
+ create_time: 'createtime',
+ group_id: 'group_id',
+ group_name: 'group_name',
+ hosts: 'hosts',
+ author: 'user',
+ notes: 'service_config_version_note',
+ is_current: 'is_current',
+ index: 'index',
+ stack_version: 'stack_id',
+ is_compatible: 'is_cluster_compatible'
+ },
+ map: function (json) {
+ console.time('App.serviceConfigVersionsMapper');
+ var result = [];
+ var itemIds = {};
+ var serviceToHostMap = {};
+ var currentVersionsMap = {};
+
+ if (json && json.items) {
+ App.ServiceConfigVersion.find().forEach(function (v) {
+ if (v.get('isCurrent')) {
+ currentVersionsMap[v.get('serviceName') + "_" + v.get('groupName')] = v;
+ }
+ });
+
+ json.items.forEach(function (item, index) {
+ var parsedItem = this.parseIt(item, this.get('config'));
+ parsedItem.id = this.makeId(parsedItem.service_name, parsedItem.version);
+ parsedItem.is_requested = true;
+ parsedItem.create_time = App.dateTimeWithTimeZone(parsedItem.create_time);
+ itemIds[parsedItem.id] = true;
+ parsedItem.index = index;
+ if (serviceToHostMap[item.service_name]) {
+ serviceToHostMap[item.service_name] = serviceToHostMap[item.service_name].concat(item.hosts);
+ } else {
+ serviceToHostMap[item.service_name] = item.hosts;
+ }
+
+ // if loaded only latest versions(later than current), then current version should be reset
+ if (parsedItem.is_current && currentVersionsMap[parsedItem.service_name + "_" + parsedItem.group_name]) {
+ currentVersionsMap[parsedItem.service_name + "_" + parsedItem.group_name].set('isCurrent', false);
+ }
+ result.push(parsedItem);
+ }, this);
+
+ var itemTotal = parseInt(json.itemTotal);
+ if (!isNaN(itemTotal)) {
+ App.router.set('mainConfigHistoryController.filteredCount', itemTotal);
+ }
+
+ /**
+ * this code sets hostNames for default config group
+ * by excluding hostNames that belongs to not default groups
+ * from list of all hosts
+ */
+ Object.keys(serviceToHostMap).forEach(function(sName) {
+ var defaultHostNames = App.get('allHostNames');
+ for (var i = 0; i < serviceToHostMap[sName].length; i++) {
+ defaultHostNames = defaultHostNames.without(serviceToHostMap[sName][i]);
+ }
+ var defVer = result.find(function(v) {
+ return v.is_current && v.group_id == -1 && v.service_name == sName;
+ });
+ if (defVer) {
+ defVer.hosts = defaultHostNames;
+ }
+ });
+
+ // If on config history page, need to clear the model
+ if (App.router.get('currentState.name') === 'configHistory') {
+ this.get('model').find().clear();
+ }
+ App.store.commit();
+ App.store.loadMany(this.get('model'), result);
+ console.timeEnd('App.serviceConfigVersionsMapper');
+ }
+ },
+
+ /**
+ * Conventional method to generate id for instances of <code>App.ServiceConfigVersion</code> model.
+ *
+ * @param {String} serviceName
+ * @param {Number|String} version
+ * @returns {String}
+ */
+ makeId: function(serviceName, version) {
+ return serviceName + '_' + version;
+ }
+
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/ef208aaa/ambari-web/app/mappers/configs/stack_config_properties_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/configs/stack_config_properties_mapper.js b/ambari-web/app/mappers/configs/stack_config_properties_mapper.js
index 87c43f7..750a7af 100644
--- a/ambari-web/app/mappers/configs/stack_config_properties_mapper.js
+++ b/ambari-web/app/mappers/configs/stack_config_properties_mapper.js
@@ -86,7 +86,7 @@ App.stackConfigPropertiesMapper = App.QuickDataMapper.create({
var attributes = config.StackConfigurations.property_value_attributes;
if (attributes) {
config.is_required = !attributes.empty_value_valid;
- config.is_reconfigurable = !attributes.editable_only_at_install;
+ config.is_reconfigurable = !(attributes.editable_only_at_install || config.StackConfigurations.type === 'cluster-env.xml');
config.is_editable = !attributes.read_only;
config.is_required_by_agent = !attributes.ui_only_property;
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/ef208aaa/ambari-web/app/mappers/service_config_version_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/service_config_version_mapper.js b/ambari-web/app/mappers/service_config_version_mapper.js
deleted file mode 100644
index e58a7c3..0000000
--- a/ambari-web/app/mappers/service_config_version_mapper.js
+++ /dev/null
@@ -1,116 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-var App = require('app');
-
-App.serviceConfigVersionsMapper = App.QuickDataMapper.create({
- model: App.ServiceConfigVersion,
- config: {
- service_name: 'service_name',
- service_id: 'service_name',
- version: "service_config_version",
- create_time: 'createtime',
- group_id: 'group_id',
- group_name: 'group_name',
- hosts: 'hosts',
- author: 'user',
- notes: 'service_config_version_note',
- is_current: 'is_current',
- index: 'index',
- stack_version: 'stack_id',
- is_compatible: 'is_cluster_compatible'
- },
- map: function (json) {
- console.time('App.serviceConfigVersionsMapper');
- var result = [];
- var itemIds = {};
- var serviceToHostMap = {};
- var currentVersionsMap = {};
-
- if (json && json.items) {
- App.ServiceConfigVersion.find().forEach(function (v) {
- if (v.get('isCurrent')) {
- currentVersionsMap[v.get('serviceName') + "_" + v.get('groupName')] = v;
- }
- });
-
- json.items.forEach(function (item, index) {
- var parsedItem = this.parseIt(item, this.get('config'));
- parsedItem.id = this.makeId(parsedItem.service_name, parsedItem.version);
- parsedItem.is_requested = true;
- parsedItem.create_time = App.dateTimeWithTimeZone(parsedItem.create_time);
- itemIds[parsedItem.id] = true;
- parsedItem.index = index;
- if (serviceToHostMap[item.service_name]) {
- serviceToHostMap[item.service_name] = serviceToHostMap[item.service_name].concat(item.hosts);
- } else {
- serviceToHostMap[item.service_name] = item.hosts;
- }
-
- // if loaded only latest versions(later than current), then current version should be reset
- if (parsedItem.is_current && currentVersionsMap[parsedItem.service_name + "_" + parsedItem.group_name]) {
- currentVersionsMap[parsedItem.service_name + "_" + parsedItem.group_name].set('isCurrent', false);
- }
- result.push(parsedItem);
- }, this);
-
- var itemTotal = parseInt(json.itemTotal);
- if (!isNaN(itemTotal)) {
- App.router.set('mainConfigHistoryController.filteredCount', itemTotal);
- }
-
- /**
- * this code sets hostNames for default config group
- * by excluding hostNames that belongs to not default groups
- * from list of all hosts
- */
- Object.keys(serviceToHostMap).forEach(function(sName) {
- var defaultHostNames = App.get('allHostNames');
- for (var i = 0; i < serviceToHostMap[sName].length; i++) {
- defaultHostNames = defaultHostNames.without(serviceToHostMap[sName][i]);
- }
- var defVer = result.find(function(v) {
- return v.is_current && v.group_id == -1 && v.service_name == sName;
- });
- if (defVer) {
- defVer.hosts = defaultHostNames;
- }
- });
-
- // If on config history page, need to clear the model
- if (App.router.get('currentState.name') === 'configHistory') {
- this.get('model').find().clear();
- }
- App.store.commit();
- App.store.loadMany(this.get('model'), result);
- console.timeEnd('App.serviceConfigVersionsMapper');
- }
- },
-
- /**
- * Conventional method to generate id for instances of <code>App.ServiceConfigVersion</code> model.
- *
- * @param {String} serviceName
- * @param {Number|String} version
- * @returns {String}
- */
- makeId: function(serviceName, version) {
- return serviceName + '_' + version;
- }
-
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/ef208aaa/ambari-web/app/mixins/common/serverValidator.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/serverValidator.js b/ambari-web/app/mixins/common/serverValidator.js
index 5190cc5..a1c7eba 100644
--- a/ambari-web/app/mixins/common/serverValidator.js
+++ b/ambari-web/app/mixins/common/serverValidator.js
@@ -121,7 +121,6 @@ App.ServerValidatorMixin = Em.Mixin.create({
* @returns {*}
*/
loadServerSideConfigsRecommendations: function() {
- var self = this;
// if extended controller doesn't support recommendations ignore this call but keep promise chain
if (!this.get('isControllerSupportsEnhancedConfigs')) {
return $.Deferred().resolve().promise();
http://git-wip-us.apache.org/repos/asf/ambari/blob/ef208aaa/ambari-web/app/models.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models.js b/ambari-web/app/models.js
index d221651..e1bceec 100644
--- a/ambari-web/app/models.js
+++ b/ambari-web/app/models.js
@@ -64,7 +64,6 @@ require('models/configs/theme/theme_condition');
require('models/configs/service_config_version');
require('models/configs/stack_config_property');
require('models/configs/config_group');
-require('models/configs/config_version');
require('models/configs/theme/tab');
require('models/configs/theme/section');
require('models/configs/theme/sub_section');
http://git-wip-us.apache.org/repos/asf/ambari/blob/ef208aaa/ambari-web/app/models/configs/config_property.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/configs/config_property.js b/ambari-web/app/models/configs/config_property.js
deleted file mode 100644
index bede126..0000000
--- a/ambari-web/app/models/configs/config_property.js
+++ /dev/null
@@ -1,236 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-var App = require('app');
-
-App.ConfigProperty = DS.Model.extend({
-
- /**
- * id is consist of property <code>name<code>+<code>fileName<code>+<code>configVersion.version<code>
- */
- id: DS.attr('string'),
-
- /**
- * config property name
- * @property {string}
- */
- name: DS.attr('string'),
-
- /**
- * config property name
- * @property {string}
- */
- fileName: DS.attr('string'),
-
- /**
- * value of property
- * by default is same as <code>savedValue<code>
- * @property {string}
- */
- value: DS.attr('string'),
-
- /**
- * saved value of property
- * @property {string}
- */
- savedValue: DS.attr('string'),
-
- /**
- * recommended value of property
- * that is returned from server
- * @property {string}
- */
- recommendedValue: DS.attr('string'),
-
- /**
- * defines if property is final
- * @property {boolean}
- */
- isFinal: DS.attr('boolean', {defaultValue: false}),
-
-
- /**
- * value saved on cluster
- */
- savedIsFinal: DS.attr('boolean', {defaultValue: false}),
-
- /**
- * value recommendedFrom Server
- * @property {boolean}
- */
- recommendedIsFinal: DS.attr('boolean', {defaultValue: false}),
-
- /**
- * link to config version
- * @property {App.ConfigVersion}
- */
- configVersion: DS.belongsTo('App.ConfigVersion'),
-
- /**
- * link to config version
- * from this model we can get all static info about property
- * @property {App.ConfigVersion}
- */
- stackConfigProperty: DS.belongsTo('App.StackConfigProperty'),
-
- /**
- * defines if property should be visible for user
- * all properties that has <code>isVisible<code> false will be present in model
- * and saved but will be hidden from user
- * @property {boolean}
- */
- isVisible: DS.attr('boolean', {defaultValue: true}),
-
- /**
- * defines if property value is required
- * in case user enter empty value error will be shown
- * @property {boolean}
- */
- isRequired: DS.attr('boolean', {defaultValue: true}),
-
- /**
- * defines if property can be edited by user
- * @property {boolean}
- */
- isEditable: DS.attr('boolean', {defaultValue: true}),
-
- /**
- * opposite to <code>isEditable<code> property
- * @property {boolean}
- */
- isNotEditable: Ember.computed.not('isEditable'),
-
- /**
- * defines if property can contain overriden values
- * @property {boolean}
- */
- isOverridable: DS.attr('boolean', {defaultValue: true}),
-
- /**
- * defines if property is used for security
- * @property {boolean}
- */
- isSecureConfig: DS.attr('boolean', {defaultValue: false}),
-
- /**
- * if false - don't save property
- * @property {boolean}
- */
- isRequiredByAgent: DS.attr('boolean', {defaultValue: true}),
-
- /**
- * if true - property is not saved
- * used for properties added by user
- * @property {boolean}
- */
- isNotSaved: DS.attr('boolean', {defaultValue: false}),
-
- /**
- * if true - don't show property
- * @property {boolean}
- */
- isHiddenByFilter: DS.attr('boolean', {defaultValue: false}),
-
- /**
- * properties with this flag set to false will not be saved
- * @property {boolean}
- */
- saveRecommended: DS.attr('boolean', {defaultValue: true}),
-
- /**
- * Don't show "Undo" for hosts on Installer Step7
- * if value is true
- * @property {boolean}
- */
- cantBeUndone: DS.attr('boolean', {defaultValue: false}),
-
- /**
- * error message; by default is empty
- * if value is not correct or missing for required property
- * this will contain error message
- * @property {string}
- */
- errorMessage: DS.attr('string', {defaultValue: ''}),
-
- /**
- * warning message; by default is empty
- * if value is out of recommended range
- * this will contain warning message
- * @property {string}
- */
- warnMessage: DS.attr('string', {defaultValue: ''}),
-
- /**
- * defines if property has errors
- * @type {boolean}
- */
- hasErrors: Em.computed.notEqual('errorMessage', ''),
-
- /**
- * defines if property has warnings
- * @type {boolean}
- */
- hasWarnings: Em.computed.notEqual('warnMessage', ''),
-
- /**
- * defines if property belongs to default config group
- * if true it's config group is default
- * @type {boolean}
- */
- isOriginalSCP: Em.computed.alias('configVersion.isDefault'),
-
- /**
- * defines if property is added by user
- * @property {boolean}
- */
- isUserProperty: function() {
- return Em.isNone(this.get('stackConfigProperty'));
- }.property('stackConfigProperty'),
-
- /**
- * defines if this property is belongs to version
- * with which we make comparison
- * @property {boolean}
- */
- isForCompare: Em.computed.alias('configVersion.isForCompare'),
-
- /**
- * if this property can be final
- * @property {boolean}
- */
- supportsFinal: Em.computed.or('stackConfigProperty.supportsFinal', 'isUserProperty'),
- /**
- * Indicates when value is not the default value.
- * Returns false when there is no default value.
- * @type {boolean}
- */
- isNotDefaultValue: function () {
- return this.get('isEditable')
- && (!Em.isNone(this.get('savedValue') && this.get('value') !== this.get('savedValue'))
- || (this.get('supportsFinal') && !Em.isNone(this.get('savedIsFinal')) && this.get('isFinal') !== this.get('savedIsFinal')));
- }.property('value', 'savedValue', 'isEditable', 'isFinal', 'savedIsFinal'),
-
- /**
- * opposite to <code>hasErrors<code>
- */
- isValid: Ember.computed.not('hasErrors')
-});
-
-
-App.ConfigProperty.FIXTURES = [];
-
http://git-wip-us.apache.org/repos/asf/ambari/blob/ef208aaa/ambari-web/app/models/configs/config_version.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/configs/config_version.js b/ambari-web/app/models/configs/config_version.js
deleted file mode 100644
index 4acb664..0000000
--- a/ambari-web/app/models/configs/config_version.js
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-var App = require('app');
-
-App.ConfigVersion = App.ServiceConfigVersion.extend({
- configProperties: DS.hasMany('App.ConfigProperty'),
-
- /**
- * this flag is true when we compare some version with
- * this config version
- * this flag make influence on displaying properties
- * @property {boolean} [isForCompare=false]
- */
- isForCompare: DS.attr('boolean', {defaultValue: false})
-});
-
-App.ConfigVersion.FIXTURES = [];
http://git-wip-us.apache.org/repos/asf/ambari/blob/ef208aaa/ambari-web/app/models/configs/stack_config_property.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/configs/stack_config_property.js b/ambari-web/app/models/configs/stack_config_property.js
index 1083b3f..fd041bf 100644
--- a/ambari-web/app/models/configs/stack_config_property.js
+++ b/ambari-web/app/models/configs/stack_config_property.js
@@ -17,7 +17,7 @@
*/
var App = require('app');
-
+//TODO delete this file soon
App.StackConfigProperty = DS.Model.extend({
/**
* id is consist of property <code>name<code>+<code>fileName<code>
http://git-wip-us.apache.org/repos/asf/ambari/blob/ef208aaa/ambari-web/app/models/stack_service.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/stack_service.js b/ambari-web/app/models/stack_service.js
index 88e2bfa..8295ef8 100644
--- a/ambari-web/app/models/stack_service.js
+++ b/ambari-web/app/models/stack_service.js
@@ -211,9 +211,11 @@ App.StackService.configCategories = function () {
var serviceConfigCategories = [];
switch (this.get('serviceName')) {
case 'HDFS':
+ serviceConfigCategories.pushObject(App.ServiceConfigCategory.create({ name: 'NAMENODE', displayName: 'NameNode', showHost: true}));
+ if (!App.get('isHaEnabled')) {
+ serviceConfigCategories.pushObject(App.ServiceConfigCategory.create({ name: 'SECONDARY_NAMENODE', displayName: 'Secondary NameNode', showHost: true}));
+ }
serviceConfigCategories.pushObjects([
- App.ServiceConfigCategory.create({ name: 'NAMENODE', displayName: 'NameNode', showHost: true}),
- App.ServiceConfigCategory.create({ name: 'SECONDARY_NAMENODE', displayName: 'Secondary NameNode', showHost: true}),
App.ServiceConfigCategory.create({ name: 'DATANODE', displayName: 'DataNode', showHost: true}),
App.ServiceConfigCategory.create({ name: 'General', displayName: 'General'}),
App.ServiceConfigCategory.create({ name: 'NFS_GATEWAY', displayName: 'NFS Gateway', showHost: true})
http://git-wip-us.apache.org/repos/asf/ambari/blob/ef208aaa/ambari-web/app/utils/config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/config.js b/ambari-web/app/utils/config.js
index be3a2dc..c27ed68 100644
--- a/ambari-web/app/utils/config.js
+++ b/ambari-web/app/utils/config.js
@@ -225,7 +225,6 @@ App.config = Em.Object.create({
*/
mergePredefinedWithSaved: function (configGroups, serviceName, selectedConfigGroup, canEdit) {
var configs = [];
- var serviceByConfigTypeMap = this.get('serviceByConfigTypeMap');
configGroups.forEach(function (siteConfig) {
var filename = App.config.getOriginalFileName(siteConfig.type);
@@ -526,9 +525,9 @@ App.config = Em.Object.create({
/**
* create new ServiceConfig object by service name
* @param {string} serviceName
- * @param {App.ServiceConfigGroup[]} configGroups
- * @param {App.ServiceConfigProperty[]} configs
- * @param {Number} initConfigsLength
+ * @param {App.ServiceConfigGroup[]} [configGroups]
+ * @param {App.ServiceConfigProperty[]} [configs]
+ * @param {Number} [initConfigsLength]
* @return {App.ServiceConfig}
* @method createServiceConfig
*/
@@ -603,69 +602,6 @@ App.config = Em.Object.create({
},
/**
- * Get properties from server by type and tag with properties, that belong to group
- * push them to common {serviceConfigs} and call callback function
- */
- loadServiceConfigGroupOverrides: function (serviceConfigs, loadedGroupToOverrideSiteToTagMap, configGroups, callback, sender) {
- var configKeyToConfigMap = {};
- serviceConfigs.forEach(function (item) {
- if (!configKeyToConfigMap[item.filename]) {
- configKeyToConfigMap[item.filename] = {};
- }
- configKeyToConfigMap[item.filename][item.name] = item;
- });
- var typeTagToGroupMap = {};
- var urlParams = [];
- for (var group in loadedGroupToOverrideSiteToTagMap) {
- var overrideTypeTags = loadedGroupToOverrideSiteToTagMap[group];
- for (var type in overrideTypeTags) {
- var tag = overrideTypeTags[type];
- typeTagToGroupMap[type + "///" + tag] = configGroups.findProperty('name', group);
- urlParams.push('(type=' + type + '&tag=' + tag + ')');
- }
- }
- var params = urlParams.join('|');
- if (urlParams.length) {
- App.ajax.send({
- name: 'config.host_overrides',
- sender: this,
- data: {
- params: params,
- configKeyToConfigMap: configKeyToConfigMap,
- typeTagToGroupMap: typeTagToGroupMap,
- callback: callback,
- sender: sender,
- serviceConfigs: serviceConfigs
- },
- success: 'loadServiceConfigGroupOverridesSuccess'
- });
- } else {
- callback.call(sender, serviceConfigs);
- }
- },
-
- loadServiceConfigGroupOverridesSuccess: function (data, opt, params) {
- data.items.forEach(function (config) {
- var group = params.typeTagToGroupMap[config.type + "///" + config.tag];
- var properties = config.properties;
- for (var prop in properties) {
- var fileName = this.getOriginalFileName(config.type);
- var serviceConfig = !!params.configKeyToConfigMap[fileName] ? params.configKeyToConfigMap[fileName][prop] : false;
- var hostOverrideValue = this.formatPropertyValue(serviceConfig, properties[prop]);
- var hostOverrideIsFinal = !!(config.properties_attributes && config.properties_attributes.final && config.properties_attributes.final[prop]);
- if (serviceConfig) {
- // Value of this property is different for this host.
- if (!Em.get(serviceConfig, 'overrides')) Em.set(serviceConfig, 'overrides', []);
- serviceConfig.overrides.pushObject({value: hostOverrideValue, group: group, isFinal: hostOverrideIsFinal});
- } else {
- params.serviceConfigs.push(this.createCustomGroupConfig(prop, config, group));
- }
- }
- }, this);
- params.callback.call(params.sender, params.serviceConfigs);
- },
-
- /**
* Create config with non default config group. Some custom config properties
* can be created and assigned to non-default config group.
*
http://git-wip-us.apache.org/repos/asf/ambari/blob/ef208aaa/ambari-web/app/utils/configs/config_initializer.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/configs/config_initializer.js b/ambari-web/app/utils/configs/config_initializer.js
index 447e514..56ff46e 100644
--- a/ambari-web/app/utils/configs/config_initializer.js
+++ b/ambari-web/app/utils/configs/config_initializer.js
@@ -265,6 +265,7 @@ App.ConfigInitializer = App.ConfigInitializerClass.create({
},
uniqueInitializers: {
+ 'hadoop.registry.rm.enabled': '_setYarnSliderDependency',
'ranger_admin_password': '_setRangerAdminPassword',
'hive_database': '_initHiveDatabaseValue',
'templeton.hive.properties': '_initTempletonHiveProperties',
@@ -298,7 +299,7 @@ App.ConfigInitializer = App.ConfigInitializerClass.create({
/**
* Some strange method that should define <code>ranger_admin_password</code>
- * TODO DELETE as soon as <code>ranger_admin_password</code> will be defined in stack!
+ * TODO DELETE as soon as <code>ranger_admin_password</code> will be fetched from stack adviser!
*
* @param {configProperty} configProperty
* @private
@@ -309,6 +310,24 @@ App.ConfigInitializer = App.ConfigInitializerClass.create({
return configProperty;
},
+
+ /**
+ * Set specific config for YARN that depends on SLIDER.
+ * TODO DELETE as soon as <code>hadoop.registry.rm.enabled</code> will be fetched from stack adviser!
+ *
+ * @param configProperty
+ * @param localDb
+ * @param dependencies
+ * @private
+ */
+ _setYarnSliderDependency: function(configProperty, localDb, dependencies) {
+ var res = (!!dependencies.sliderSelected).toString();
+ if (Em.get(configProperty, 'value') !== res) {
+ Em.set(configProperty, 'recommendedValue', res);
+ Em.set(configProperty, 'value', res);
+ }
+ },
+
/**
* Initializer for configs with value equal to hostName with needed component
* Value example: 'hostName'
http://git-wip-us.apache.org/repos/asf/ambari/blob/ef208aaa/ambari-web/test/controllers/main/admin/kerberos/step4_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/kerberos/step4_controller_test.js b/ambari-web/test/controllers/main/admin/kerberos/step4_controller_test.js
index e4abd82..44b60f7 100644
--- a/ambari-web/test/controllers/main/admin/kerberos/step4_controller_test.js
+++ b/ambari-web/test/controllers/main/admin/kerberos/step4_controller_test.js
@@ -67,7 +67,7 @@ describe('App.KerberosWizardStep4Controller', function() {
sinon.stub(App.Service, 'find').returns(Em.A([
{ serviceName: 'HDFS' }
]));
- sinon.stub(App.config, 'get').withArgs('preDefinedSiteProperties').returns([
+ sinon.stub(App.configsCollection, 'getAll').returns([
{
name: 'hadoop.security.auth_to_local',
displayType: 'multiLine'
@@ -79,7 +79,7 @@ describe('App.KerberosWizardStep4Controller', function() {
after(function() {
App.Service.find.restore();
- App.config.get.restore();
+ App.configsCollection.getAll.restore();
App.router.get.restore();
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/ef208aaa/ambari-web/test/controllers/main/admin/kerberos_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/kerberos_test.js b/ambari-web/test/controllers/main/admin/kerberos_test.js
index b63d1e1..6eb2bab 100644
--- a/ambari-web/test/controllers/main/admin/kerberos_test.js
+++ b/ambari-web/test/controllers/main/admin/kerberos_test.js
@@ -56,7 +56,7 @@ describe('App.MainAdminKerberosController', function() {
});
it('should take displayType from predefinedSiteProperties', function () {
- sinon.stub(App.config, 'get').withArgs('preDefinedSiteProperties').returns([
+ sinon.stub(App.configsCollection, 'getAll').returns([
{
name: 'hadoop.security.auth_to_local',
displayType: 'multiLine'
@@ -68,7 +68,7 @@ describe('App.MainAdminKerberosController', function() {
serviceName: 'HDFS'
})
])[0].get('displayType')).to.equal('multiLine');
- App.config.get.restore();
+ App.configsCollection.getAll.restore();
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/ef208aaa/ambari-web/test/controllers/main/admin/serviceAccounts_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/serviceAccounts_controller_test.js b/ambari-web/test/controllers/main/admin/serviceAccounts_controller_test.js
index aec7274..b7aa761 100644
--- a/ambari-web/test/controllers/main/admin/serviceAccounts_controller_test.js
+++ b/ambari-web/test/controllers/main/admin/serviceAccounts_controller_test.js
@@ -25,88 +25,6 @@ describe('App.MainAdminServiceAccountsController', function () {
var controller = App.MainAdminServiceAccountsController.create();
- describe('#setContentProperty()', function () {
- var testCases = [
- {
- title: 'key is null',
- content: {
- key: null,
- configName: 'cc',
- miscConfigs: []
- },
- result: {
- output: false,
- configValue: 'test'
- }
- },
- {
- title: 'configName is null',
- content: {
- key: 'key',
- configName: null,
- miscConfigs: []
- },
- result: {
- output: false,
- configValue: 'test'
- }
- },
- {
- title: 'misc configs array doesn\'t contain such a config',
- content: {
- key: 'key',
- configName: 'config1',
- miscConfigs: []
- },
- result: {
- output: false,
- configValue: 'test'
- }
- },
- {
- title: 'content doesn\'t contain such a key',
- content: {
- key: 'key',
- configName: 'config1',
- miscConfigs: [
- Em.Object.create({
- name: 'test_key'
- })
- ]
- },
- result: {
- output: false,
- configValue: 'test'
- }
- },
- {
- title: 'content property match config',
- content: {
- key: 'testKey',
- configName: 'test_key',
- miscConfigs: [
- Em.Object.create({
- name: 'test_key',
- value: 'testValue'
- })
- ]
- },
- result: {
- output: true,
- configValue: 'testValue'
- }
- }
- ];
- controller.set('content', Em.Object.create({testKey: 'test'}));
- testCases.forEach(function (test) {
- it(test.title, function () {
- var content = controller.get('content');
- expect(controller.setContentProperty(test.content.key, test.content.configName, test.content.miscConfigs)).to.equal(test.result.output);
- expect(content.get('testKey')).to.equal(test.result.configValue);
- });
- });
- });
-
describe('#sortByOrder()', function () {
var testCases = [
{