You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ja...@apache.org on 2013/05/10 23:25:51 UTC
svn commit: r1481192 - in /incubator/ambari/trunk: CHANGES.txt
ambari-web/app/controllers/wizard/step6_controller.js
ambari-web/app/messages.js
Author: jaimin
Date: Fri May 10 21:25:50 2013
New Revision: 1481192
URL: http://svn.apache.org/r1481192
Log:
AMBARI-2105. Assign Slaves page allows the user to specify a host with no components on it. (jaimin)
Modified:
incubator/ambari/trunk/CHANGES.txt
incubator/ambari/trunk/ambari-web/app/controllers/wizard/step6_controller.js
incubator/ambari/trunk/ambari-web/app/messages.js
Modified: incubator/ambari/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1481192&r1=1481191&r2=1481192&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Fri May 10 21:25:50 2013
@@ -837,6 +837,9 @@ Trunk (unreleased changes):
BUG FIXES
+ AMBARI-2105. Assign Slaves page allows the user to specify a host with no
+ components on it. (jaimin)
+
AMBARI-2106. Fix apache rat check issues for ambari-server and ambari-agent.
(swagle)
Modified: incubator/ambari/trunk/ambari-web/app/controllers/wizard/step6_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/wizard/step6_controller.js?rev=1481192&r1=1481191&r2=1481192&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/controllers/wizard/step6_controller.js (original)
+++ incubator/ambari/trunk/ambari-web/app/controllers/wizard/step6_controller.js Fri May 10 21:25:50 2013
@@ -43,13 +43,13 @@ App.WizardStep6Controller = Em.Controlle
*/
isMasters: false,
- components:require('data/service_components'),
+ components: require('data/service_components'),
- isAddHostWizard: function(){
+ isAddHostWizard: function () {
return this.get('content.controllerName') === 'addHostController';
}.property('content.controllerName'),
- isInstallerWizard: function(){
+ isInstallerWizard: function () {
return this.get('content.controllerName') === 'installerController';
}.property('content.controllerName'),
@@ -59,9 +59,9 @@ App.WizardStep6Controller = Em.Controlle
var err = true;
var hosts = this.get('hosts');
var headers = this.get('headers');
- headers.forEach(function(header) {
+ headers.forEach(function (header) {
var all_false = true;
- hosts.forEach(function(host) {
+ hosts.forEach(function (host) {
var checkboxes = host.get('checkboxes');
all_false &= !checkboxes.findProperty('title', header.get('label')).checked;
});
@@ -72,14 +72,14 @@ App.WizardStep6Controller = Em.Controlle
this.set('errorMessage', '');
}
- if(this.get('isAddHostWizard')) {
+ if (this.get('isAddHostWizard')) {
if (this.get('isMasters')) {
this.set('errorMessage', '');
}
else {
- hosts.forEach(function(host) {
+ hosts.forEach(function (host) {
isError = false;
- headers.forEach(function(header) {
+ headers.forEach(function (header) {
isError |= host.get('checkboxes').findProperty('title', header.get('label')).checked;
});
isError = !isError;
@@ -113,7 +113,7 @@ App.WizardStep6Controller = Em.Controlle
* Enable some service for all hosts
* @param event
*/
- selectAllNodes: function(event) {
+ selectAllNodes: function (event) {
this.setAllNodes(event.context.label, true);
},
@@ -121,7 +121,7 @@ App.WizardStep6Controller = Em.Controlle
* Disable some services for all hosts
* @param event
*/
- deselectAllNodes: function(event) {
+ deselectAllNodes: function (event) {
this.setAllNodes(event.context.label, false);
},
@@ -130,9 +130,9 @@ App.WizardStep6Controller = Em.Controlle
* @param {String} label - service name
* @param {Boolean} checked - true - enable, false - disable
*/
- setAllNodes: function(label, checked) {
- this.get('hosts').forEach(function(host) {
- host.get('checkboxes').forEach(function(checkbox) {
+ setAllNodes: function (label, checked) {
+ this.get('hosts').forEach(function (host) {
+ host.get('checkboxes').forEach(function (checkbox) {
if (checkbox.get('title') === label) {
checkbox.set('checked', checked);
}
@@ -145,7 +145,7 @@ App.WizardStep6Controller = Em.Controlle
* @param name serviceName
* @return {*}
*/
- isServiceSelected: function(name) {
+ isServiceSelected: function (name) {
return this.get('content.services').findProperty('serviceName', name).get('isSelected');
},
@@ -153,14 +153,14 @@ App.WizardStep6Controller = Em.Controlle
* Checkbox check callback
* @param {String} title
*/
- checkCallback: function(title) {
+ checkCallback: function (title) {
var header = this.get('headers').findProperty('label', title);
var hosts = this.get('hosts');
var allTrue = true;
var allFalse = true;
- hosts.forEach(function(host) {
- host.get('checkboxes').forEach(function(cb) {
+ hosts.forEach(function (host) {
+ host.get('checkboxes').forEach(function (cb) {
if (cb.get('title') === title) {
allTrue &= cb.get('checked');
allFalse &= !cb.get('checked');
@@ -172,7 +172,7 @@ App.WizardStep6Controller = Em.Controlle
this.clearError();
},
- getComponentDisplayName: function(componentName) {
+ getComponentDisplayName: function (componentName) {
return this.get('components').findProperty('component_name', componentName).display_name
},
@@ -194,9 +194,9 @@ App.WizardStep6Controller = Em.Controlle
}
if (this.isServiceSelected('ZOOKEEPER')) {
headers.pushObject(Em.Object.create({
- name:'ZOOKEEPER_SERVER',
- label: self.getComponentDisplayName('ZOOKEEPER_SERVER')
- }));
+ name: 'ZOOKEEPER_SERVER',
+ label: self.getComponentDisplayName('ZOOKEEPER_SERVER')
+ }));
}
}
else {
@@ -206,13 +206,13 @@ App.WizardStep6Controller = Em.Controlle
}));
if (this.isServiceSelected('MAPREDUCE')) {
headers.pushObject(Em.Object.create({
- name:'TASKTRACKER',
+ name: 'TASKTRACKER',
label: self.getComponentDisplayName('TASKTRACKER')
}));
}
if (this.isServiceSelected('HBASE')) {
headers.pushObject(Em.Object.create({
- name:'HBASE_REGIONSERVER',
+ name: 'HBASE_REGIONSERVER',
label: self.getComponentDisplayName('HBASE_REGIONSERVER')
}));
}
@@ -222,7 +222,7 @@ App.WizardStep6Controller = Em.Controlle
}));
}
- headers.forEach(function(header) {
+ headers.forEach(function (header) {
header.setProperties({ allChecked: false, noChecked: true });
});
@@ -230,12 +230,12 @@ App.WizardStep6Controller = Em.Controlle
this.render();
if (this.get('isMasters')) {
- if(this.get('content.skipMasterStep')) {
+ if (this.get('content.skipMasterStep')) {
App.router.send('next');
}
}
else {
- if(this.get('content.skipSlavesStep')) {
+ if (this.get('content.skipSlavesStep')) {
App.router.send('next');
}
}
@@ -272,7 +272,7 @@ App.WizardStep6Controller = Em.Controlle
checkboxes: []
});
- self.get('headers').forEach(function(header) {
+ self.get('headers').forEach(function (header) {
obj.checkboxes.pushObject(Em.Object.create({
title: header.label,
checked: false,
@@ -293,7 +293,7 @@ App.WizardStep6Controller = Em.Controlle
hostsObj.forEach(function (host) {
this.get('hosts').pushObject(host);
}, this);
- this.get('headers').forEach(function(header) {
+ this.get('headers').forEach(function (header) {
self.checkCallback(header.get('label'));
});
},
@@ -303,14 +303,14 @@ App.WizardStep6Controller = Em.Controlle
* @param hostsObj
* @return {*}
*/
- renderSlaves: function(hostsObj) {
+ renderSlaves: function (hostsObj) {
var self = this;
var allHosts = this.getHostNames();
var headers = this.get('headers');
var slaveComponents = this.get('content.slaveComponentHosts');
if (!slaveComponents) { // we are at this page for the first time
var client_is_set = false;
- hostsObj.forEach(function(host) {
+ hostsObj.forEach(function (host) {
host.isMaster = self.hasMasterComponents(host.hostName);
var checkboxes = host.get('checkboxes');
checkboxes.setEach('checked', !host.isMaster);
@@ -326,13 +326,13 @@ App.WizardStep6Controller = Em.Controlle
}
});
- if(this.get('isInstallerWizard') && hostsObj.everyProperty('isMaster', true)){
+ if (this.get('isInstallerWizard') && hostsObj.everyProperty('isMaster', true)) {
var lastHost = hostsObj[hostsObj.length - 1];
lastHost.get('checkboxes').setEach('checked', true);
}
}
else {
- this.get('headers').forEach(function(header) {
+ this.get('headers').forEach(function (header) {
var nodes = slaveComponents.findProperty('componentName', header.get('name'));
if (nodes) {
nodes.hosts.forEach(function (_node) {
@@ -359,17 +359,17 @@ App.WizardStep6Controller = Em.Controlle
* @param hostsObj
* @return {*}
*/
- renderMasters: function(hostsObj) {
+ renderMasters: function (hostsObj) {
var self = this;
var masterComponentHosts = this.get('content.masterComponentHosts');
console.warn('masterComponentHosts', masterComponentHosts);
if (masterComponentHosts) {
- masterComponentHosts.forEach(function(item) {
+ masterComponentHosts.forEach(function (item) {
var host = hostsObj.findProperty('hostName', item.hostName);
if (host) {
var checkbox = host.get('checkboxes').findProperty('title', item.display_name);
- if(checkbox){
+ if (checkbox) {
checkbox.set('checked', true);
}
}
@@ -394,39 +394,64 @@ App.WizardStep6Controller = Em.Controlle
* @return {Boolean}
*/
validate: function () {
+
+ if (this.get('isAddHostWizard')) {
+ return this.validateEachHost(Em.I18n.t('installer.step6.error.mustSelectOneForHost'));
+ }
+ else if (this.get('isInstallerWizard')) {
+ //this.validateEachComponent() ? this.validateEachHost(Em.I18n.t('installer.step6.error.mustSelectOneForHost') ? return true : return false : return false;
+ return this.validateEachComponent() && this.validateEachHost(Em.I18n.t('installer.step6.error.mustSelectOneForSlaveHost'));
+ }
+ },
+
+ /**
+ * Validate all components for each host. Return do we have errors or not
+ * @return {Boolean}
+ */
+ validateEachHost: function (errorMsg) {
+
var isError = false;
var hosts = this.get('hosts');
var headers = this.get('headers');
- if(this.get('isAddHostWizard')) {
- for(var i = 0; i < hosts.length; i++) {
- var checkboxes = hosts[i].get('checkboxes');
- isError = false;
- headers.forEach(function(header) {
- isError |= checkboxes.findProperty('title', header.get('label')).checked;
- });
- isError = !isError;
- if (isError) {
- this.set('errorMessage', Em.I18n.t('installer.step6.error.mustSelectOneForHost'));
- break;
- }
- }
- }
- else {
-
- headers.forEach(function(header) {
- var all_false = true;
- hosts.forEach(function(host) {
- var checkboxes = host.get('checkboxes');
- all_false = all_false && !checkboxes.findProperty('title', header.get('label')).checked;
- });
- isError = isError || all_false;
+ for (var i = 0; i < hosts.length; i++) {
+ if (this.get('isInstallerWizard') && this.get('content.masterComponentHosts').someProperty('hostName', hosts[i].hostName)) {
+ continue;
+ }
+ var checkboxes = hosts[i].get('checkboxes');
+ isError = false;
+ headers.forEach(function (header) {
+ isError |= checkboxes.findProperty('title', header.get('label')).checked;
});
+ isError = !isError;
if (isError) {
- this.set('errorMessage', Em.I18n.t('installer.step6.error.mustSelectOne'));
+ this.set('errorMessage', errorMsg);
+ break;
}
}
+ return !isError;
+ },
+ /**
+ * Validate a component for all hosts. Return do we have errors or not
+ * @return {Boolean}
+ */
+ validateEachComponent: function () {
+ var isError = false;
+ var hosts = this.get('hosts');
+ var headers = this.get('headers');
+ headers.forEach(function (header) {
+ var all_false = true;
+ hosts.forEach(function (host) {
+ var checkboxes = host.get('checkboxes');
+ all_false = all_false && !checkboxes.findProperty('title', header.get('label')).checked;
+ });
+ isError = isError || all_false;
+ });
+ if (isError) {
+ this.set('errorMessage', Em.I18n.t('installer.step6.error.mustSelectOne'));
+ }
return !isError;
}
-});
+})
+;
Modified: incubator/ambari/trunk/ambari-web/app/messages.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/messages.js?rev=1481192&r1=1481191&r2=1481192&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/messages.js (original)
+++ incubator/ambari/trunk/ambari-web/app/messages.js Fri May 10 21:25:50 2013
@@ -340,10 +340,11 @@ Em.I18n.translations = {
'installer.step6.header':'Assign Slaves and Clients',
'installer.step6.body':'Assign slave and client components to hosts you want to run them on.<br/>Hosts that are assigned master components are shown with <i class=icon-asterisks>✵</i>. <br/>"Client" will install ',
- 'installer.step6.error.mustSelectOne':'You must assign at least one host to each.',
+ 'installer.step6.error.mustSelectOne':'You must assign at least one host to each component.',
'installer.step6.error.mustSelectOneForHost':'You must assign at least one slave/client component to each.',
'installer.step6.wizardStep6Host.title':'master components hosted on {0}',
'installer.step6.addHostWizard.body':'Assign HBase master and ZooKeeper server.',
+ 'installer.step6.error.mustSelectOneForSlaveHost': 'You must assign at least one slave/client component to each host with no master component',
'installer.step7.header':'Customize Services',
'installer.step7.body':'We have come up with recommended configurations for the services you selected. Customize them as you see fit.',