ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jonathanhur...@apache.org
Subject [1/5] git commit: AMBARI-6883. Add service wizard does not select 1 client host by default when all hosts has master components. (jaimin)
Date Mon, 18 Aug 2014 13:47:56 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-alerts-dev 157df3883 -> 26b162af8


AMBARI-6883. Add service wizard does not select 1 client host by default when all hosts has
master components. (jaimin)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/00a45acb
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/00a45acb
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/00a45acb

Branch: refs/heads/branch-alerts-dev
Commit: 00a45acb38aca0d5a9529cd366d5e33ad987bcf0
Parents: 157df38
Author: Jaimin Jetly <jaimin@hortonworks.com>
Authored: Fri Aug 15 14:42:02 2014 -0700
Committer: Jonathan Hurley <jhurley@hortonworks.com>
Committed: Mon Aug 18 09:47:44 2014 -0400

----------------------------------------------------------------------
 .../app/controllers/wizard/step6_controller.js  | 53 +++++++++++---------
 1 file changed, 29 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/00a45acb/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 ce4e496..a3e97ce 100644
--- a/ambari-web/app/controllers/wizard/step6_controller.js
+++ b/ambari-web/app/controllers/wizard/step6_controller.js
@@ -252,7 +252,7 @@ App.WizardStep6Controller = Em.Controller.extend({
             allChecked: false,
             isRequired: serviceComponent.get('isRequired'),
             noChecked: true,
-            isDisabled: installedServices.someProperty('serviceName',stackService.get('serviceName'))
&& this.get('isAddServiceWizard')
+            isDisabled: installedServices.someProperty('serviceName', stackService.get('serviceName'))
&& this.get('isAddServiceWizard')
           }));
         }
       }, this);
@@ -425,13 +425,12 @@ App.WizardStep6Controller = Em.Controller.extend({
    * @param hostsObj
    */
   selectClientHost: function (hostsObj) {
-     var nonMasterHost = hostsObj.findProperty('hasMaster',false);
-     if (nonMasterHost) {
-       var clientCheckBox = nonMasterHost.get('checkboxes').findProperty('name','CLIENT');
-       if (clientCheckBox) {
-         clientCheckBox.set('checked',true);
-       }
-     }
+    var nonMasterHost = hostsObj.findProperty('hasMaster', false);
+    var clientHost = !!nonMasterHost ? nonMasterHost : hostsObj[hostsObj.length - 1]; //
last host
+    var clientCheckBox = clientHost.get('checkboxes').findProperty('component', 'CLIENT');
+    if (clientCheckBox) {
+      clientCheckBox.set('checked', true);
+    }
   },
 
   /**
@@ -469,7 +468,7 @@ App.WizardStep6Controller = Em.Controller.extend({
     return this.get('content.masterComponentHosts').filterProperty('hostName', hostName).mapProperty('component');
   },
 
-  callValidation: function(successCallback) {
+  callValidation: function (successCallback) {
     var self = this;
     if (App.supports.serverRecommendValidate) {
       self.callServerSideValidation(successCallback);
@@ -510,7 +509,7 @@ App.WizardStep6Controller = Em.Controller.extend({
       }
 
       var selectedClientComponents = self.get('content.clients').mapProperty('component_name');
-      var alreadyInstalledClients = App.get('components.clients').reject(function(c) {
+      var alreadyInstalledClients = App.get('components.clients').reject(function (c) {
         return selectedClientComponents.contains(c);
       });
 
@@ -540,7 +539,7 @@ App.WizardStep6Controller = Em.Controller.extend({
         times: App.maxRetries,
         timeout: App.timeout
       }).
-      then(function() {
+      then(function () {
         if (!self.get('submitDisabled') && successCallback) {
           successCallback();
         }
@@ -567,7 +566,7 @@ App.WizardStep6Controller = Em.Controller.extend({
     this.get('hosts').setEach('warnMessages', []);
     this.get('hosts').setEach('errorMessages', []);
     this.get('hosts').setEach('anyMessage', false);
-    this.get('hosts').forEach(function(host) {
+    this.get('hosts').forEach(function (host) {
       host.checkboxes.setEach('hasWarnMessage', false);
       host.checkboxes.setEach('hasErrorMessage', false);
     });
@@ -575,11 +574,11 @@ App.WizardStep6Controller = Em.Controller.extend({
     var anyGeneralClientErrors = false; // any error/warning for any client component (under
"CLIENT" alias)
 
     var validationData = validationUtils.filterNotInstalledComponents(data);
-    validationData.filterProperty('type', 'host-component').forEach(function(item) {
+    validationData.filterProperty('type', 'host-component').forEach(function (item) {
       var checkboxWithIssue = null;
       var isGeneralClientValidationItem = clientComponents.contains(item['component-name']);
// it is an error/warning for any client component (under "CLIENT" alias)
-      var host = self.get('hosts').find(function(h) {
-        return h.hostName === item.host && h.checkboxes.some(function(checkbox) {
+      var host = self.get('hosts').find(function (h) {
+        return h.hostName === item.host && h.checkboxes.some(function (checkbox)
{
           var isClientComponent = checkbox.component === "CLIENT" && isGeneralClientValidationItem;
           if (checkbox.component === item['component-name'] || isClientComponent) {
             checkboxWithIssue = checkbox;
@@ -636,7 +635,7 @@ App.WizardStep6Controller = Em.Controller.extend({
   /**
    * Composes selected values of comboboxes into blueprint format
    */
-  getCurrentBlueprint: function() {
+  getCurrentBlueprint: function () {
     var self = this;
 
     var res = {
@@ -648,15 +647,15 @@ App.WizardStep6Controller = Em.Controller.extend({
     var mapping = self.get('hosts');
 
     var i = 0;
-    mapping.forEach(function(item) {
+    mapping.forEach(function (item) {
       i += 1;
       var group_name = 'host-group-' + i;
 
       var host_group = {
         name: group_name,
-        components: item.checkboxes.filterProperty('checked', true).map(function(checkbox)
{
+        components: item.checkboxes.filterProperty('checked', true).map(function (checkbox)
{
           if (checkbox.component === "CLIENT") {
-            return clientComponents.map(function(client) {
+            return clientComponents.map(function (client) {
               return { name: client };
             });
           } else {
@@ -669,7 +668,9 @@ App.WizardStep6Controller = Em.Controller.extend({
 
       var binding = {
         name: group_name,
-        hosts: [ { fqdn: item.hostName } ]
+        hosts: [
+          { fqdn: item.hostName }
+        ]
       }
 
       res.blueprint.host_groups.push(host_group);
@@ -679,7 +680,7 @@ App.WizardStep6Controller = Em.Controller.extend({
     return res;
   },
 
-  getMasterSlaveBlueprintForAddHostWizard: function() {
+  getMasterSlaveBlueprintForAddHostWizard: function () {
     var components = App.HostComponent.find();
     var hosts = components.mapProperty("hostName").uniq();
 
@@ -689,18 +690,22 @@ App.WizardStep6Controller = Em.Controller.extend({
     };
 
     var i = 0;
-    hosts.forEach(function(host) {
+    hosts.forEach(function (host) {
       i += 1;
       var group_name = 'host-group-' + i;
 
       res.blueprint.host_groups.push({
         name: group_name,
-        components: components.filterProperty("hostName", host).mapProperty("componentName").map(function(c)
{ return { name: c }; })
+        components: components.filterProperty("hostName", host).mapProperty("componentName").map(function
(c) {
+          return { name: c };
+        })
       });
 
       res.blueprint_cluster_binding.host_groups.push({
         name: group_name,
-        hosts: [ { fqdn: host } ]
+        hosts: [
+          { fqdn: host }
+        ]
       });
     });
     return res;


Mime
View raw message