You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ab...@apache.org on 2014/02/05 14:41:00 UTC

git commit: AMBARI-4532 Turning on/off OOS mode for a service or a host involves a long delay. (ababiichuk)

Updated Branches:
  refs/heads/trunk 5bf15d0ab -> 8e1817415


AMBARI-4532 Turning on/off OOS mode for a service or a host involves a long delay. (ababiichuk)


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

Branch: refs/heads/trunk
Commit: 8e181741590d75ab371ce9fec9067bca2942623f
Parents: 5bf15d0
Author: aBabiichuk <ab...@cybervisiontech.com>
Authored: Wed Feb 5 15:38:27 2014 +0200
Committer: aBabiichuk <ab...@cybervisiontech.com>
Committed: Wed Feb 5 15:38:27 2014 +0200

----------------------------------------------------------------------
 ambari-web/app/controllers/main/host.js         | 18 ++++++++++----
 ambari-web/app/controllers/main/host/details.js | 25 ++++++++++++++------
 ambari-web/app/controllers/main/service/item.js | 10 +++++++-
 ambari-web/app/templates/main/host.hbs          |  4 +---
 4 files changed, 42 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/8e181741/ambari-web/app/controllers/main/host.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/host.js b/ambari-web/app/controllers/main/host.js
index fba9dac..20d97a9 100644
--- a/ambari-web/app/controllers/main/host.js
+++ b/ambari-web/app/controllers/main/host.js
@@ -243,7 +243,7 @@ App.MainHostController = Em.ArrayController.extend({
     var affectedHosts = [];
     hosts.forEach(function(host) {
       if (host.get('passiveState') !== operationData.state) {
-        affectedHosts.push(host.get('hostName'));
+        affectedHosts.push(host);
       }
     });
     if (affectedHosts.length) {
@@ -251,10 +251,12 @@ App.MainHostController = Em.ArrayController.extend({
         name: 'bulk_request.hosts.passive_state',
         sender: this,
         data: {
-          hostNames: affectedHosts.join(','),
+          hosts: affectedHosts,
+          hostNames: affectedHosts.mapProperty('hostName').join(','),
           passive_state: operationData.state,
           requestInfo: operationData.message
-        }
+        },
+        success: 'updateHostPassiveState'
       });
     }
     else {
@@ -266,6 +268,10 @@ App.MainHostController = Em.ArrayController.extend({
     }
   },
 
+  updateHostPassiveState: function(data, opt, params) {
+    params.hosts.setEach('passiveState', params.passive_state);
+    App.router.get('clusterController').loadUpdatedStatus(function(){});
+  },
   /**
    * Bulk operation for selected hostComponents
    * @param {Object} operationData - data about bulk operation (action, hostComponents etc)
@@ -421,7 +427,8 @@ App.MainHostController = Em.ArrayController.extend({
           query: 'HostRoles/component_name=' + operationData.componentName + '&HostRoles/host_name.in(' + affectedHosts.join(',') + ')',
           passive_state: operationData.state,
           requestInfo: operationData.message
-        }
+        },
+        success: 'updateHostComponentsPassiveState'
       });
     }
     else {
@@ -433,6 +440,9 @@ App.MainHostController = Em.ArrayController.extend({
     }
   },
 
+  updateHostComponentsPassiveState: function() {
+    App.router.get('clusterController').loadUpdatedStatus(function(){});
+  },
   /**
    * Show BO popup after bulk request
    */

http://git-wip-us.apache.org/repos/asf/ambari/blob/8e181741/ambari-web/app/controllers/main/host/details.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/host/details.js b/ambari-web/app/controllers/main/host/details.js
index 10ba0cc..f11f8b0 100644
--- a/ambari-web/app/controllers/main/host/details.js
+++ b/ambari-web/app/controllers/main/host/details.js
@@ -981,10 +981,16 @@ App.MainHostDetailsController = Em.Controller.extend({
         hostNames: this.get('content.hostName'),
         passive_state: state,
         requestInfo: message
-      }
+      },
+      success: 'updateHost'
     });
   },
 
+  updateHost: function(data, opt, params) {
+    this.set('content.passiveState', params.passive_state);
+    App.router.get('clusterController').loadUpdatedStatus(function(){});
+  },
+
   doStartAllComponents: function() {
     var self = this;
     var components = this.get('content.hostComponents');
@@ -1212,7 +1218,6 @@ App.MainHostDetailsController = Em.Controller.extend({
   turnOnOffPassiveConfirmation: function(event){
     var self = this;
     var component = event.context;
-    var componentName = component.get('componentName').toUpperCase();
     var state, onOff;
     if (component.get("passiveState") == "PASSIVE") {
       onOff = "Off";
@@ -1222,23 +1227,29 @@ App.MainHostDetailsController = Em.Controller.extend({
       state = "PASSIVE";
     }
     App.showConfirmationPopup(function() {
-          self.turnOnOffPassive(state, componentName)
+          self.turnOnOffPassive(state, component)
         },
         Em.I18n.t('hosts.passiveMode.popup').format(onOff,component.get('displayName'))
     );
   },
 
-  turnOnOffPassive: function(state,componentName) {
+  turnOnOffPassive: function(state,component) {
     var hostName = this.get('content.hostName');
     App.ajax.send({
       name: 'host_component.passive',
       sender: this,
       data: {
+        component: component,
         hostName: hostName,
-        componentName: componentName,
+        componentName: component.get('componentName'),
         passive_state: state,
-        requestInfo: componentName + " " + state
-      }
+        requestInfo: component.get('componentName') + " " + state
+      },
+      success: 'updateComponentPassiveState'
     });
+  },
+
+  updateComponentPassiveState: function(data, opt, params) {
+    params.component.set('passiveState',params.passive_state);
   }
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/8e181741/ambari-web/app/controllers/main/service/item.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/item.js b/ambari-web/app/controllers/main/service/item.js
index 95085f4..6ca3b4b 100644
--- a/ambari-web/app/controllers/main/service/item.js
+++ b/ambari-web/app/controllers/main/service/item.js
@@ -216,7 +216,15 @@ App.MainServiceItemController = Em.Controller.extend({
         'requestInfo': message,
         'serviceName': this.get('content.serviceName').toUpperCase(),
         'passive_state': state
-      }
+      },
+      'success':'updateService'
+    });
+  },
+
+  updateService: function(data, opt, params) {
+    var self = this;
+    App.router.get('clusterController').loadUpdatedStatus(function(){
+      self.set('content.passiveState', params.passive_state);
     });
   },
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/8e181741/ambari-web/app/templates/main/host.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/host.hbs b/ambari-web/app/templates/main/host.hbs
index f90f93e..848c710 100644
--- a/ambari-web/app/templates/main/host.hbs
+++ b/ambari-web/app/templates/main/host.hbs
@@ -109,9 +109,7 @@
             {{/if}}
           </td>
           <td class="passive-state">
-            {{#if host.componentsInPassiveStateCount}}
-              <span class="icon-medkit" rel="ComponentsTooltip" {{bindAttr title="view.componentsInPassiveStateMessage"}}></span>
-            {{/if}}
+              <span rel="ComponentsTooltip" {{bindAttr data-original-title="view.componentsInPassiveStateMessage" class="host.componentsInPassiveStateCount:icon-medkit"}}></span>
           </td>
           <td>{{host.ip}}</td>
           <td>{{host.coresFormatted}}</td>