You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sr...@apache.org on 2014/07/25 01:15:49 UTC
git commit: AMBARI-6603. Install wizard should have ability to load
default 'final' configs, and save them
Repository: ambari
Updated Branches:
refs/heads/trunk 31242e8f7 -> be9e0b8cb
AMBARI-6603. Install wizard should have ability to load default 'final' configs, and save them
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/be9e0b8c
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/be9e0b8c
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/be9e0b8c
Branch: refs/heads/trunk
Commit: be9e0b8cbe39a85ab0a03d03e83c86914638c451
Parents: 31242e8
Author: Srimanth Gunturi <sg...@hortonworks.com>
Authored: Thu Jul 24 15:05:11 2014 -0700
Committer: Srimanth Gunturi <sg...@hortonworks.com>
Committed: Thu Jul 24 15:05:11 2014 -0700
----------------------------------------------------------------------
.../controllers/main/service/info/configs.js | 28 ++++------------
ambari-web/app/controllers/wizard.js | 26 ++++++++++++---
.../app/controllers/wizard/step8_controller.js | 33 ++++++++++++-------
ambari-web/app/models/service_config.js | 10 ++++--
ambari-web/app/utils/config.js | 34 ++++++++++++++++++++
.../app/views/common/configs/services_config.js | 6 ++++
6 files changed, 97 insertions(+), 40 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/be9e0b8c/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 24e20e7..418e830 100644
--- a/ambari-web/app/controllers/main/service/info/configs.js
+++ b/ambari-web/app/controllers/main/service/info/configs.js
@@ -30,6 +30,10 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
selectedService: null,
serviceConfigTags: null,
selectedConfigGroup: null,
+ configTypesInfo: {
+ items: [],
+ supportsFinal: []
+ },
selectedServiceConfigTypes: [],
selectedServiceSupportsFinal: [],
configGroups: [],
@@ -186,26 +190,8 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
var serviceName = this.get('content.serviceName');
var stackService = App.StackService.find().findProperty('serviceName', serviceName);
- if (stackService != null) {
- var configTypes = stackService.get('configTypes');
- if (configTypes) {
- var configTypesInfo = {
- items : [],
- supportsFinal : []
- };
- for ( var key in configTypes) {
- if (configTypes.hasOwnProperty(key)) {
- configTypesInfo.items.push(key);
- if (configTypes[key].supports && configTypes[key].supports.final === "true") {
- configTypesInfo.supportsFinal.push(key);
- }
- }
- }
- for ( var configType in configTypes) {
- self.set('selectedServiceConfigTypes', configTypesInfo.items || []);
- self.set('selectedServiceSupportsFinal', configTypesInfo.supportsFinal || []);
- }
- }
+ if (stackService) {
+ self.set('configTypesInfo', App.config.getConfigTypesInfoFromService(stackService));
}
App.config.loadAdvancedConfig(serviceName, function (properties) {
@@ -679,7 +665,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
*/
setSupportsFinal: function (serviceConfigProperty) {
var fileName = serviceConfigProperty.get('filename');
- var matchingConfigTypes = this.get('selectedServiceSupportsFinal').filter(function(configType) {
+ var matchingConfigTypes = this.get('configTypesInfo').supportsFinal.filter(function(configType) {
return fileName.startsWith(configType);
});
serviceConfigProperty.set('supportsFinal', matchingConfigTypes.length > 0);
http://git-wip-us.apache.org/repos/asf/ambari/blob/be9e0b8c/ambari-web/app/controllers/wizard.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard.js b/ambari-web/app/controllers/wizard.js
index efc3b9e..805e94b 100644
--- a/ambari-web/app/controllers/wizard.js
+++ b/ambari-web/app/controllers/wizard.js
@@ -784,14 +784,27 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, {
*/
loadAdvancedConfigs: function (dependentController) {
var self = this;
- var stackServices = this.get('content.services').filter(function(service){
+ var stackServices = this.get('content.services').filter(function (service) {
return service.get('isInstalled') || service.get('isSelected');
- }).mapProperty('serviceName');
+ });
var counter = stackServices.length;
var loadAdvancedConfigResult = [];
dependentController.set('isAdvancedConfigLoaded', false);
- stackServices.forEach(function (_serviceName) {
- App.config.loadAdvancedConfig(_serviceName, function (properties) {
+ stackServices.forEach(function (service) {
+ var serviceName = service.get('serviceName');
+ App.config.loadAdvancedConfig(serviceName, function (properties) {
+ var supportsFinal = App.config.getConfigTypesInfoFromService(service).supportsFinal;
+
+ function shouldSupportFinal(filename) {
+ var matchingConfigTypes = supportsFinal.filter(function (configType) {
+ return filename.startsWith(configType);
+ });
+ return (matchingConfigTypes.length > 0);
+ }
+
+ properties.forEach(function (property) {
+ property.supportsFinal = shouldSupportFinal(property.filename);
+ });
loadAdvancedConfigResult.pushObjects(properties);
counter--;
//pass configs to controller after last call is completed
@@ -834,6 +847,9 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, {
serviceName: _configProperties.get('serviceName'),
domain: _configProperties.get('domain'),
isVisible: _configProperties.get('isVisible'),
+ isFinal: _configProperties.get('isFinal'),
+ defaultIsFinal: _configProperties.get('isFinal'),
+ supportsFinal: _configProperties.get('supportsFinal'),
filename: _configProperties.get('filename'),
displayType: _configProperties.get('displayType'),
isRequiredByAgent: _configProperties.get('isRequiredByAgent'),
@@ -1065,4 +1081,4 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, {
this.set('content.hosts', hosts);
}
}
-});
\ No newline at end of file
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/be9e0b8c/ambari-web/app/controllers/wizard/step8_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step8_controller.js b/ambari-web/app/controllers/wizard/step8_controller.js
index 9abc072..0597ebb 100644
--- a/ambari-web/app/controllers/wizard/step8_controller.js
+++ b/ambari-web/app/controllers/wizard/step8_controller.js
@@ -845,7 +845,8 @@ App.WizardStep8Controller = Em.Controller.extend({
desired_config: {
type: siteConfigObject.type,
tag: siteConfigObject.tag,
- properties: siteConfigObject.properties
+ properties: siteConfigObject.properties,
+ properties_attributes: siteConfigObject.properties_attributes
}
}
});
@@ -1508,7 +1509,8 @@ App.WizardStep8Controller = Em.Controller.extend({
desired_config: {
type: _serviceConfig.type,
tag: _serviceConfig.tag,
- properties: _serviceConfig.properties
+ properties: _serviceConfig.properties,
+ properties_attributes: _serviceConfig.properties_attributes
}
}
});
@@ -1662,7 +1664,12 @@ App.WizardStep8Controller = Em.Controller.extend({
App.config.escapeXMLCharacters(this.get('configs').findProperty('name', 'glusterfs_defaultFS_name').value) : null;
}
}, this);
- return {"type": "core-site", "tag": "version1", "properties": coreSiteProperties};
+ var attributes = App.router.get('mainServiceInfoConfigsController').getConfigAttributes(coreSiteObj);
+ var configObj = {"type": "core-site", "tag": "version1", "properties": coreSiteProperties};
+ if (attributes) {
+ configObj['properties_attributes'] = attributes;
+ }
+ return configObj;
},
/**
@@ -1675,12 +1682,12 @@ App.WizardStep8Controller = Em.Controller.extend({
*/
createSiteObj: function (site, isNonXmlFile, tag) {
var properties = {};
- if (!!isNonXmlFile) {
- this.get('configs').filterProperty('filename', site + '.xml').forEach(function (_configProperty) {
+ var configs = this.get('configs').filterProperty('filename', site + '.xml');
+ var attributes = App.router.get('mainServiceInfoConfigsController').getConfigAttributes(configs);
+ configs.forEach(function (_configProperty) {
+ if (isNonXmlFile) {
properties[_configProperty.name] = _configProperty.value;
- }, this);
- } else {
- this.get('configs').filterProperty('filename', site + '.xml').forEach(function (_configProperty) {
+ } else {
var heapsizeExceptions = ['hadoop_heapsize', 'yarn_heapsize', 'nodemanager_heapsize', 'resourcemanager_heapsize', 'apptimelineserver_heapsize', 'jobhistory_heapsize'];
// do not pass any globals whose name ends with _host or _hosts
if (_configProperty.isRequiredByAgent !== false) {
@@ -1689,11 +1696,15 @@ App.WizardStep8Controller = Em.Controller.extend({
properties[_configProperty.name] = _configProperty.value + "m";
} else {
properties[_configProperty.name] = App.config.escapeXMLCharacters(_configProperty.value);
- }
+ }
}
- }, this);
+ }
+ }, this);
+ var configObj = {"type": site, "tag": tag, "properties": properties };
+ if (attributes) {
+ configObj['properties_attributes'] = attributes;
}
- return {"type": site, "tag": tag, "properties": properties };
+ return configObj;
},
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/be9e0b8c/ambari-web/app/models/service_config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/service_config.js b/ambari-web/app/models/service_config.js
index ee2367e..177ac31 100644
--- a/ambari-web/app/models/service_config.js
+++ b/ambari-web/app/models/service_config.js
@@ -150,6 +150,7 @@ App.ServiceConfigProperty = Ember.Object.extend({
isReconfigurable: true, // by default a config property is reconfigurable
isEditable: true, // by default a config property is editable
isFinal: false,
+ defaultIsFinal: false,
supportsFinal: false,
isVisible: true,
isRequiredByAgent: true, // Setting it to true implies property will be stored in configuration
@@ -228,10 +229,13 @@ App.ServiceConfigProperty = Ember.Object.extend({
*/
isNotDefaultValue: function () {
var value = this.get('value');
- var dValue = this.get('defaultValue');
+ var defaultValue = this.get('defaultValue');
+ var supportsFinal = this.get('supportsFinal');
+ var isFinal = this.get('isFinal');
+ var defaultIsFinal = this.get('defaultIsFinal');
var isEditable = this.get('isEditable');
- return isEditable && dValue != null && value !== dValue;
- }.property('value', 'defaultValue', 'isEditable'),
+ return isEditable && ((defaultValue != null && value !== defaultValue) || (supportsFinal && isFinal !== defaultIsFinal));
+ }.property('value', 'defaultValue', 'isEditable', 'isFinal', 'defaultIsFinal'),
/**
* Don't show "Undo" for hosts on Installer Step7
http://git-wip-us.apache.org/repos/asf/ambari/blob/be9e0b8c/ambari-web/app/utils/config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/config.js b/ambari-web/app/utils/config.js
index 3c58d40..c34a66f 100644
--- a/ambari-web/app/utils/config.js
+++ b/ambari-web/app/utils/config.js
@@ -472,6 +472,8 @@ App.config = Em.Object.create({
configData.filename = stored.filename;
configData.description = stored.description;
configData.isVisible = stored.isVisible;
+ configData.isFinal = stored.isFinal;
+ configData.supportsFinal = stored.supportsFinal;
configData.isRequired = (configData.isRequired !== undefined) ? configData.isRequired : true;
configData.isRequiredByAgent = (configData.isRequiredByAgent !== undefined) ? configData.isRequiredByAgent : true;
configData.showLabel = stored.showLabel !== false;
@@ -506,6 +508,8 @@ App.config = Em.Object.create({
configData.filename = storedCfg.filename;
configData.description = storedCfg.description;
configData.description = storedCfg.showLabel !== false;
+ configData.isFinal = storedCfg.isFinal;
+ configData.supportsFinal = storedCfg.supportsFinal;
} else if (isAdvanced) {
advanced = advancedConfigs.filterProperty('filename', configData.filename).findProperty('name', configData.name);
this.setPropertyFromStack(configData, advanced);
@@ -531,6 +535,8 @@ App.config = Em.Object.create({
configData.defaultValue = configData.value;
configData.filename = advanced ? advanced.filename : configData.filename;
configData.description = advanced ? advanced.description : configData.description;
+ configData.isFinal = !!(advanced && (advanced.isFinal === "true"));
+ configData.supportsFinal = !!(advanced && advanced.supportsFinal);
},
@@ -833,6 +839,31 @@ App.config = Em.Object.create({
},
/**
+ * Get config types and config type attributes from stack service
+ *
+ * @param service
+ * @return {object}
+ */
+ getConfigTypesInfoFromService: function (service) {
+ var configTypes = service.get('configTypes');
+ var configTypesInfo = {
+ items: [],
+ supportsFinal: []
+ };
+ if (configTypes) {
+ for (var key in configTypes) {
+ if (configTypes.hasOwnProperty(key)) {
+ configTypesInfo.items.push(key);
+ if (configTypes[key].supports && configTypes[key].supports.final === "true") {
+ configTypesInfo.supportsFinal.push(key);
+ }
+ }
+ }
+ }
+ return configTypesInfo;
+ },
+
+ /**
* Get properties from server by type and tag with properties, that belong to group
* push them to common {serviceConfigs} and call callback function
*/
@@ -1006,6 +1037,9 @@ App.config = Em.Object.create({
overrides: stored.overrides,
isRequired: true,
isVisible: stored.isVisible,
+ isFinal: stored.isFinal,
+ defaultIsFinal: stored.defaultIsFinal,
+ supportsFinal: stored.supportsFinal,
showLabel: stored.showLabel !== false
};
http://git-wip-us.apache.org/repos/asf/ambari/blob/be9e0b8c/ambari-web/app/views/common/configs/services_config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/services_config.js b/ambari-web/app/views/common/configs/services_config.js
index aa394bf..ac8c05f 100644
--- a/ambari-web/app/views/common/configs/services_config.js
+++ b/ambari-web/app/views/common/configs/services_config.js
@@ -673,12 +673,18 @@ App.ServiceConfigsByCategoryView = Ember.View.extend(App.UserPref, {
var serviceConfigProperty = event.contexts[0];
var value = serviceConfigProperty.get('value');
var dValue = serviceConfigProperty.get('defaultValue');
+ var supportsFinal = serviceConfigProperty.get('supportsFinal');
+ var defaultIsFinal = serviceConfigProperty.get('defaultIsFinal');
+
if (dValue != null) {
if (serviceConfigProperty.get('displayType') === 'password') {
serviceConfigProperty.set('retypedPassword', dValue);
}
serviceConfigProperty.set('value', dValue);
}
+ if (supportsFinal) {
+ serviceConfigProperty.set('isFinal', defaultIsFinal);
+ }
this.miscConfigChange(serviceConfigProperty);
},