You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by at...@apache.org on 2014/07/07 20:25:24 UTC
git commit: AMBARI-6406 Move Wizard: assign master step next button
is not disabled, when host input has error. (atkach)
Repository: ambari
Updated Branches:
refs/heads/branch-1.6.1 c69eb85a0 -> cce967d79
AMBARI-6406 Move Wizard: assign master step next button is not disabled, when host input has error. (atkach)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/cce967d7
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/cce967d7
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/cce967d7
Branch: refs/heads/branch-1.6.1
Commit: cce967d79866f4a4e9af862bb455f4fd07b75461
Parents: c69eb85
Author: atkach <at...@hortonworks.com>
Authored: Mon Jul 7 21:23:16 2014 +0300
Committer: atkach <at...@hortonworks.com>
Committed: Mon Jul 7 21:23:16 2014 +0300
----------------------------------------------------------------------
.../main/service/reassign/step2_controller.js | 26 +++++++++++++++
.../app/controllers/wizard/step5_controller.js | 35 ++------------------
2 files changed, 29 insertions(+), 32 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/cce967d7/ambari-web/app/controllers/main/service/reassign/step2_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/reassign/step2_controller.js b/ambari-web/app/controllers/main/service/reassign/step2_controller.js
index 35e205c..8964c1b 100644
--- a/ambari-web/app/controllers/main/service/reassign/step2_controller.js
+++ b/ambari-web/app/controllers/main/service/reassign/step2_controller.js
@@ -82,6 +82,32 @@ App.ReassignMasterWizardStep2Controller = App.WizardStep5Controller.extend({
}
item.set("availableHosts", preparedAvailableHosts.sortProperty('host_name'));
}, this);
+ },
+ /**
+ * Determines if hostName is valid for component:
+ * <ul>
+ * <li>host should have only one component with <code>componentName</code></li>
+ * </ul>
+ * @param {string} componentName
+ * @param {string} selectedHost
+ * @returns {boolean} true - valid, false - invalid
+ * @method isHostNameValid
+ */
+ isHostNameValid: function (componentName, selectedHost) {
+ var isValid = this._super(componentName, selectedHost);
+
+ if (isValid) {
+ var reassigned = 0;
+ var existedComponents = App.HostComponent.find().filterProperty('componentName', this.get('content.reassign.component_name')).mapProperty('hostName');
+ var newComponents = this.get('servicesMasters').mapProperty('selectedHost');
+ existedComponents.forEach(function (host) {
+ if (!newComponents.contains(host)) {
+ reassigned++;
+ }
+ }, this);
+ isValid = !(reassigned !== 1);
+ }
+ return isValid;
}
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/cce967d7/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 6bcc467..f004cb0 100644
--- a/ambari-web/app/controllers/wizard/step5_controller.js
+++ b/ambari-web/app/controllers/wizard/step5_controller.js
@@ -185,41 +185,12 @@ App.WizardStep5Controller = Em.Controller.extend({
* @metohd getIsSubmitDisabled
*/
getIsSubmitDisabled: function () {
- if (!this.get('isReassignWizard')) {
- this.set('submitDisabled', this.get('servicesMasters').someProperty('isHostNameValid', false));
- }
- else {
- App.ajax.send({
- name: 'host_components.all',
- sender: this,
- data: {
- clusterName: App.get('clusterName')
- },
- success: 'getIsSubmitDisabledSuccessCallBack'
- });
- }
+ var isSubmitDisabled = this.get('servicesMasters').someProperty('isHostNameValid', false);
+ this.set('submitDisabled', isSubmitDisabled);
+ return isSubmitDisabled;
}.observes('servicesMasters.@each.selectedHost', 'servicesMasters.@each.isHostNameValid'),
/**
- * Success callback for getIsSubmitDisabled method
- * Set true for Reassign Master Wizard and if more than one master component was reassigned.
- * For installer, addHost and addService verify that provided host names for components are valid
- * @param {object} response
- * @method getIsSubmitDisabledSuccessCallBack
- */
- getIsSubmitDisabledSuccessCallBack: function (response) {
- var reassigned = 0;
- var arr1 = response.items.mapProperty('HostRoles').filterProperty('component_name', this.get('content.reassign.component_name')).mapProperty('host_name');
- var arr2 = this.get('servicesMasters').mapProperty('selectedHost');
- arr1.forEach(function (host) {
- if (!arr2.contains(host)) {
- reassigned++;
- }
- }, this);
- this.set('submitDisabled', reassigned !== 1);
- },
-
- /**
* Clear controller data (hosts, masters etc)
* @method clearStep
*/