瀏覽代碼

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

atkach 11 年之前
父節點
當前提交
9302ddb57a

+ 18 - 6
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
             }
           });
         })

+ 2 - 2
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>

+ 19 - 0
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': '',