Author: yusaku
Date: Fri Jan 11 02:25:18 2013
New Revision: 1431818
URL: http://svn.apache.org/viewvc?rev=1431818&view=rev
Log:
AMBARI-1145. Cluster Management refactoring. (yusaku)
Modified:
incubator/ambari/trunk/ambari-web/app/controllers/main/service/info/configs.js
incubator/ambari/trunk/ambari-web/app/controllers/wizard/step5_controller.js
incubator/ambari/trunk/ambari-web/app/controllers/wizard/step8_controller.js
incubator/ambari/trunk/ambari-web/app/data/custom_configs.js
incubator/ambari/trunk/ambari-web/app/views/wizard/step5_view.js
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=1431818&r1=1431817&r2=1431818&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
Fri Jan 11 02:25:18 2013
@@ -229,17 +229,23 @@ App.MainServiceInfoConfigsController = E
*/
loadCustomConfig: function (serviceConfigs) {
if (this.get('customConfigs').findProperty('serviceName',
this.get('content.serviceName'))) {
- var customConfigs =
this.get('customConfigs').findProperty('serviceName',
this.get('content.serviceName'));
- var customValue = '';
- var length = this.get('customConfig').length;
- this.get('customConfig').forEach(function (_config, index) {
- customValue += _config.name + '=' + _config.value;
- if (index !== length - 1) {
- customValue += '\n';
- }
+ var customConfigs =
this.get('customConfigs').filterProperty('serviceName',
this.get('content.serviceName'));
+ customConfigs.forEach(function (_customConfig) {
+ var customValue = '';
+ var length = this.get('customConfig').length;
+ this.get('customConfig').forEach(function (_config, index) {
+ if ((_config.filename !== 'core-site.xml' && _customConfig.name !==
'core-site') || (_config.filename === 'core-site.xml' && _customConfig.name ===
'core-site')) {
+ customValue += _config.name + '=' + _config.value;
+ if (index !== length - 1) {
+ customValue += '\n';
+ }
+ }
+ }, this);
+ _customConfig.value = customValue;
+ serviceConfigs.pushObject(_customConfig);
+
}, this);
- customConfigs.value = customValue;
- serviceConfigs.pushObject(customConfigs);
+
}
},
@@ -254,80 +260,78 @@ App.MainServiceInfoConfigsController = E
var localServiceConfigs =
this.get('serviceConfigs').findProperty('serviceName',
this.get('content.serviceName'));
this.get('serviceConfigTags').forEach(function (_tag) {
- if (_tag.siteName !== 'core-site') {
- var properties = this.getSiteConfigProperties(_tag.siteName,
_tag.tagName);
- for (var index in properties) {
- var serviceConfigObj = {
- name: index,
- value: properties[index],
- defaultValue: properties[index],
- filename: _tag.siteName + ".xml"
- };
- if (this.get('configs').someProperty('name', index)) {
- var configProperty = this.get('configs').findProperty('name',
index);
- if (this.get('configs').findProperty('name',
index).isReconfigurable === false) {
- }
- serviceConfigObj.displayType = configProperty.displayType;
- serviceConfigObj.isRequired = configProperty.isRequired ?
configProperty.isRequired : true;
- serviceConfigObj.isReconfigurable =
(configProperty.isReconfigurable !== undefined) ?
configProperty.isReconfigurable : true;
- serviceConfigObj.isVisible = (configProperty.isVisible !==
undefined) ? configProperty.isVisible : true;
-
+ var properties = this.getSiteConfigProperties(_tag.siteName,
_tag.tagName);
+ for (var index in properties) {
+ var serviceConfigObj = {
+ name: index,
+ value: properties[index],
+ defaultValue: properties[index],
+ filename: _tag.siteName + ".xml"
+ };
+ if (this.get('configs').someProperty('name', index)) {
+ var configProperty = this.get('configs').findProperty('name', index);
+ if (this.get('configs').findProperty('name', index).isReconfigurable
=== false) {
}
- serviceConfigObj.displayType =
this.get('configs').someProperty('name', index) ?
this.get('configs').findProperty('name', index).displayType : null;
+ serviceConfigObj.displayType = configProperty.displayType;
+ serviceConfigObj.isRequired = configProperty.isRequired ?
configProperty.isRequired : true;
+ serviceConfigObj.isReconfigurable = (configProperty.isReconfigurable
!== undefined) ? configProperty.isReconfigurable : true;
+ serviceConfigObj.isVisible = (configProperty.isVisible !==
undefined) ? configProperty.isVisible : true;
- serviceConfigObj.isRequired =
this.get('configs').someProperty('name', index) ?
this.get('configs').findProperty('name', index).isRequired : null;
+ }
+ serviceConfigObj.displayType =
this.get('configs').someProperty('name', index) ?
this.get('configs').findProperty('name', index).displayType : null;
- if (_tag.siteName === 'global') {
- if (this.get('configs').someProperty('name', index)) {
- var item = this.get('configs').findProperty('name', index);
- if (item.displayType === 'int') {
- if (/\d+m$/.test(properties[index])) {
+ serviceConfigObj.isRequired = this.get('configs').someProperty('name',
index) ? this.get('configs').findProperty('name', index).isRequired : null;
- serviceConfigObj.value = properties[index].slice(0,
properties[index].length - 1);
- serviceConfigObj.defaultValue = serviceConfigObj.value;
- }
- }
- if (item.displayType === 'checkbox') {
- switch (properties[index]) {
- case 'true' :
- serviceConfigObj.value = true;
- serviceConfigObj.defaultValue = true;
- break;
- case 'false' :
- serviceConfigObj.value = false;
- serviceConfigObj.defaultValue = false;
- break;
- }
+ if (_tag.siteName === 'global') {
+ if (this.get('configs').someProperty('name', index)) {
+ var item = this.get('configs').findProperty('name', index);
+ if (item.displayType === 'int') {
+ if (/\d+m$/.test(properties[index])) {
+
+ serviceConfigObj.value = properties[index].slice(0,
properties[index].length - 1);
+ serviceConfigObj.defaultValue = serviceConfigObj.value;
}
}
- serviceConfigObj.id = 'puppet var';
- serviceConfigObj.serviceName =
this.get('configs').someProperty('name', index) ?
this.get('configs').findProperty('name', index).serviceName : null;
- serviceConfigObj.displayName =
this.get('configs').someProperty('name', index) ?
this.get('configs').findProperty('name', index).displayName : null;
- serviceConfigObj.category =
this.get('configs').someProperty('name', index) ?
this.get('configs').findProperty('name', index).category : null;
- 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)) {
- if (advancedConfig.someProperty('name', index)) {
-
- if (_tag.siteName !==
this.get('serviceConfigs').findProperty('serviceName',
this.get('content.serviceName')).filename) {
- serviceConfigObj.isVisible = false;
+ if (item.displayType === 'checkbox') {
+ switch (properties[index]) {
+ case 'true' :
+ serviceConfigObj.value = true;
+ serviceConfigObj.defaultValue = true;
+ break;
+ case 'false' :
+ serviceConfigObj.value = false;
+ serviceConfigObj.defaultValue = false;
+ break;
}
- serviceConfigObj.id = 'site property';
- serviceConfigObj.serviceName = this.get('content.serviceName');
- serviceConfigObj.category = 'Advanced';
- serviceConfigObj.displayName = index;
- serviceConfigObj.displayType = 'advanced';
- // localServiceConfigs.configs.pushObject(serviceConfigObj);
- serviceConfigs.pushObject(serviceConfigObj);
- } else {
- serviceConfigObj.id = 'conf-site';
- serviceConfigObj.serviceName = this.get('content.serviceName');
- this.get('customConfig').pushObject(serviceConfigObj);
}
+ }
+ serviceConfigObj.id = 'puppet var';
+ serviceConfigObj.serviceName =
this.get('configs').someProperty('name', index) ?
this.get('configs').findProperty('name', index).serviceName : null;
+ serviceConfigObj.displayName =
this.get('configs').someProperty('name', index) ?
this.get('configs').findProperty('name', index).displayName : null;
+ serviceConfigObj.category = this.get('configs').someProperty('name',
index) ? this.get('configs').findProperty('name', index).category : null;
+ 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)) {
+ if (advancedConfig.someProperty('name', index)) {
+ if (_tag.siteName !==
this.get('serviceConfigs').findProperty('serviceName',
this.get('content.serviceName')).filename) {
+ serviceConfigObj.isVisible = false;
+ }
+ serviceConfigObj.id = 'site property';
+ serviceConfigObj.serviceName = this.get('content.serviceName');
+ serviceConfigObj.category = 'Advanced';
+ serviceConfigObj.displayName = index;
+ serviceConfigObj.displayType = 'advanced';
+ // localServiceConfigs.configs.pushObject(serviceConfigObj);
+ serviceConfigs.pushObject(serviceConfigObj);
+ } else {
+ serviceConfigObj.id = 'conf-site';
+ serviceConfigObj.serviceName = this.get('content.serviceName');
+ this.get('customConfig').pushObject(serviceConfigObj);
}
}
+
}
}, this);
this.set('globalConfigs', globalConfigs);
@@ -421,8 +425,6 @@ App.MainServiceInfoConfigsController = E
},
restartServicePopup: function (event) {
- console.log("Enered the entry pointttt");
- var self = this;
var header;
var message;
var value;
@@ -552,7 +554,7 @@ App.MainServiceInfoConfigsController = E
this.set('globalConfigs', globalConfigs);
},
- setHiveHostName: function(globals) {
+ setHiveHostName: function (globals) {
if (globals.someProperty('name', 'hive_database')) {
//TODO: Hive host depends on the type of db selected. Change puppet
variable name if postgres is not the default db
var hiveDb = globals.findProperty('name', 'hive_database');
@@ -581,12 +583,14 @@ App.MainServiceInfoConfigsController = E
var configs = this.get('configMapping').filterProperty('foreignKey', null);
configs.forEach(function (_config) {
var value = this.getGlobConfigValue(_config.templateName, _config.value,
_config.name);
- uiConfig.pushObject({
- "id": "site property",
- "name": _config.name,
- "value": value,
- "filename": _config.filename
- });
+ if (value !== null) {
+ uiConfig.pushObject({
+ "id": "site property",
+ "name": _config.name,
+ "value": value,
+ "filename": _config.filename
+ });
+ }
}, this);
var dependentConfig =
this.get('configMapping').filterProperty('foreignKey');
dependentConfig.forEach(function (_config) {
@@ -714,7 +718,9 @@ App.MainServiceInfoConfigsController = E
result = result &&
this.createConfigSite(this.createGlobalSiteObj(_serviceTags.newTagName));
} else if (_serviceTags.siteName === 'core-site') {
console.log("TRACE: Inside core-site");
- result = result &&
this.createConfigSite(this.createCoreSiteObj(_serviceTags.newTagName));
+ if (this.get('content.serviceName') === 'HDFS') {
+ result = result &&
this.createConfigSite(this.createCoreSiteObj(_serviceTags.newTagName));
+ }
} else {
result = result &&
this.createConfigSite(this.createSiteObj(_serviceTags.siteName,
_serviceTags.newTagName));
}
@@ -722,11 +728,11 @@ App.MainServiceInfoConfigsController = E
return result;
},
- setNewTagNames: function(serviceConfigs) {
+ setNewTagNames: function (serviceConfigs) {
var time = (new Date).getTime();
- serviceConfigs.forEach(function(_serviceConfigs){
- _serviceConfigs.newTagName = 'version' + time;
- },this);
+ serviceConfigs.forEach(function (_serviceConfigs) {
+ _serviceConfigs.newTagName = 'version' + time;
+ }, this);
},
createConfigSite: function (data) {
@@ -843,8 +849,13 @@ App.MainServiceInfoConfigsController = E
getConfigForService: function (config) {
var data = {config: {}};
this.get('serviceConfigTags').forEach(function (_serviceTag) {
- if (config === 'new')
- data.config[_serviceTag.siteName] = _serviceTag.newTagName;
+ if (config === 'new') {
+ if (this.get('content.serviceName') === 'HDFS') {
+ data.config[_serviceTag.siteName] = _serviceTag.newTagName;
+ } else {
+ data.config[_serviceTag.siteName] = _serviceTag.tagName;
+ }
+ }
else if (config = 'previous') {
data.config[_serviceTag.siteName] = _serviceTag.tagName;
}
@@ -853,39 +864,45 @@ App.MainServiceInfoConfigsController = E
},
setCustomConfigs: function () {
- var site = this.get('stepConfigs').findProperty('serviceName',
this.get('content.serviceName')).get('configs').findProperty('id', 'conf-site');
+ var site = this.get('stepConfigs').findProperty('serviceName',
this.get('content.serviceName')).get('configs').filterProperty('id',
'conf-site');
var siteProperties = [];
var flag = true;
- var keyValue = site.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 dat entered config is allowed to reconfigure
- if (this.get('uiConfigs').someProperty('name', key[1])) {
- var property = {
- siteProperty: key[1],
- displayNames: []
- };
- if (this.get('configMapping').someProperty('name', key[1])) {
- this.setPropertyDisplayNames(property.displayNames,
this.get('configMapping').findProperty('name', key[1]).templateName);
+ site.forEach(function (_site) {
+ var keyValue = _site.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 dat entered config is allowed to reconfigure
+ if (this.get('uiConfigs').someProperty('name', key[1])) {
+ var property = {
+ siteProperty: key[1],
+ displayNames: []
+ };
+ if (this.get('configMapping').someProperty('name', key[1])) {
+ this.setPropertyDisplayNames(property.displayNames,
this.get('configMapping').findProperty('name', key[1]).templateName);
+ }
+ siteProperties.push(property);
+ if (_site.name !== 'core-site') {
+ flag = false;
+ } else {
+ this.setSiteProperty(key[1], value[1], _site.name + '.xml');
+ }
+ } else if (flag) {
+ this.setSiteProperty(key[1], value[1], _site.name + '.xml');
}
- siteProperties.push(property);
- flag = false;
- } else if (flag) {
- this.setSiteProperty(key[1], value[1], site.name + '.xml');
}
- }
+ }, this);
+ }
+ }, this);
- }, this);
- }
var result = {
flag: flag,
value: siteProperties
- }
+ };
return result;
},
@@ -907,6 +924,10 @@ App.MainServiceInfoConfigsController = E
* Set property of the site variable
*/
setSiteProperty: function (key, value, filename) {
+ if(filename === 'core-site.xml' &&
this.get('uiConfigs').filterProperty('filename','core-site.xml').someProperty('name',key))
{
+
this.get('uiConfigs').filterProperty('filename','core-site.xml').findProperty('name',key).value
= value;
+ return;
+ }
this.get('uiConfigs').pushObject({
"id": "site property",
"name": key,
Modified:
incubator/ambari/trunk/ambari-web/app/controllers/wizard/step5_controller.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/wizard/step5_controller.js?rev=1431818&r1=1431817&r2=1431818&view=diff
==============================================================================
---
incubator/ambari/trunk/ambari-web/app/controllers/wizard/step5_controller.js
(original)
+++
incubator/ambari/trunk/ambari-web/app/controllers/wizard/step5_controller.js
Fri Jan 11 02:25:18 2013
@@ -506,6 +506,7 @@ App.WizardStep5Controller = Em.Controlle
newZookeeper = Ember.Object.create({});
lastZoo = currentZooKeepers.get("lastObject");
newZookeeper.set("display_name", lastZoo.get("display_name"));
+ newZookeeper.set("component_name", lastZoo.get("component_name"));
newZookeeper.set("selectedHost", lastZoo.get("selectedHost"));
newZookeeper.set("availableHosts", this.getAvailableHosts("ZooKeeper"));
Modified:
incubator/ambari/trunk/ambari-web/app/controllers/wizard/step8_controller.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/wizard/step8_controller.js?rev=1431818&r1=1431817&r2=1431818&view=diff
==============================================================================
---
incubator/ambari/trunk/ambari-web/app/controllers/wizard/step8_controller.js
(original)
+++
incubator/ambari/trunk/ambari-web/app/controllers/wizard/step8_controller.js
Fri Jan 11 02:25:18 2013
@@ -248,16 +248,12 @@ App.WizardStep8Controller = Em.Controlle
* Set property of the site variable
*/
setSiteProperty: function (key, value, filename) {
- if (this.get('configs').someProperty('name', key)) {
- this.get('configs').findProperty('name', key).value = value;
- } else {
this.get('configs').pushObject({
"id": "site property",
"name": key,
"value": value,
"filename": filename
});
- }
},
loadSlaveConfiguration: function () {
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=1431818&r1=1431817&r2=1431818&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/data/custom_configs.js (original)
+++ incubator/ambari/trunk/ambari-web/app/data/custom_configs.js Fri Jan 11
02:25:18 2013
@@ -19,7 +19,19 @@
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,
+ "serviceName": "HDFS",
+ "category": "Advanced"
+ },
{
"id": "conf-site",
"name": "hdfs-site",
Modified: incubator/ambari/trunk/ambari-web/app/views/wizard/step5_view.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/views/wizard/step5_view.js?rev=1431818&r1=1431817&r2=1431818&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/views/wizard/step5_view.js (original)
+++ incubator/ambari/trunk/ambari-web/app/views/wizard/step5_view.js Fri Jan 11
02:25:18 2013
@@ -33,6 +33,7 @@ App.WizardStep5View = Em.View.extend({
} else {
controller.lastZooKeeper().set('showRemoveControl', false);
}
+ controller.rebalanceZookeeperHosts();
}
}