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 2013/11/27 14:19:04 UTC

git commit: AMBARI-3901 Config Groups: restart components should also include clients. (atkach)

Updated Branches:
  refs/heads/trunk 1b20485fe -> 9302ddb57


AMBARI-3901 Config Groups: restart components should also include clients. (atkach)


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

Branch: refs/heads/trunk
Commit: 9302ddb57aaf29c8a6e7fe1d7fd45795ba92306b
Parents: 1b20485
Author: atkach <an...@gmail.com>
Authored: Wed Nov 27 15:19:00 2013 +0200
Committer: atkach <an...@gmail.com>
Committed: Wed Nov 27 15:19:00 2013 +0200

----------------------------------------------------------------------
 ambari-web/app/controllers/main/host/details.js | 24 +++++++++++++++-----
 ambari-web/app/templates/main/host/summary.hbs  |  4 ++--
 ambari-web/app/utils/ajax.js                    | 19 ++++++++++++++++
 3 files changed, 39 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/9302ddb5/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 06b0334..4707316 100644
--- a/ambari-web/app/controllers/main/host/details.js
+++ b/ambari-web/app/controllers/main/host/details.js
@@ -990,19 +990,31 @@ App.MainHostDetailsController = Em.Controller.extend({
       content: content,
       onPrimary: function () {
         var hostComponents = this.content.get('content.hostComponents').filterProperty('staleConfigs', true);
-        hostComponents.forEach(function(item){
-          if (item.get('isClient') && commandName === 'start_component') {
+        hostComponents.forEach(function (item) {
+          var state = 'INSTALLED',
+              componentName = item.get('componentName'),
+              context = "Stop " + App.format.role(componentName),
+              hostName = item.get('host.hostName');
+
+          if (commandName === 'start_component') {
+            context = "Start " + App.format.role(componentName);
+            state = 'STARTED';
+            if (item.get('isClient')) {
+              //start components action includes install of clients
+              context = "Install " + App.format.role(componentName);
+              state = "INSTALLED";
+            }
+          } else if (item.get('isClient')) {
             return false;
           }
-          var componentName = item.get('componentName');
-          var hostName = item.get('host.hostName');
           App.ajax.send({
-            name: 'config.stale.'+commandName,
+            name: 'host.host_component.action',
             sender: this,
             data: {
               hostName: hostName,
               componentName: componentName,
-              displayName: App.format.role(componentName)
+              context: context,
+              state: state
             }
           });
         })

http://git-wip-us.apache.org/repos/asf/ambari/blob/9302ddb5/ambari-web/app/templates/main/host/summary.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/host/summary.hbs b/ambari-web/app/templates/main/host/summary.hbs
index 29fb794..e4a1bb2 100644
--- a/ambari-web/app/templates/main/host/summary.hbs
+++ b/ambari-web/app/templates/main/host/summary.hbs
@@ -31,11 +31,11 @@
               <div class="alert alert-warning clearfix">
                 <i class="icon-refresh"></i> {{view.needToRestartMessage}}
                 <br/>
-                <button {{bindAttr class=":btn :restart-components :pull-left view.stopComponentsIsDisabled::btn-danger view.stopComponentsIsDisabled:disabled" }} {{action restartComponents view.isStopCommand target="controller"}}>
+                <button {{bindAttr class=":btn :restart-components :pull-left view.stopComponentsIsDisabled::btn-danger" disabled="view.stopComponentsIsDisabled"}} {{action restartComponents view.isStopCommand target="controller"}}>
                   {{t hosts.host.details.needToRestart.stopButton}}
                 </button>
                  <span class="restart-components  pull-left">&nbsp</span>
-                 <button {{bindAttr class=":btn :restart-components :pull-left view.startComponentsIsDisabled::btn-success view.startComponentsIsDisabled:disabled" }} {{action restartComponents target="controller"}}>
+                 <button {{bindAttr class=":btn :restart-components :pull-left view.startComponentsIsDisabled::btn-success" disabled="view.startComponentsIsDisabled"}} {{action restartComponents target="controller"}}>
                   {{t hosts.host.details.needToRestart.startButton}}
                  </button>
               </div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/9302ddb5/ambari-web/app/utils/ajax.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/ajax.js b/ambari-web/app/utils/ajax.js
index 13fde23..a0def3f 100644
--- a/ambari-web/app/utils/ajax.js
+++ b/ambari-web/app/utils/ajax.js
@@ -260,6 +260,25 @@ var urls = {
       };
     }
   },
+  'host.host_component.action': {
+    'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}',
+    'mock': '',
+    'type': 'PUT',
+    'format': function (data) {
+      return {
+        data: JSON.stringify({
+          RequestInfo: {
+            "context": data.context
+          },
+          Body: {
+            "HostRoles": {
+              "state": data.state
+            }
+          }
+        })
+      }
+    }
+  },
   'config.stale.stop_component': {
     'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}',
     'mock': '',