You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by on...@apache.org on 2015/03/10 15:09:22 UTC
ambari git commit: AMBARI-9996. Install wizard: nothing to do on
'Assign Slaves and Clients' step if only Knox is selected to install
(onechiporenko)
Repository: ambari
Updated Branches:
refs/heads/trunk 6e949c8c3 -> 70e3e1f34
AMBARI-9996. Install wizard: nothing to do on 'Assign Slaves and Clients' step if only Knox is selected to install (onechiporenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/70e3e1f3
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/70e3e1f3
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/70e3e1f3
Branch: refs/heads/trunk
Commit: 70e3e1f344a897bf0e2c48643006ddbcfd47719e
Parents: 6e949c8
Author: Oleg Nechiporenko <on...@apache.org>
Authored: Tue Mar 10 14:13:27 2015 +0200
Committer: Oleg Nechiporenko <on...@apache.org>
Committed: Tue Mar 10 16:08:53 2015 +0200
----------------------------------------------------------------------
ambari-web/app/controllers/installer.js | 1 +
.../controllers/main/service/add_controller.js | 24 ++-----
ambari-web/app/controllers/wizard.js | 16 +++++
.../app/controllers/wizard/step6_controller.js | 4 +-
ambari-web/app/routes/installer.js | 5 +-
ambari-web/test/controllers/wizard_test.js | 70 ++++++++++++++++++++
6 files changed, 100 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/70e3e1f3/ambari-web/app/controllers/installer.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/installer.js b/ambari-web/app/controllers/installer.js
index 953a647..d723134 100644
--- a/ambari-web/app/controllers/installer.js
+++ b/ambari-web/app/controllers/installer.js
@@ -637,6 +637,7 @@ App.InstallerController = App.WizardController.extend({
{
type: 'sync',
callback: function () {
+ this.setSkipSlavesStep(App.StackService.find().filterProperty('isSelected'), 6);
this.loadMasterComponentHosts();
this.loadConfirmedHosts();
this.loadRecommendations();
http://git-wip-us.apache.org/repos/asf/ambari/blob/70e3e1f3/ambari-web/app/controllers/main/service/add_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/add_controller.js b/ambari-web/app/controllers/main/service/add_controller.js
index c1682a9..97c6031 100644
--- a/ambari-web/app/controllers/main/service/add_controller.js
+++ b/ambari-web/app/controllers/main/service/add_controller.js
@@ -219,13 +219,7 @@ App.AddServiceController = App.WizardController.extend(App.AddSecurityConfigs, {
item.set('isSelected', isSelected || (this.get("currentStep") == "1" ? isInstalled : isSelected));
item.set('isInstalled', isInstalled);
}, this);
- var isServiceWithSlave = App.StackService.find().filterProperty('isSelected').filterProperty('hasSlave').filterProperty('isInstalled', false).length;
- var isServiceWithClient = App.StackService.find().filterProperty('isSelected').filterProperty('hasClient').filterProperty('isInstalled', false).length;
- var isServiceWithCustomAssignedNonMasters = App.StackService.find().filterProperty('isSelected').filterProperty('hasNonMastersWithCustomAssignment').filterProperty('isInstalled', false).length;
- this.set('content.skipSlavesStep', !isServiceWithSlave && !isServiceWithClient || !isServiceWithCustomAssignedNonMasters);
- if (this.get('content.skipSlavesStep')) {
- this.get('isStepDisabled').findProperty('step', 3).set('value', this.get('content.skipSlavesStep'));
- }
+ this.setSkipSlavesStep(App.StackService.find().filterProperty('isSelected').filterProperty('isInstalled', false), 3);
}
this.set('serviceToInstall', null);
this.set('content.services', App.StackService.find());
@@ -240,8 +234,9 @@ App.AddServiceController = App.WizardController.extend(App.AddSecurityConfigs, {
selectedServices: [],
installedServices: []
};
- var selectedServices = stepController.get('content').filterProperty('isSelected', true).filterProperty('isInstalled', false).mapProperty('serviceName');
- services.selectedServices.pushObjects(selectedServices);
+ var selectedServices = stepController.get('content').filterProperty('isSelected', true).filterProperty('isInstalled', false);
+ var selectedServiceNames = selectedServices.mapProperty('serviceName');
+ services.selectedServices.pushObjects(selectedServiceNames);
services.installedServices.pushObjects(stepController.get('content').filterProperty('isInstalled', true).mapProperty('serviceName'));
// save services that already installed but ignored on choose services page
// these services marked by `isInstallable` flag with value `false`, for example `Kerberos` service
@@ -251,14 +246,9 @@ App.AddServiceController = App.WizardController.extend(App.AddSecurityConfigs, {
this.setDBProperty('services', services);
console.log('AddServiceController.saveServices: saved data', stepController.get('content'));
- this.set('content.selectedServiceNames', selectedServices);
- this.setDBProperty('selectedServiceNames', selectedServices);
- var isServiceWithSlave = stepController.get('content').filterProperty('isSelected').filterProperty('hasSlave').filterProperty('isInstalled', false).mapProperty('serviceName').length;
- var isServiceWithClient = App.StackService.find().filterProperty('isSelected').filterProperty('hasClient').filterProperty('isInstalled', false).mapProperty('serviceName').length;
- this.set('content.skipSlavesStep', !isServiceWithSlave && !isServiceWithClient);
- if (this.get('content.skipSlavesStep')) {
- this.get('isStepDisabled').findProperty('step', 3).set('value', this.get('content.skipSlavesStep'));
- }
+ this.set('content.selectedServiceNames', selectedServiceNames);
+ this.setDBProperty('selectedServiceNames', selectedServiceNames);
+ this.setSkipSlavesStep(selectedServices, 3);
},
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/70e3e1f3/ambari-web/app/controllers/wizard.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard.js b/ambari-web/app/controllers/wizard.js
index 6abe0a5..bebf1d6 100644
--- a/ambari-web/app/controllers/wizard.js
+++ b/ambari-web/app/controllers/wizard.js
@@ -1132,5 +1132,21 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, {
if (hosts) {
this.set('content.hosts', hosts);
}
+ },
+
+ /**
+ * Determine if <code>Assign Slaves and Clients</code> step should be skipped
+ * @method setSkipSlavesStep
+ * @param services
+ * @param step
+ */
+ setSkipSlavesStep: function (services, step) {
+ var hasServicesWithSlave = services.someProperty('hasSlave');
+ var hasServicesWithClient = services.someProperty('hasClient');
+ var hasServicesWithCustomAssignedNonMasters = services.someProperty('hasNonMastersWithCustomAssignment');
+ this.set('content.skipSlavesStep', !hasServicesWithSlave && !hasServicesWithClient || !hasServicesWithCustomAssignedNonMasters);
+ if (this.get('content.skipSlavesStep')) {
+ this.get('isStepDisabled').findProperty('step', step).set('value', this.get('content.skipSlavesStep'));
+ }
}
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/70e3e1f3/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 f4ef6c4..6d77f89 100644
--- a/ambari-web/app/controllers/wizard/step6_controller.js
+++ b/ambari-web/app/controllers/wizard/step6_controller.js
@@ -136,14 +136,14 @@ App.WizardStep6Controller = Em.Controller.extend(App.BlueprintMixin, {
* 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; });
+ 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; });
+ return this.get('anyGeneralWarnings') || this.get('hosts').some(function(h) { return h.get('warnMessages.length') > 0; });
}.property('anyGeneralWarnings', 'hosts.@each.warnMessages'),
openSlavesAndClientsIssues: function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/70e3e1f3/ambari-web/app/routes/installer.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/installer.js b/ambari-web/app/routes/installer.js
index 7c24e38..a88ae29 100644
--- a/ambari-web/app/routes/installer.js
+++ b/ambari-web/app/routes/installer.js
@@ -305,7 +305,10 @@ module.exports = Em.Route.extend(App.RouterRedirections, {
controller.connectOutlet('wizardStep7', controller.get('content'));
});
},
- back: Em.Router.transitionTo('step6'),
+ back: function (router) {
+ var step = router.get('installerController.content.skipSlavesStep') ? 'step5' : 'step6';
+ router.transitionTo(step);
+ },
next: function (router) {
var controller = router.get('installerController');
var wizardStep7Controller = router.get('wizardStep7Controller');
http://git-wip-us.apache.org/repos/asf/ambari/blob/70e3e1f3/ambari-web/test/controllers/wizard_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard_test.js b/ambari-web/test/controllers/wizard_test.js
index 26e38b4..79bfc5a 100644
--- a/ambari-web/test/controllers/wizard_test.js
+++ b/ambari-web/test/controllers/wizard_test.js
@@ -238,4 +238,74 @@ describe('App.WizardController', function () {
});
});
+
+ describe('#setSkipSlavesStep', function () {
+
+ var step = 6,
+ cases = [
+ {
+ services: [
+ {
+ hasSlave: true,
+ hasNonMastersWithCustomAssignment: true
+ }
+ ],
+ skipSlavesStep: false,
+ title: 'service with customizable slave selected'
+ },
+ {
+ services: [
+ {
+ hasClient: true,
+ hasNonMastersWithCustomAssignment: true
+ }
+ ],
+ skipSlavesStep: false,
+ title: 'service with customizable client selected'
+ },
+ {
+ services: [
+ {
+ hasSlave: true,
+ hasNonMastersWithCustomAssignment: false
+ },
+ {
+ hasClient: true,
+ hasNonMastersWithCustomAssignment: false
+ }
+ ],
+ skipSlavesStep: true,
+ title: 'no service with customizable slaves or clients selected'
+ },
+ {
+ services: [
+ {
+ hasSlave: false,
+ hasClient: false
+ }
+ ],
+ skipSlavesStep: true,
+ title: 'no service with slaves or clients selected'
+ }
+ ];
+
+ beforeEach(function () {
+ c.reopen({
+ isStepDisabled: [
+ Em.Object.create({
+ step: 6
+ })
+ ],
+ content: {}
+ });
+ });
+
+ cases.forEach(function (item) {
+ it(item.title, function () {
+ c.setSkipSlavesStep(item.services, step);
+ expect(Boolean(c.get('isStepDisabled').findProperty('step', step).get('value'))).to.equal(item.skipSlavesStep);
+ });
+ });
+
+ });
});