You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by yu...@apache.org on 2013/03/08 00:35:06 UTC
svn commit: r1454169 - in /incubator/ambari/trunk: ./
ambari-web/app/controllers/ ambari-web/app/controllers/main/service/info/
ambari-web/app/controllers/wizard/ ambari-web/app/data/
ambari-web/app/models/ ambari-web/app/styles/ ambari-web/app/templat...
Author: yusaku
Date: Thu Mar 7 23:35:05 2013
New Revision: 1454169
URL: http://svn.apache.org/r1454169
Log:
AMBARI-1542. Provide remove, restore default, and cancel actions for service config properties. (srimanth via yusaku)
Modified:
incubator/ambari/trunk/CHANGES.txt
incubator/ambari/trunk/ambari-web/app/controllers/installer.js
incubator/ambari/trunk/ambari-web/app/controllers/main/service/info/configs.js
incubator/ambari/trunk/ambari-web/app/controllers/wizard/step7_controller.js
incubator/ambari/trunk/ambari-web/app/data/custom_configs.js
incubator/ambari/trunk/ambari-web/app/data/service_configs.js
incubator/ambari/trunk/ambari-web/app/models/service_config.js
incubator/ambari/trunk/ambari-web/app/styles/application.less
incubator/ambari/trunk/ambari-web/app/templates/common/configs/overriddenProperty.hbs
incubator/ambari/trunk/ambari-web/app/templates/common/configs/service_config.hbs
incubator/ambari/trunk/ambari-web/app/templates/main/service/info/configs.hbs
incubator/ambari/trunk/ambari-web/app/views/common/configs/services_config.js
Modified: incubator/ambari/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1454169&r1=1454168&r2=1454169&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Thu Mar 7 23:35:05 2013
@@ -105,6 +105,9 @@ Trunk (unreleased changes):
IMPROVEMENTS
+ AMBARI-1542. Provide remove, restore default, and cancel actions for
+ service config properties. (srimanth via yusaku)
+
AMBARI-1580. Stack Upgrade Wizard - resume upon page refresh / login.
(yusaku)
Modified: incubator/ambari/trunk/ambari-web/app/controllers/installer.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/installer.js?rev=1454169&r1=1454168&r2=1454169&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/controllers/installer.js (original)
+++ incubator/ambari/trunk/ambari-web/app/controllers/installer.js Thu Mar 7 23:35:05 2013
@@ -236,6 +236,20 @@ App.InstallerController = App.WizardCont
var value = _configProperties.get('value').trim().split(/\s+/g).join(',');
_configProperties.set('value', value);
}
+ var overrides = _configProperties.get('overrides');
+ var overridesArray = [];
+ if(overrides!=null){
+ overrides.forEach(function(override){
+ var overrideEntry = {
+ value: override.get('value'),
+ hosts: []
+ };
+ override.get('selectedHostOptions').forEach(function(host){
+ overrideEntry.hosts.push(host);
+ });
+ overridesArray.push(overrideEntry);
+ });
+ }
var configProperty = {
id: _configProperties.get('id'),
name: _configProperties.get('name'),
@@ -243,7 +257,8 @@ App.InstallerController = App.WizardCont
defaultValue: _configProperties.get('defaultValue'),
service: _configProperties.get('serviceName'),
domain: _configProperties.get('domain'),
- filename: _configProperties.get('filename')
+ filename: _configProperties.get('filename'),
+ overrides: overridesArray
};
serviceConfigProperties.push(configProperty);
}, this);
Modified: incubator/ambari/trunk/ambari-web/app/controllers/main/service/info/configs.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/main/service/info/configs.js?rev=1454169&r1=1454168&r2=1454169&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/controllers/main/service/info/configs.js (original)
+++ incubator/ambari/trunk/ambari-web/app/controllers/main/service/info/configs.js Thu Mar 7 23:35:05 2013
@@ -269,7 +269,8 @@ App.MainServiceInfoConfigsController = E
name: index,
value: properties[index],
defaultValue: properties[index],
- filename: _tag.siteName + ".xml"
+ filename: _tag.siteName + ".xml",
+ isUserProperty: false
};
if (this.get('configs').someProperty('name', index)) {
var configProperty = this.get('configs').findProperty('name', index);
@@ -317,22 +318,33 @@ App.MainServiceInfoConfigsController = E
serviceConfigObj.options = this.get('configs').someProperty('name', index) ? this.get('configs').findProperty('name', index).options : null;
globalConfigs.pushObject(serviceConfigObj);
} else if (!this.get('configMapping').someProperty('name', index)) {
- serviceConfigObj.id = 'site property';
- serviceConfigObj.displayType = 'advanced';
- serviceConfigObj.displayName = index;
- serviceConfigObj.serviceName = this.get('content.serviceName');
- if (advancedConfig.someProperty('name', index)) {
+ if (advancedConfig.someProperty('name', index)) {
+ serviceConfigObj.id = 'site property';
+ serviceConfigObj.displayType = 'advanced';
+ serviceConfigObj.displayName = index;
+ serviceConfigObj.serviceName = this.get('content.serviceName');
+ serviceConfigObj.category = 'Advanced';
if (advancedConfig.findProperty('name', index).filename) {
serviceConfigObj.filename = advancedConfig.findProperty('name', index).filename;
}
+ serviceConfigs.pushObject(serviceConfigObj);
+ } else {
+ var serviceConfigMetaData = this.get('serviceConfigs').findProperty('serviceName', this.get('content.serviceName'));
+ var categoryMetaData = serviceConfigMetaData == null ? null : serviceConfigMetaData.configCategories.findProperty('siteFileName', serviceConfigObj.filename);
+ if (categoryMetaData != null) {
+ serviceConfigObj.id = 'site property';
+ serviceConfigObj.category = categoryMetaData.get('name');
+ serviceConfigObj.serviceName = this.get('content.serviceName');
+ serviceConfigObj.displayName = index;
+ serviceConfigObj.displayType = 'advanced';
+ serviceConfigObj.isUserProperty = true;
+ serviceConfigs.pushObject(serviceConfigObj);
+ } else {
+ serviceConfigObj.id = 'conf-site';
+ serviceConfigObj.serviceName = this.get('content.serviceName');
+ this.get('customConfig').pushObject(serviceConfigObj);
+ }
}
- if (serviceConfigObj.filename === "core-site.xml")
- serviceConfigObj.category = 'AdvancedCoreSite';
- else if (serviceConfigObj.filename === "hdfs-site.xml")
- serviceConfigObj.category = 'AdvancedHDFSSite';
- else if (serviceConfigObj.filename === "mapred-site.xml")
- serviceConfigObj.category = 'AdvancedMapredSite';
- serviceConfigs.pushObject(serviceConfigObj);
}
}
}, this);
@@ -1098,15 +1110,9 @@ App.MainServiceInfoConfigsController = E
getAllHosts: function () {
return App.router.get('mainHostController.content');
- }.property('App.router.mainHostController.content')
-
-});
-
-
-App.MainServiceSlaveComponentGroupsController = App.SlaveComponentGroupsController.extend({
- name: 'mainServiceSlaveComponentGroupsController',
- contentBinding: 'App.router.mainServiceInfoConfigsController.slaveComponentGroups',
- stepConfigsBinding: 'App.router.mainServiceInfoConfigsController.stepConfigs',
- serviceBinding: 'App.router.mainServiceInfoConfigsController.selectedService'
-
+ }.property('App.router.mainHostController.content'),
+
+ doCancel: function () {
+ location.reload();
+ }
});
\ No newline at end of file
Modified: incubator/ambari/trunk/ambari-web/app/controllers/wizard/step7_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/wizard/step7_controller.js?rev=1454169&r1=1454168&r2=1454169&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/controllers/wizard/step7_controller.js (original)
+++ incubator/ambari/trunk/ambari-web/app/controllers/wizard/step7_controller.js Thu Mar 7 23:35:05 2013
@@ -85,18 +85,77 @@ App.WizardStep7Controller = Em.Controlle
// for all services`
this.get('stepConfigs').forEach(function (_content) {
//for all components
+
+ // Update existing values
+ var seenStoredConfigs = {};
_content.get('configs').forEach(function (_config) {
-
var componentVal = storedServices.findProperty('name', _config.get('name'));
//if we have config for specified component
if (componentVal) {
//set it
+ seenStoredConfigs[componentVal.name] = 'true';
_config.set('value', componentVal.value)
+ this.updateHostOverrides(_config, componentVal);
+ }
+ }, this);
+
+ // Create new values
+ var currentServiceStoredConfigs = storedServices.filterProperty('service', _content.serviceName);
+ currentServiceStoredConfigs.forEach(function (storedConfig) {
+ if(!(storedConfig.name in seenStoredConfigs)){
+ console.log("loadStep7(): New property from local storage: ", storedConfig);
+ // Determine category
+ var configCategory = 'Advanced';
+ var serviceConfigMetaData = serviceConfigs.findProperty('serviceName', _content.serviceName);
+ var categoryMetaData = serviceConfigMetaData == null ? null : serviceConfigMetaData.configCategories.findProperty('siteFileName', storedConfig.filename);
+ if (categoryMetaData != null) {
+ configCategory = categoryMetaData.get('name');
+ }
+ // Configuration data
+ var configData = {
+ id: storedConfig.id,
+ name: storedConfig.name,
+ displayName: storedConfig.name,
+ serviceName: _content.serviceName,
+ value: storedConfig.value,
+ defaultValue: storedConfig.defaultValue,
+ displayType: "advanced",
+ filename: storedConfig.filename,
+ category: configCategory,
+ isUserProperty: true
+ }
+ var serviceConfigProperty = App.ServiceConfigProperty.create(configData);
+ serviceConfigProperty.serviceConfig = _content;
+ serviceConfigProperty.initialValue();
+ this.updateHostOverrides(serviceConfigProperty, storedConfig);
+ _content.configs.pushObject(serviceConfigProperty);
+ serviceConfigProperty.validate();
}
-
}, this);
}, this);
-
+ }
+ },
+
+ updateHostOverrides: function (configProperty, storedConfigProperty) {
+ if(storedConfigProperty.overrides!=null && storedConfigProperty.overrides.length>0){
+ var overrides = configProperty.get('overrides');
+ if (!overrides) {
+ overrides = [];
+ configProperty.set('overrides', overrides);
+ }
+ storedConfigProperty.overrides.forEach(function(overrideEntry){
+ // create new override with new value
+ var newSCP = App.ServiceConfigProperty.create(configProperty);
+ newSCP.set('value', overrideEntry.value);
+ newSCP.set('isOriginalSCP', false); // indicated this is overridden value,
+ newSCP.set('parentSCP', configProperty);
+ var hostsArray = Ember.A([]);
+ overrideEntry.hosts.forEach(function(host){
+ hostsArray.push(host);
+ });
+ newSCP.set('selectedHostOptions', hostsArray);
+ overrides.pushObject(newSCP);
+ });
}
},
@@ -112,13 +171,12 @@ App.WizardStep7Controller = Em.Controlle
if (this.get('configMapping').someProperty('name', _config.name)) {
} else if (!(service.configs.someProperty('name', _config.name))) {
_config.id = "site property";
- // ////_config.category = 'Advanced';
- if (_config.filename === "core-site.xml")
- _config.category = 'AdvancedCoreSite';
- else if (_config.filename === "hdfs-site.xml")
- _config.category = 'AdvancedHDFSSite';
- else if (_config.filename === "mapred-site.xml")
- _config.category = 'AdvancedMapredSite';
+ _config.category = 'Advanced';
+ var serviceConfigMetaData = this.get('serviceConfigs').findProperty('serviceName', this.get('content.serviceName'));
+ var categoryMetaData = serviceConfigMetaData == null ? null : serviceConfigMetaData.configCategories.findProperty('siteFileName', serviceConfigObj.filename);
+ if (categoryMetaData != null) {
+ _config.category = categoryMetaData.get('name');
+ }
_config.displayName = _config.name;
_config.defaultValue = _config.value;
// make all advanced configs optional and populated by default
@@ -235,51 +293,6 @@ App.WizardStep7Controller = Em.Controlle
}, this);
},
- validateCustomConfig: function () {
- var flag = true;
- var serviceProperties = [];
- this.get('stepConfigs').forEach(function (_serviceContent) {
- var configProperties = _serviceContent.get('configs');
- if (configProperties.someProperty('id', 'conf-site')) {
- var serviceProperty = {};
- serviceProperty.serviceName = _serviceContent.get("serviceName");
- serviceProperty.siteProperties = [];
- var customSite = configProperties.findProperty('id', 'conf-site');
- var keyValue = customSite.value.split(/\n+/);
- if (keyValue) {
- keyValue.forEach(function (_keyValue) {
- console.log("The value of the keyValue is: " + _keyValue.trim());
- _keyValue = _keyValue.trim();
- var key = _keyValue.match(/(.+)=/);
- var value = _keyValue.match(/=(.*)/);
- if (key) {
- // Check that entered config is allowed to reconfigure
- if (configProperties.someProperty('name', key[1]) || this.get('configMapping').someProperty('name', key[1])) {
- var property = {
- siteProperty: key[1],
- displayNames: [],
- displayMsg: null
- };
- if (this.get('configMapping').someProperty('name', key[1])) {
- this.setPropertyDisplayNames(property.displayNames, this.get('configMapping').findProperty('name', key[1]).templateName, configProperties);
- }
- property.displayMsg = this.setDisplayMessage(property.siteProperty, property.displayNames);
- serviceProperty.siteProperties.push(property);
- flag = false;
- }
- }
- }, this);
- }
- serviceProperties.push(serviceProperty);
- }
- }, this);
- var result = {
- flag: flag,
- value: serviceProperties
- };
- return result;
- },
-
/**
* @param: An array of display names
*/
@@ -370,15 +383,6 @@ App.WizardStep7Controller = Em.Controlle
submit: function () {
if (!this.get('isSubmitDisabled')) {
App.router.send('next');
- /*
- var result = {};
- result = this.validateCustomConfig();
- if (result.flag === true) {
- App.router.send('next');
- } else {
- this.showCustomConfigErrMsg(result.value);
- }
- */
}
},
@@ -431,6 +435,7 @@ App.WizardStep7Controller = Em.Controlle
for ( var hostName in hosts) {
var host = hosts[hostName];
hostNameToHostMap[hostName] = App.Host.createRecord({
+ id: host.name,
hostName: host.name,
publicHostName: host.name,
cpu: host.cpu,
Modified: incubator/ambari/trunk/ambari-web/app/data/custom_configs.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/data/custom_configs.js?rev=1454169&r1=1454168&r2=1454169&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/data/custom_configs.js (original)
+++ incubator/ambari/trunk/ambari-web/app/data/custom_configs.js Thu Mar 7 23:35:05 2013
@@ -21,46 +21,6 @@ module.exports =
[
{
"id": "conf-site",
- "name": "core-site",
- "displayName": "Custom Hadoop Configs",
- "value": "",
- "defaultValue": "",
- "description": "Enter in key=value format to set core-site.xml parameters not exposed through this page.<br> New line is the delimiter for every key-value pair.",
- "displayType": "custom",
- "isVisible": true,
- "isRequired": false,
- "isReconfigurable": false,
- "serviceName": "HDFS",
- "category": "Advanced"
- },
- {
- "id": "conf-site",
- "name": "hdfs-site",
- "displayName": "Custom HDFS Configs",
- "value": "",
- "defaultValue": "",
- "description": "Enter in key=value format to set hdfs-site.xml parameters not exposed through this page.<br> New line is the delimiter for every key-value pair.",
- "displayType": "custom",
- "isVisible": true,
- "isRequired": false,
- "serviceName": "HDFS",
- "category": "Advanced"
- },
- {
- "id": "conf-site",
- "name": "mapred-site",
- "displayName": "Custom MapReduce Configs",
- "value": "",
- "defaultValue": "",
- "description": "Enter in key=value format to set mapred-site.xml parameters not exposed through this page.<br> New line is the delimiter for every key-value pair.",
- "displayType": "custom",
- "isVisible": true,
- "isRequired": false,
- "serviceName": "MAPREDUCE",
- "category": "Advanced"
- },
- {
- "id": "conf-site",
"name": "capacity-scheduler",
"displayName": "Custom Capacity Scheduler Configs",
"value": "",
@@ -84,53 +44,5 @@ module.exports =
"isRequired": false,
"serviceName": "MAPREDUCE",
"category": "Capacity Scheduler"
- },
- {
- "id": "conf-site",
- "name": "hbase-site",
- "displayName": "Custom HBase Configs",
- "description": "Enter in key=value format to set hbase-site.xml parameters not exposed through this page.<br> New line is the delimiter for every key-value pair.",
- "defaultValue": "",
- "isRequired": false,
- "displayType": "custom",
- "isVisible": true,
- "serviceName": "HBASE",
- "category": "Advanced"
- },
- {
- "id": "conf-site",
- "name": "hive-site",
- "displayName": "Custom Hive Configs",
- "description": "Enter in key=value format to set hive-site.xml parameters not exposed through this page.<br> New line is the delimiter for every key-value pair.",
- "defaultValue": "",
- "isRequired": false,
- "displayType": "custom",
- "isVisible": true,
- "serviceName": "HIVE",
- "category": "Advanced"
- },
- {
- "id": "conf-site",
- "name": "webhcat-site",
- "displayName": "Custom WebHCat Configs",
- "description": "Enter in key=value format to set webhcat-site.xml parameters not exposed through this page.<br> New line is the delimiter for every key-value pair.",
- "defaultValue": "",
- "isRequired": false,
- "displayType": "custom",
- "isVisible": true,
- "serviceName": "WEBHCAT",
- "category": "Advanced"
- },
- {
- "id": "conf-site",
- "name": "oozie-site",
- "displayName": "Custom Oozie Configs",
- "description": "Enter in key=value format to set oozie-site.xml parameters not exposed through this page.<br> New line is the delimiter for every key-value pair.",
- "defaultValue": "",
- "isRequired": false,
- "displayType": "custom",
- "isVisible": true,
- "serviceName": "OOZIE",
- "category": "Advanced"
}
]
\ No newline at end of file
Modified: incubator/ambari/trunk/ambari-web/app/data/service_configs.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/data/service_configs.js?rev=1454169&r1=1454168&r2=1454169&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/data/service_configs.js (original)
+++ incubator/ambari/trunk/ambari-web/app/data/service_configs.js Thu Mar 7 23:35:05 2013
@@ -32,8 +32,8 @@ module.exports = [
App.ServiceConfigCategory.create({ name: 'DataNode', displayName : 'DataNode'}),
App.ServiceConfigCategory.create({ name: 'General', displayName : 'General'}),
App.ServiceConfigCategory.create({ name: 'Advanced', displayName : 'Advanced'}),
- App.ServiceConfigCategory.create({ name: 'AdvancedCoreSite', displayName : 'Advanced Core Site'}),
- App.ServiceConfigCategory.create({ name: 'AdvancedHDFSSite', displayName : 'Advanced HDFS Site'})
+ App.ServiceConfigCategory.create({ name: 'AdvancedCoreSite', displayName : 'Custom core-site.xml', siteFileName: 'core-site.xml', canAddProperty: true}),
+ App.ServiceConfigCategory.create({ name: 'AdvancedHDFSSite', displayName : 'Custom hdfs-site.xml', siteFileName: 'hdfs-site.xml', canAddProperty: true})
],
configs: configProperties.filterProperty('serviceName', 'HDFS')
},
@@ -48,7 +48,7 @@ module.exports = [
App.ServiceConfigCategory.create({ name: 'General', displayName : 'General'}),
App.ServiceConfigCategory.create({ name: 'Advanced', displayName : 'Advanced'}),
App.ServiceConfigCategory.create({ name: 'Capacity Scheduler', displayName : 'Capacity Scheduler'}),
- App.ServiceConfigCategory.create({ name: 'AdvancedMapredSite', displayName : 'Advanced MapReduce Site'})
+ App.ServiceConfigCategory.create({ name: 'AdvancedMapredSite', displayName : 'Custom mapred-site.xml', siteFileName: 'mapred-site.xml', canAddProperty: true})
],
configs: configProperties.filterProperty('serviceName', 'MAPREDUCE')
},
@@ -59,7 +59,8 @@ module.exports = [
filename: 'hive-site',
configCategories: [
App.ServiceConfigCategory.create({ name: 'Hive Metastore', displayName : 'Hive Metastore'}),
- App.ServiceConfigCategory.create({ name: 'Advanced', displayName : 'Advanced'})
+ App.ServiceConfigCategory.create({ name: 'Advanced', displayName : 'Advanced'}),
+ App.ServiceConfigCategory.create({ name: 'AdvancedHiveSite', displayName : 'Custom hive-site.xml', siteFileName: 'hive-site.xml', canAddProperty: true})
],
configs: configProperties.filterProperty('serviceName', 'HIVE')
},
@@ -69,7 +70,8 @@ module.exports = [
displayName: 'WebHCat',
filename: 'webhcat-site',
configCategories: [
- App.ServiceConfigCategory.create({ name: 'Advanced', displayName : 'Advanced'})
+ App.ServiceConfigCategory.create({ name: 'Advanced', displayName : 'Advanced'}),
+ App.ServiceConfigCategory.create({ name: 'AdvancedWebHCatSite', displayName : 'Custom webhcat-site.xml', siteFileName: 'webhcat-site.xml', canAddProperty: true})
],
configs: configProperties.filterProperty('serviceName', 'WEBHCAT')
},
@@ -82,7 +84,8 @@ module.exports = [
App.ServiceConfigCategory.create({ name: 'HBase Master', displayName : 'HBase Master'}),
App.ServiceConfigCategory.create({ name: 'RegionServer', displayName : 'RegionServer'}),
App.ServiceConfigCategory.create({ name: 'General', displayName : 'General'}),
- App.ServiceConfigCategory.create({ name: 'Advanced', displayName : 'Advanced'})
+ App.ServiceConfigCategory.create({ name: 'Advanced', displayName : 'Advanced'}),
+ App.ServiceConfigCategory.create({ name: 'AdvancedHbaseSite', displayName : 'Custom hbase-site.xml', siteFileName: 'hbase-site.xml', canAddProperty: true})
],
configs: configProperties.filterProperty('serviceName', 'HBASE')
},
@@ -103,7 +106,8 @@ module.exports = [
filename: 'oozie-site',
configCategories: [
App.ServiceConfigCategory.create({ name: 'Oozie Server', displayName : 'Oozie Server'}),
- App.ServiceConfigCategory.create({ name: 'Advanced', displayName : 'Advanced'})
+ App.ServiceConfigCategory.create({ name: 'Advanced', displayName : 'Advanced'}),
+ App.ServiceConfigCategory.create({ name: 'AdvancedOozieSite', displayName : 'Custom oozie-site.xml', siteFileName: 'oozie-site.xml', canAddProperty: true})
],
configs: configProperties.filterProperty('serviceName', 'OOZIE')
},
@@ -127,4 +131,4 @@ module.exports = [
configs: configProperties.filterProperty('serviceName', 'MISC')
}
-];
\ No newline at end of file
+];
Modified: incubator/ambari/trunk/ambari-web/app/models/service_config.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/models/service_config.js?rev=1454169&r1=1454168&r2=1454169&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/models/service_config.js (original)
+++ incubator/ambari/trunk/ambari-web/app/models/service_config.js Thu Mar 7 23:35:05 2013
@@ -45,6 +45,16 @@ App.ServiceConfigCategory = Ember.Object
*/
displayName: null,
slaveConfigs: null,
+ /**
+ * Each category might have a site-name associated (hdfs-site, core-site, etc.)
+ * and this will be used when determining which category a particular property
+ * ends up in, based on its site.
+ */
+ siteFileName: null,
+ /**
+ * Can this category add new properties. Used for custom configurations.
+ */
+ canAddProperty: false,
primaryName: function () {
switch (this.get('name')) {
case 'DataNode':
@@ -130,6 +140,7 @@ App.ServiceConfigProperty = Ember.Object
parentSCP: null, // This is the main SCP which is overridden by this. Set only when isOriginalSCP is false.
selectedHostOptions : null, // contain array of hosts configured with overridden value
overrides : null,
+ isUserProperty: null, // This property was added by user. Hence they get removal actions etc.
/**
* No override capabilities for fields which are not edtiable
* and fields which represent master hosts.
@@ -143,13 +154,30 @@ App.ServiceConfigProperty = Ember.Object
var overrides = this.get('overrides');
return overrides != null;
}.property('overrides'),
+ isRemovable: function() {
+ var isOriginalSCP = this.get('isOriginalSCP');
+ var isUserProperty = this.get('isUserProperty');
+ // Removable when this is a user property, or it is not an original property
+ return isUserProperty || !isOriginalSCP;
+ }.property('isUserProperty', 'isOriginalSCP'),
init: function () {
if (this.get('id') === 'puppet var') {
this.set('value', this.get('defaultValue'));
}
// TODO: remove mock data
},
-
+
+ /**
+ * Indicates when value is not the default value.
+ * Returns false when there is no default value.
+ */
+ isNotDefaultValue: function () {
+ var value = this.get('value');
+ var dValue = this.get('defaultValue');
+ var isEditable = this.get('isEditable');
+ return isEditable && dValue != null && value !== dValue;
+ }.property('value', 'defaultValue', 'isEditable'),
+
initialValue: function () {
var masterComponentHostsInDB = App.db.getMasterComponentHosts();
//console.log("value in initialvalue: " + JSON.stringify(masterComponentHostsInDB));
Modified: incubator/ambari/trunk/ambari-web/app/styles/application.less
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/styles/application.less?rev=1454169&r1=1454168&r2=1454169&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/styles/application.less (original)
+++ incubator/ambari/trunk/ambari-web/app/styles/application.less Thu Mar 7 23:35:05 2013
@@ -445,6 +445,7 @@ h1 {
margin-bottom: 20px;
.control-label {
text-align: left;
+ word-wrap: break-word;
}
.entry-row {
margin: 10px 0;
@@ -470,46 +471,6 @@ h1 {
margin-bottom: 0;
}
}
- .accordion-group.AdvancedCoreSite {
- .control-label {
- float: none;
- text-align: left;
- width: auto;
- }
- .controls {
- margin-left: 0;
- }
- }
- .accordion-group.AdvancedHDFSSite {
- .control-label {
- float: none;
- text-align: left;
- width: auto;
- }
- .controls {
- margin-left: 0;
- }
- }
- .accordion-group.AdvancedMapredSite {
- .control-label {
- float: none;
- text-align: left;
- width: auto;
- }
- .controls {
- margin-left: 0;
- }
- }
- .accordion-group.Advanced {
- .control-label {
- float: none;
- text-align: left;
- width: auto;
- }
- .controls {
- margin-left: 0;
- }
- }
.badge {
margin-left: 4px;
}
@@ -569,6 +530,10 @@ h1 {
color: #FF4B4B;
margin-right: 2px;
}
+ .icon-undo {
+ color: rgb(243, 178, 11);
+ margin-right: 2px;
+ }
}
}
}
Modified: incubator/ambari/trunk/ambari-web/app/templates/common/configs/overriddenProperty.hbs
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/templates/common/configs/overriddenProperty.hbs?rev=1454169&r1=1454168&r2=1454169&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/templates/common/configs/overriddenProperty.hbs (original)
+++ incubator/ambari/trunk/ambari-web/app/templates/common/configs/overriddenProperty.hbs Thu Mar 7 23:35:05 2013
@@ -21,6 +21,9 @@
<div {{bindAttr class="overriddenSCP.errorMessage:error: :control-group :overrideField"}}>
{{view overriddenSCP.viewClass serviceConfigBinding="overriddenSCP" categoryConfigsBinding="view.categoryConfigs"}}
<a class="action" href="#" {{action showOverrideWindow overriddenSCP controller target="view" }} >{{overriddenSCP.selectedHostOptions.length}} hosts </a>
+ {{#if isNotDefaultValue}}
+ <a class="action" {{action "doRestoreDefaultValue" this target="view" }} ><i class="icon-undo"></i>Undo</a>
+ {{/if}}
<a class="action" {{action "removeOverride" overriddenSCP target="view" }} ><i class="icon-minus-sign"></i>Remove</a>
<span class="help-inline">{{overriddenSCP.errorMessage}}</span>
</div>
Modified: incubator/ambari/trunk/ambari-web/app/templates/common/configs/service_config.hbs
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/templates/common/configs/service_config.hbs?rev=1454169&r1=1454168&r2=1454169&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/templates/common/configs/service_config.hbs (original)
+++ incubator/ambari/trunk/ambari-web/app/templates/common/configs/service_config.hbs Thu Mar 7 23:35:05 2013
@@ -31,7 +31,7 @@
</div>
- {{#view App.ServiceConfigsByCategoryView categoryBinding="category" serviceConfigsBinding="selectedService.configs"}}
+ {{#view App.ServiceConfigsByCategoryView categoryBinding="category" serviceBinding="selectedService" serviceConfigsBinding="selectedService.configs"}}
<form class="form-horizontal">
{{#each view.categoryConfigs}}
@@ -47,6 +47,12 @@
{{#if isOverridable}}
<a class="action" {{action "createOverrideProperty" this target="view" }} ><i class="icon-plus-sign"></i>Exception</a>
{{/if}}
+ {{#if isNotDefaultValue}}
+ <a class="action" {{action "doRestoreDefaultValue" this target="view" }} ><i class="icon-undo"></i>Undo</a>
+ {{/if}}
+ {{#if isRemovable}}
+ <a class="action" {{action "removeProperty" this target="view" }} ><i class="icon-minus-sign"></i>Remove</a>
+ {{/if}}
<span class="help-inline">{{errorMessage}}</span>
</div>
{{#if this.isOverridden}}
@@ -58,7 +64,7 @@
{{/each}}
{{! For Advanced, Advanced Core Site, Advanced HDFS Site sections, show the 'Add Property' link.}}
- {{# if category.isAdvanced }}
+ {{# if category.canAddProperty }}
<div>
<a href="#" {{action "showAddPropertyWindow" this target="view" }} >Add Property...</a>
</div>
Modified: incubator/ambari/trunk/ambari-web/app/templates/main/service/info/configs.hbs
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/templates/main/service/info/configs.hbs?rev=1454169&r1=1454168&r2=1454169&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/templates/main/service/info/configs.hbs (original)
+++ incubator/ambari/trunk/ambari-web/app/templates/main/service/info/configs.hbs Thu Mar 7 23:35:05 2013
@@ -22,6 +22,7 @@
{{#if App.isAdmin}}
<p class="pull-right">
<!--<input class="btn btn-primary" type="button" value="Save" {{!bindAttr disabled="isSubmitDisabled"}} />-->
+ <a class="btn" {{action doCancel target="controller"}}>{{t common.cancel}}</a>
<a class="btn btn-primary" {{bindAttr disabled="isSubmitDisabled"}}
{{action restartServicePopup target="controller"}}>{{t common.save}}</a>
</p>
Modified: incubator/ambari/trunk/ambari-web/app/views/common/configs/services_config.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/views/common/configs/services_config.js?rev=1454169&r1=1454168&r2=1454169&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/views/common/configs/services_config.js (original)
+++ incubator/ambari/trunk/ambari-web/app/views/common/configs/services_config.js Thu Mar 7 23:35:05 2013
@@ -40,6 +40,7 @@ App.ServiceConfigsByCategoryView = Ember
content: null,
category: null,
+ service: null,
serviceConfigs: null, // General, Advanced, NameNode, SNameNode, DataNode, etc.
// total number of
// hosts (by
@@ -73,8 +74,9 @@ App.ServiceConfigsByCategoryView = Ember
var serviceConfigObj = {
name: '',
value: '',
- defaultValue: '',
- filename: ''
+ defaultValue: null,
+ filename: '',
+ isUserProperty: true
};
var category = this.get('category');
@@ -83,23 +85,25 @@ App.ServiceConfigsByCategoryView = Ember
var fileName = null;
- if (category.get('name') === 'AdvancedCoreSite') {
- serviceConfigObj.filename = "core-site.xml";
- } else if (category.get('name') === 'AdvancedHDFSSite') {
- serviceConfigObj.filename = "hdfs-site.xml";
- } else if (category.get('name') === 'AdvancedMapredSite') {
- serviceConfigObj.filename = "mapred-site.xml";
+ var serviceName = this.get('service.serviceName');
+ var serviceConfigsMetaData = require('data/service_configs');
+ var serviceConfigMetaData = serviceConfigsMetaData.findProperty('serviceName', serviceName);
+ var categoryMetaData = serviceConfigMetaData == null ? null : serviceConfigMetaData.configCategories.findProperty('name', category.get('name'));
+ if (categoryMetaData != null) {
+ serviceConfigObj.filename = categoryMetaData.siteFileName;
}
-
+
var self = this;
App.ModalPopup.show({
// classNames: ['big-modal'],
- classNames: [ 'sixty-percent-width-modal', 'arun' ],
+ classNames: [ 'sixty-percent-width-modal'],
header: "Add Property",
- primary: 'Save',
+ primary: 'Add',
secondary: 'Cancel',
onPrimary: function () {
serviceConfigObj.displayName = serviceConfigObj.name;
+ serviceConfigObj.id = 'site property';
+ serviceConfigObj.serviceName = serviceName;
var serviceConfigProperty = App.ServiceConfigProperty.create(serviceConfigObj);
self.get('serviceConfigs').pushObject(serviceConfigProperty);
this.hide();
@@ -116,10 +120,31 @@ App.ServiceConfigsByCategoryView = Ember
},
+ /**
+ * Removes the top-level property from list of properties.
+ * Should be only called on user properties.
+ */
+ removeProperty: function (event) {
+ var serviceConfigProperty = event.contexts[0];
+ this.get('serviceConfigs').removeObject(serviceConfigProperty);
+ },
+
+ /**
+ * Restores given property's value to be its default value.
+ * Does not update if there is no default value.
+ */
+ doRestoreDefaultValue: function (event) {
+ var serviceConfigProperty = event.contexts[0];
+ var value = serviceConfigProperty.get('value');
+ var dValue = serviceConfigProperty.get('defaultValue');
+ if (dValue != null) {
+ serviceConfigProperty.set('value', dValue);
+ }
+ },
+
createOverrideProperty: function (event) {
var serviceConfigProperty = event.contexts[0];
var self = this;
- var arrayOfSelectedHosts = [];
var newValue = '';
var overrides = serviceConfigProperty.get('overrides');
if (!overrides) {