Permalink
Browse files

AMBARI-1048. Integrate slave configuration parameters with respective…

… service on step7 of installer wizard. (Jaimin Jetly via yusaku)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/branches/AMBARI-666@1419001 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
1 parent 19a5aee commit 115489a10f16bd41b6f19491709b45ecde42365b Yusaku Sako committed Dec 9, 2012
View
@@ -12,6 +12,9 @@ AMBARI-666 branch (unreleased changes)
NEW FEATURES
+ AMBARI-1048. Integrate slave configuration parameters with respective
+ service on step7 of installer wizard. (Jaimin Jetly via yusaku)
+
AMBARI-1031. Check for host registration at step3 of installer wizard
and retrieve information for RAM and no. of cores. (Jaimin Jetly via
yusaku)
@@ -34,6 +34,7 @@ App.InstallerController = App.WizardController.extend({
masterComponentHosts: null,
serviceConfigProperties: null,
advancedServiceConfig: null,
+ slaveGroupProperties: null,
controllerName: 'installerController'
}),
@@ -135,7 +136,7 @@ App.InstallerController = App.WizardController.extend({
hostsInfo.localRepo = false;
hostsInfo.localRepoPath = '';
}
- hostsInfo.bootRequestId = App.db.getBootRequestId() || null;
+ hostsInfo.bootRequestId = App.db.getBootRequestId() || null;
hostsInfo.sshKey = '';
hostsInfo.passphrase = '';
hostsInfo.confirmPassphrase = '';
@@ -255,7 +256,8 @@ App.InstallerController = App.WizardController.extend({
servicesInfo[index].isInstalled = false;
});
this.set('content.services', servicesInfo);
- console.log('installerController.loadServices: loaded data ', servicesInfo);
+ console.log('installerController.loadServices: loaded data ', JSON.stringify(servicesInfo));
+ console.log("The type odf serviceInfo: " + typeof servicesInfo);
console.log('selected services ', servicesInfo.filterProperty('isSelected', true).mapProperty('serviceName'));
},
@@ -308,7 +310,7 @@ App.InstallerController = App.WizardController.extend({
/**
* Save slaveHostComponents to main controller
- * @param stepController
+ * @param stepController called at the submission of step6
*/
saveSlaveComponentHosts: function (stepController) {
@@ -420,6 +422,21 @@ App.InstallerController = App.WizardController.extend({
App.db.setServiceConfigProperties(serviceConfigProperties);
this.set('content.serviceConfigProperties', serviceConfigProperties);
+
+ var slaveConfigProperties = [];
+ stepController.get('stepConfigs').forEach(function (_content) {
+ if (_content.get('configCategories').someProperty('isForSlaveComponent', true)) {
+ var slaveCategory = _content.get('configCategories').findProperty('isForSlaveComponent', true);
+ slaveCategory.get('slaveConfigs.groups').forEach(function (_group) {
+ _group.get('properties').forEach(function (_property) {
+ _property.set('storeValue', _property.get('value'));
+ }, this);
+ }, this);
+ slaveConfigProperties.pushObject(slaveCategory.get('slaveConfigs'));
+ }
+ }, this)
+ App.db.setSlaveProperties(slaveConfigProperties);
+ this.set('content.slaveGroupProperties', slaveConfigProperties);
},
/**
@@ -434,6 +451,33 @@ App.InstallerController = App.WizardController.extend({
},
/**
+ * Load properties for group of slaves to model
+ */
+ loadSlaveGroupProperties: function () {
+ var groupConfigProperties = App.db.getSlaveProperties() ? App.db.getSlaveProperties() : this.get('content.slaveComponentHosts');
+ if (groupConfigProperties) {
+ groupConfigProperties.forEach(function (_slaveComponentObj) {
+ if (_slaveComponentObj.groups) {
+ var groups = [];
+ _slaveComponentObj.groups.forEach(function (_group) {
+ var properties = [];
+ _group.properties.forEach(function (_property) {
+ var property = App.ServiceConfigProperty.create(_property);
+ property.set('value', _property.storeValue);
+ properties.pushObject(property);
+ }, this);
+ _group.properties = properties;
+ groups.pushObject(App.Group.create(_group));
+ }, this);
+ _slaveComponentObj.groups = groups;
+ }
+ }, this);
+ }
+ this.set('content.slaveGroupProperties', groupConfigProperties);
+ },
+
+
+ /**
* Load information about hosts with clients components
*/
loadClients: function () {
@@ -477,6 +521,7 @@ App.InstallerController = App.WizardController.extend({
case '8':
case '7':
this.loadServiceConfigProperties();
+ this.loadSlaveGroupProperties();
case '6':
this.loadSlaveComponentHosts();
this.loadClients();
@@ -498,7 +543,7 @@ App.InstallerController = App.WizardController.extend({
* Generate serviceComponents as pr the stack definition and save it to localdata
* called form stepController step4WizardController
*/
- loadServiceComponents : function (stepController, displayOrderConfig, apiUrl) {
+ loadServiceComponents: function (stepController, displayOrderConfig, apiUrl) {
var self = this;
var method = 'GET';
var testUrl = '/data/wizard/stack/hdp/version/1.2.0.json';
@@ -520,8 +565,8 @@ App.InstallerController = App.WizardController.extend({
displayName: null,
isDisabled: true,
isSelected: true,
- description:null,
- version:null
+ description: null,
+ version: null
});
var data = [];
@@ -533,7 +578,7 @@ App.InstallerController = App.WizardController.extend({
var myService = Service.create({
serviceName: entry.name,
displayName: displayOrderConfig[i].displayName,
- isDisabled: i === 0 ,
+ isDisabled: i === 0,
isSelected: true,
isHidden: displayOrderConfig[i].isHidden,
description: entry.comment,
@@ -611,7 +656,7 @@ App.InstallerController = App.WizardController.extend({
* called form stepController step8WizardController or step9WizardController
*/
installServices: function (isRetry) {
- if(!isRetry && this.get('content.cluster.requestId')){
+ if (!isRetry && this.get('content.cluster.requestId')) {
return;
}
@@ -653,11 +698,11 @@ App.InstallerController = App.WizardController.extend({
console.log("TRACE: value of the url is: " + url);
console.log("TRACE: error code status is: " + request.status);
console.log('Error message is: ' + request.responseText);
- var clusterStatus = {
- status: 'PENDING',
- isInstallError: false,
- isCompleted: false
- };
+ var clusterStatus = {
+ status: 'PENDING',
+ isInstallError: false,
+ isCompleted: false
+ };
self.saveClusterStatus(clusterStatus);
},
@@ -20,68 +20,144 @@ var App = require('app');
* Used to manage slave component config. User could create different settings for separate group
* @type {*}
*/
-App.SlaveComponentGroupsController = Em.ArrayController.extend({
+App.SlaveComponentGroupsController = Em.Controller.extend({
name: 'slaveComponentGroupsController',
contentBinding: 'App.router.wizardStep7Controller.slaveComponentHosts',
+ stepConfigsBinding: 'App.router.wizardStep7Controller.stepConfigs',
+
serviceBinding: 'App.router.wizardStep7Controller.selectedService',
+ servicesBinding: 'App.router.wizardStep7Controller.content.services',
+
+ clearStep: function () {
+
+ },
+
+ loadStep: function () {
+ this.clearStep();
+ this.loadGroups();
+ },
+
+ loadGroups: function () {
+
+ this.get('stepConfigs').forEach(function (_serviceConfig) {
+ var categoryConfig = _serviceConfig.get('configCategories');
+ if (categoryConfig.someProperty('isForSlaveComponent', true)) {
+ var slaveCategory = categoryConfig.findProperty('isForSlaveComponent', true);
+ if (this.get('content')) {
+ if (this.get('content').someProperty('componentName', slaveCategory.get('name').toUpperCase())) {
+ var component = this.get('content').findProperty('componentName', slaveCategory.get('name').toUpperCase());
+ var slaveConfigs = slaveCategory.get('slaveConfigs');
+ slaveCategory.set('slaveConfigs', component);
+ var slaveGroups = [];
+ if (component.groups) {
+ component.groups.forEach(function (_group) {
+ slaveGroups.pushObject(_group);
+ }, this);
+ slaveCategory.set('slaveConfigs.groups', slaveGroups);
+ }
+ slaveCategory.set('slaveConfigs.componentName', component.componentName);
+ slaveCategory.set('slaveConfigs.displayName', component.displayName);
+ /*slaveCategory.set('slaveConfigs.groups.name', component.get('name'));
+ slaveCategory.set('slaveConfigs.groups.index', component.get('index'));
+ slaveCategory.set('slaveConfigs.groups.type', component.get('type'));
+ slaveCategory.set('slaveConfigs.groups.active', component.get('active'));*/
+ if (!slaveCategory.get('slaveConfigs.groups')) {
+ slaveCategory.set('slaveConfigs.groups', []);
+ var componentProperties = this.componentProperties(_serviceConfig.serviceName);
+ var defaultGroup = {name: 'Default', index: 'default', type: 'default', active: true, properties: componentProperties};
+ slaveCategory.get('slaveConfigs.groups').pushObject(App.Group.create(defaultGroup));
+ }
+ }
+ }
+ }
+ }, this);
+ debugger;
+ },
+
+ componentProperties: function (serviceName) {
+
+ var serviceConfigs = require('data/service_configs').findProperty('serviceName', serviceName);
+
+ var configs = [];
+ var componentName = null;
+ switch (serviceName) {
+ case 'HDFS':
+ componentName = 'DataNode';
+ break;
+ case 'MAPREDUCE':
+ componentName = 'TaskTracker';
+ break;
+ case 'HBASE':
+ componentName = 'RegionServer';
+ }
+ var slaveConfigs = serviceConfigs.configs.filterProperty('category', componentName);
+ slaveConfigs.forEach(function (_serviceConfigProperty) {
+ var serviceConfigProperty = App.ServiceConfigProperty.create(_serviceConfigProperty);
+ configs.pushObject(serviceConfigProperty);
+ serviceConfigProperty.validate();
+ }, this);
+ return configs;
+ },
+
selectedComponentName: function () {
switch (App.router.get('wizardStep7Controller.selectedService.serviceName')) {
case 'HDFS':
- return 'DATANODE';
+ return { name: 'DATANODE',
+ displayName: 'DataNode'};
case 'MAPREDUCE':
- return 'TASKTRACKER';
+ return { name: 'TASKTRACKER',
+ displayName: 'TaskTracker'};
+
case 'HBASE':
- return 'HBASE_REGIONSERVER';
+ return { name: 'HBASE_REGIONSERVER',
+ displayName: 'RegionServer'};
default:
return null;
}
}.property('App.router.wizardStep7Controller.selectedService'),
- selectedComponentDisplayName: function() {
- return App.format.role(this.get('selectedComponentName'));
+ selectedComponentDisplayName: function () {
+ return App.format.role(this.get('selectedComponentName').name);
}.property('selectedComponentName'),
selectedSlaveComponent: function () {
- var selectedComponentName = this.get('selectedComponentName');
- if (selectedComponentName) {
- return this.findProperty('componentName', selectedComponentName);
- }
- }.property('selectedComponentName'),
+ var selectedComponentName = this.get('selectedComponentName').displayName;
+ var configs = null;
+ this.get('stepConfigs').forEach(function (_serviceConfig) {
+ var categoryConfig = _serviceConfig.get('configCategories');
+ if (categoryConfig.someProperty('name', selectedComponentName)) {
+ configs = categoryConfig.findProperty('name', selectedComponentName).get('slaveConfigs');
+ }
+ }, this);
+ debugger;
+ return configs;
+ }.property('selectedComponentName', 'stepConfigs.@each.configCategories','stepConfigs.@each.configCategories.@each.slaveConfigs'),
hosts: function () {
- var selectedComponentName = this.get('selectedComponentName');
- if (selectedComponentName) {
- var component = this.findProperty('componentName', selectedComponentName);
- if(component){
- return component.hosts;
- }
+ if (this.get('selectedSlaveComponent')) {
+ return this.get('selectedSlaveComponent').hosts;
}
- }.property('@each.hosts', 'selectedComponentName'),
+ }.property('selectedSlaveComponent'),
groups: function () {
var hosts = this.get('hosts');
- if(hosts){
+ if (hosts) {
return hosts.mapProperty('group').uniq();
}
}.property('hosts'),
componentGroups: function () {
var component = this.get('selectedSlaveComponent');
- if(component){
- if (!component.groups) {
- component.groups = [];
- var defaultGroup = {name: 'Default', index: 'default', type: 'default', active: true};
- component.groups.pushObject(defaultGroup);
- }
- return component.groups;
+ if (component && component.groups) {
+ return component.groups;
}
return [];
- }.property('selectedSlaveComponent'),
+ }.property('selectedSlaveComponent', 'selectedSlaveComponent.groups','stepConfigs.@each'),
getGroupsForDropDown: function () {
return this.get('componentGroups').getEach('name');
@@ -91,7 +167,7 @@ App.SlaveComponentGroupsController = Em.ArrayController.extend({
var componentGroups = this.get('componentGroups');
if (componentGroups) {
var active = componentGroups.findProperty('active', true);
- if (active){
+ if (active) {
return active;
}
}
@@ -159,16 +235,16 @@ App.SlaveComponentGroupsController = Em.ArrayController.extend({
var newGroupName = 'New Group';
component.groups.setEach('active', false);
var newGroups = component.groups.filterProperty('name', newGroupName);
- if (newGroups.length === 0){
+ if (newGroups.length === 0) {
component.newGroupIndex = 0;
}
else {
component.newGroupIndex = component.newGroupIndex || 0;
this.checkGroupName();
newGroupName = 'New Group ' + component.newGroupIndex;
}
- var newGroup = {name: newGroupName, index: component.newGroupIndex, type: 'new', active: true};
- component.groups.pushObject(newGroup);
+ var newGroup = {name: newGroupName, index: component.newGroupIndex, type: 'new', active: true, properties: this.componentProperties(App.router.get('wizardStep7Controller.selectedService.serviceName'))};
+ component.groups.pushObject(App.Group.create(newGroup));
$('.remove-group-error').hide();
},
@@ -192,7 +268,7 @@ App.SlaveComponentGroupsController = Em.ArrayController.extend({
getHostsByGroup: function (group) {
var hosts = this.get('hosts');
- if(hosts){
+ if (hosts) {
return hosts.filterProperty('group', group.name);
}
},
@@ -203,8 +279,7 @@ App.SlaveComponentGroupsController = Em.ArrayController.extend({
*/
showSlaveComponentGroup: function (event) {
var component = this.get('selectedSlaveComponent');
- if(!component.groups){
- debugger;
+ if (!component.groups) {
}
component.groups.setEach('active', false);
var group = component.groups.filterProperty('name', event.context.name);
@@ -260,13 +335,12 @@ App.SlaveComponentGroupsController = Em.ArrayController.extend({
return true;
else {
var assignedHosts = component.hosts.filterProperty('group', group.name);
- if (assignedHosts.length !== 0){
+ if (assignedHosts.length !== 0) {
assignedHosts.setEach('group', newGroupName);
}
var groupFilter = component.groups.filterProperty('name', group.name);
groupFilter.setEach('name', newGroupName);
}
return false;
}
-
});
Oops, something went wrong.

0 comments on commit 115489a

Please sign in to comment.