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/08/22 01:48:15 UTC
git commit: AMBARI-6979. FE: Installer wizard should proceed even
when validation call failed
Repository: ambari
Updated Branches:
refs/heads/trunk 1fc247566 -> 9751b8538
AMBARI-6979. FE: Installer wizard should proceed even when validation call failed
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/9751b853
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9751b853
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9751b853
Branch: refs/heads/trunk
Commit: 9751b853856b8ad90391e24277a11c2f0d47c5b2
Parents: 1fc24756
Author: Srimanth Gunturi <sg...@hortonworks.com>
Authored: Thu Aug 21 11:33:17 2014 -0700
Committer: Srimanth Gunturi <sg...@hortonworks.com>
Committed: Thu Aug 21 16:33:33 2014 -0700
----------------------------------------------------------------------
.../app/controllers/wizard/step5_controller.js | 52 +++++++++++++-------
.../app/controllers/wizard/step6_controller.js | 48 ++++++++++++++++--
.../app/controllers/wizard/step7_controller.js | 2 +-
ambari-web/app/messages.js | 6 ++-
ambari-web/app/mixins/common/serverValidator.js | 36 +++++++++-----
ambari-web/app/routes/add_host_routes.js | 14 +++---
ambari-web/app/routes/add_service_routes.js | 12 +++--
ambari-web/app/routes/installer.js | 20 ++++----
ambari-web/app/templates/wizard/step5.hbs | 4 +-
ambari-web/app/templates/wizard/step6.hbs | 4 +-
10 files changed, 134 insertions(+), 64 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/9751b853/ambari-web/app/controllers/wizard/step5_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step5_controller.js b/ambari-web/app/controllers/wizard/step5_controller.js
index 7df1b8b..0e10f42 100644
--- a/ambari-web/app/controllers/wizard/step5_controller.js
+++ b/ambari-web/app/controllers/wizard/step5_controller.js
@@ -141,6 +141,13 @@ App.WizardStep5Controller = Em.Controller.extend({
generalWarningMessages: [],
/**
+ * true if any error exists
+ */
+ anyError: function() {
+ return this.get('servicesMasters').some(function(m) { return m.get('errorMessage'); }) || this.get('generalErrorMessages').some(function(m) { return m; });
+ }.property('servicesMasters.@each.errorMessage', 'generalErrorMessages'),
+
+ /**
* true if any warning exists
*/
anyWarning: function() {
@@ -313,7 +320,9 @@ App.WizardStep5Controller = Em.Controller.extend({
this.set('generalErrorMessages', generalErrorMessages);
this.set('generalWarningMessages', generalWarningMessages);
- this.set('submitDisabled', anyErrors);
+ // use this.set('submitDisabled', anyErrors); is validation results should block next button
+ // It's because showValidationIssuesAcceptBox allow use accept validation issues and continue
+ this.set('submitDisabled', false); //this.set('submitDisabled', anyErrors);
},
/**
@@ -1040,35 +1049,40 @@ App.WizardStep5Controller = Em.Controller.extend({
submit: function () {
var self = this;
- var primary = function() {
- var goNextStepIfValid = function() {
- if (!self.get('submitDisabled')) {
- App.router.send('next');
- }
- };
+ var goNextStepIfValid = function() {
+ if (!self.get('submitDisabled')) {
+ App.router.send('next');
+ }
+ };
if (App.get('supports.serverRecommendValidate')) {
- self.recommendAndValidate(function() {
- goNextStepIfValid();
- });
- } else {
- self.updateIsSubmitDisabled();
- goNextStepIfValid();
- }
+ self.recommendAndValidate(function() {
+ self.showValidationIssuesAcceptBox(goNextStepIfValid);
+ });
+ } else {
+ self.updateIsSubmitDisabled();
+ goNextStepIfValid();
}
+ },
- if (self.get('anyWarning')) {
+ /**
+ * In case of any validation issues shows accept dialog box for user which allow cancel and fix issues or continue anyway
+ * @metohd submit
+ */
+ showValidationIssuesAcceptBox: function(callback) {
+ var self = this;
+ if (self.get('anyWarning') || self.get('anyError')) {
App.ModalPopup.show({
primary: Em.I18n.t('common.continueAnyway'),
- header: Em.I18n.t('installer.step5.warningsAttention.header'),
- body: Em.I18n.t('installer.step5.warningsAttention'),
+ header: Em.I18n.t('installer.step5.validationIssuesAttention.header'),
+ body: Em.I18n.t('installer.step5.validationIssuesAttention'),
onPrimary: function () {
this.hide();
- primary();
+ callback();
}
});
} else {
- primary();
+ callback();
}
}
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/9751b853/ambari-web/app/controllers/wizard/step6_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step6_controller.js b/ambari-web/app/controllers/wizard/step6_controller.js
index 78c1254..8596479 100644
--- a/ambari-web/app/controllers/wizard/step6_controller.js
+++ b/ambari-web/app/controllers/wizard/step6_controller.js
@@ -110,22 +110,36 @@ App.WizardStep6Controller = Em.Controller.extend({
generalWarningMessages: [],
/**
- * true if validation has any general error message
+ * true if validation has any general (which is not related with concrete host) error message
*/
- anyErrors: function() {
+ anyGeneralErrors: function() {
var messages = this.get('generalErrorMessages');
return this.get('errorMessage') || (messages && messages.length > 0);
}.property('generalErrorMessages', 'generalErrorMessages.@each', 'errorMessage'),
/**
- * true if validation has any general warning message
+ * true if validation has any general (which is not related with concrete host) warning message
*/
- anyWarnings: function() {
+ anyGeneralWarnings: function() {
var messages = this.get('generalWarningMessages');
return messages && messages.length > 0;
}.property('generalWarningMessages', 'generalWarningMessages.@each'),
/**
+ * true if validation has any error message (general or host specific)
+ */
+ anyErrors: function() {
+ return this.get('anyGeneralErrors') || this.get('hosts').some(function(h) { return h.get('errorMessages').length > 0; });
+ }.property('anyGeneralErrors', 'hosts.@each.errorMessages'),
+
+ /**
+ * true if validation has any warning message (general or host specific)
+ */
+ anyWarnings: function() {
+ return this.get('anyGeneralWarnings') || this.get('hosts').some(function(h) { return h.get('warnMessages').length > 0; });
+ }.property('anyGeneralWarnings', 'hosts.@each.warnMessages'),
+
+ /**
* Verify condition that at least one checkbox of each component was checked
* @method clearError
*/
@@ -657,7 +671,9 @@ App.WizardStep6Controller = Em.Controller.extend({
}
});
- this.set('submitDisabled', anyErrors);
+ // use this.set('submitDisabled', anyErrors); is validation results should block next button
+ // It's because showValidationIssuesAcceptBox allow use accept validation issues and continue
+ this.set('submitDisabled', false);
},
/**
@@ -834,5 +850,27 @@ App.WizardStep6Controller = Em.Controller.extend({
}
return !isError;
+ },
+
+ /**
+ * In case of any validation issues shows accept dialog box for user which allow cancel and fix issues or continue anyway
+ * @metohd submit
+ */
+ showValidationIssuesAcceptBox: function(callback) {
+ var self = this;
+
+ if (App.get('supports.serverRecommendValidate') && (self.get('anyWarnings') || self.get('anyErrors'))) {
+ App.ModalPopup.show({
+ primary: Em.I18n.t('common.continueAnyway'),
+ header: Em.I18n.t('installer.step6.validationIssuesAttention.header'),
+ body: Em.I18n.t('installer.step6.validationIssuesAttention'),
+ onPrimary: function () {
+ this.hide();
+ callback();
+ }
+ });
+ } else {
+ callback();
+ }
}
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/9751b853/ambari-web/app/controllers/wizard/step7_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step7_controller.js b/ambari-web/app/controllers/wizard/step7_controller.js
index 6bf145c..809a9ee 100644
--- a/ambari-web/app/controllers/wizard/step7_controller.js
+++ b/ambari-web/app/controllers/wizard/step7_controller.js
@@ -722,7 +722,7 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, {
//STEP 6: Distribute configs by service and wrap each one in App.ServiceConfigProperty (configs -> serviceConfigs)
var self = this;
if (App.get('supports.serverRecommendValidate')) {
- this.loadServerSideConfigsRecommendations().complete(function() {
+ this.loadServerSideConfigsRecommendations().always(function() {
self.setStepConfigs(configs, storedConfigs);
self.checkHostOverrideInstaller();
self.activateSpecialConfigs();
http://git-wip-us.apache.org/repos/asf/ambari/blob/9751b853/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 68ded2b..33ca76e 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -614,8 +614,8 @@ Em.I18n.translations = {
'installer.step5.body.coHostedComponents':'<i class="icon-asterisks">✵</i> {0} will be hosted on the same host.',
'installer.step5.hostInfo':'%@ (%@, %@ cores)',
'installer.step5.hiveGroup':'HiveServer2, WebHCat Server, MySQL Server',
- 'installer.step5.warningsAttention.header': 'Warnings',
- 'installer.step5.warningsAttention': 'Your master component assignment has warnings and needs attention.',
+ 'installer.step5.validationIssuesAttention.header': 'Validation Issues',
+ 'installer.step5.validationIssuesAttention': 'Master component assignments have issues that need attention.',
'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>.',
@@ -626,6 +626,8 @@ Em.I18n.translations = {
'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.step6.validationIssuesAttention.header': 'Validation Issues',
+ 'installer.step6.validationIssuesAttention': 'Slave and Client component assignments have issues that need attention.',
'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.',
http://git-wip-us.apache.org/repos/asf/ambari/blob/9751b853/ambari-web/app/mixins/common/serverValidator.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/serverValidator.js b/ambari-web/app/mixins/common/serverValidator.js
index f809538..5140224 100644
--- a/ambari-web/app/mixins/common/serverValidator.js
+++ b/ambari-web/app/mixins/common/serverValidator.js
@@ -146,7 +146,7 @@ App.ServerValidatorMixin = Em.Mixin.create({
this.set('configValidationFailed', false);
if (this.get('loadAdditionalinfo')) {
var self = this;
- this.getHostNames().complete(function() {
+ this.getHostNames().always(function() {
if (self.get('configValidationFailed')) {
self.warnUser(deferred);
} else {
@@ -161,12 +161,26 @@ App.ServerValidatorMixin = Em.Mixin.create({
},
getHostNames: function() {
- return App.ajax.send({
- name: 'hosts.all',
- sender: this,
- success: 'getHostNamesSuccess',
- error: 'getHostNamesError'
- })
+ var self = this;
+
+ if (self.get('isInstaller')) {
+ // In installer wizard 'hosts.all' AJAX will not work cause cluster haven't been created yet
+ var hosts = [];
+ for (var host in self.get('content.hosts')) {
+ hosts.push(host);
+ }
+ self.set("allHostNames", hosts);
+ var deferred = $.Deferred();
+ deferred.resolve();
+ return deferred;
+ } else {
+ return App.ajax.send({
+ name: 'hosts.all',
+ sender: self,
+ success: 'getHostNamesSuccess',
+ error: 'getHostNamesError'
+ });
+ }
},
getHostNamesSuccess: function(data) {
@@ -256,12 +270,8 @@ App.ServerValidatorMixin = Em.Mixin.create({
this.set("isApplyingChanges", false);
deferred.reject();
return App.showAlertPopup(Em.I18n.t('installer.step7.popup.validation.failed.header'), Em.I18n.t('installer.step7.popup.validation.request.failed.body'));
- } else if (this.get('configValidationError')) {
- this.set("isApplyingChanges", false);
- this.set('isSubmitDisabled', true);
- deferred.reject();
- return App.showAlertPopup(Em.I18n.t('installer.step7.popup.validation.failed.header'), Em.I18n.t('installer.step7.popup.validation.failed.body'));
- } else if (this.get('configValidationWarning')) {
+ } else if (this.get('configValidationWarning') || this.get('configValidationError')) {
+ // Motivation: for server-side validation warnings and EVEN errors allow user to continue wizard
this.set('isSubmitDisabled', true);
this.set("isApplyingChanges", false);
return App.showConfirmationPopup(function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/9751b853/ambari-web/app/routes/add_host_routes.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/add_host_routes.js b/ambari-web/app/routes/add_host_routes.js
index 2f4ab47..e4ae41f 100644
--- a/ambari-web/app/routes/add_host_routes.js
+++ b/ambari-web/app/routes/add_host_routes.js
@@ -193,12 +193,14 @@ module.exports = App.WizardRoute.extend({
var wizardStep6Controller = router.get('wizardStep6Controller');
wizardStep6Controller.callValidation(function() {
- addHostController.saveSlaveComponentHosts(wizardStep6Controller);
- if(App.supports.hostOverrides){
- router.transitionTo('step4');
- }else{
- router.transitionTo('step5');
- }
+ wizardStep6Controller.showValidationIssuesAcceptBox(function() {
+ addHostController.saveSlaveComponentHosts(wizardStep6Controller);
+ if(App.supports.hostOverrides){
+ router.transitionTo('step4');
+ }else{
+ router.transitionTo('step5');
+ }
+ });
});
}
}),
http://git-wip-us.apache.org/repos/asf/ambari/blob/9751b853/ambari-web/app/routes/add_service_routes.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/add_service_routes.js b/ambari-web/app/routes/add_service_routes.js
index 06408b9..2e2cccf 100644
--- a/ambari-web/app/routes/add_service_routes.js
+++ b/ambari-web/app/routes/add_service_routes.js
@@ -169,11 +169,13 @@ module.exports = App.WizardRoute.extend({
var wizardStep6Controller = router.get('wizardStep6Controller');
wizardStep6Controller.callValidation(function() {
- addServiceController.saveSlaveComponentHosts(wizardStep6Controller);
- addServiceController.get('content').set('serviceConfigProperties', null);
- addServiceController.setDBProperty('serviceConfigProperties', null);
- addServiceController.setDBProperty('groupsToDelete', []);
- router.transitionTo('step4');
+ wizardStep6Controller.showValidationIssuesAcceptBox(function() {
+ addServiceController.saveSlaveComponentHosts(wizardStep6Controller);
+ addServiceController.get('content').set('serviceConfigProperties', null);
+ addServiceController.setDBProperty('serviceConfigProperties', null);
+ addServiceController.setDBProperty('groupsToDelete', []);
+ router.transitionTo('step4');
+ });
});
}
}),
http://git-wip-us.apache.org/repos/asf/ambari/blob/9751b853/ambari-web/app/routes/installer.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/installer.js b/ambari-web/app/routes/installer.js
index 0a5e46e..fb6f043 100644
--- a/ambari-web/app/routes/installer.js
+++ b/ambari-web/app/routes/installer.js
@@ -299,15 +299,17 @@ module.exports = Em.Route.extend({
var wizardStep7Controller = router.get('wizardStep7Controller');
if (!wizardStep6Controller.get('submitDisabled')) {
- controller.saveSlaveComponentHosts(wizardStep6Controller);
- controller.get('content').set('serviceConfigProperties', null);
- controller.setDBProperty('serviceConfigProperties', null);
- controller.setDBProperty('advancedServiceConfig', null);
- controller.setDBProperty('serviceConfigGroups', null);
- controller.setDBProperty('recommendationsHostGroups', wizardStep6Controller.get('content.recommendationsHostGroups'));
- controller.setDBProperty('recommendationsConfigs', null);
- controller.loadAdvancedConfigs(wizardStep7Controller);
- router.transitionTo('step7');
+ wizardStep6Controller.showValidationIssuesAcceptBox(function() {
+ controller.saveSlaveComponentHosts(wizardStep6Controller);
+ controller.get('content').set('serviceConfigProperties', null);
+ controller.setDBProperty('serviceConfigProperties', null);
+ controller.setDBProperty('advancedServiceConfig', null);
+ controller.setDBProperty('serviceConfigGroups', null);
+ controller.setDBProperty('recommendationsHostGroups', wizardStep6Controller.get('content.recommendationsHostGroups'));
+ controller.setDBProperty('recommendationsConfigs', null);
+ controller.loadAdvancedConfigs(wizardStep7Controller);
+ router.transitionTo('step7');
+ });
}
}
}),
http://git-wip-us.apache.org/repos/asf/ambari/blob/9751b853/ambari-web/app/templates/wizard/step5.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/wizard/step5.hbs b/ambari-web/app/templates/wizard/step5.hbs
index 7715719..d08496b 100644
--- a/ambari-web/app/templates/wizard/step5.hbs
+++ b/ambari-web/app/templates/wizard/step5.hbs
@@ -83,12 +83,12 @@
<span rel="popover" title="Warning" {{bindAttr data-content="warnMessage"}}>
{{#if warnMessage}}
- <i class="icon-warning-sign icon-large"></i>
+ <i class="icon-warning-sign"></i>
{{/if}}
</span>
<span rel="popover" title="Error" {{bindAttr data-content="errorMessage"}}>
{{#if errorMessage}}
- <i class="icon-remove-sign icon-large"></i>
+ <i class="icon-remove-sign"></i>
{{/if}}
</span>
</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/9751b853/ambari-web/app/templates/wizard/step6.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/wizard/step6.hbs b/ambari-web/app/templates/wizard/step6.hbs
index d96a519..e3e26bf 100644
--- a/ambari-web/app/templates/wizard/step6.hbs
+++ b/ambari-web/app/templates/wizard/step6.hbs
@@ -20,7 +20,7 @@
<h2>{{view.title}}</h2>
<div class="alert alert-info">{{{view.label}}}</div>
- {{#if anyErrors}}
+ {{#if anyGeneralErrors}}
<div class="alert alert-error">
<ul>
{{#if errorMessage}}
@@ -33,7 +33,7 @@
</div>
{{/if}}
- {{#if anyWarnings}}
+ {{#if anyGeneralWarnings}}
<div class="alert alert-warning">
<ul>
{{#each msg in controller.generalWarningMessages}}