Updated Branches:
  refs/heads/trunk 050506eb9 -> 82bb2103d

AMBARI-3923.Stale configs on Clients don't affect on Start/Stop Components 
buttons. (akovalenko)


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

Branch: refs/heads/trunk
Commit: 82bb2103dba710c18f326ee8a3e3d9d182e81740
Parents: 050506e
Author: Aleksandr Kovalenko <[email protected]>
Authored: Thu Nov 28 21:33:19 2013 +0200
Committer: Aleksandr Kovalenko <[email protected]>
Committed: Thu Nov 28 21:50:44 2013 +0200

----------------------------------------------------------------------
 .../controllers/main/service/info/configs.js    | 33 ++++++++++++-----
 ambari-web/app/utils/ajax.js                    | 38 --------------------
 ambari-web/app/views/main/host/summary.js       |  8 ++---
 .../app/views/main/service/info/configs.js      |  4 +--
 4 files changed, 30 insertions(+), 53 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/82bb2103/ambari-web/app/controllers/main/service/info/configs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/info/configs.js 
b/ambari-web/app/controllers/main/service/info/configs.js
index c4289c9..8e7403b 100644
--- a/ambari-web/app/controllers/main/service/info/configs.js
+++ b/ambari-web/app/controllers/main/service/info/configs.js
@@ -1744,13 +1744,13 @@ App.MainServiceInfoConfigsController = 
Em.Controller.extend({
 
   restartComponents: function(e) {
     var commandName = "stop_component";
-    if(e.context) {
-      if(this.get('content.healthStatus') != 'green'){
+    if (e.context) {
+      if 
(!this.get('content.hostComponents').filterProperty('staleConfigs').findProperty('workStatus',
 'STARTED')) {
         return;
       }
-    }else {
+    } else {
       commandName = "start_component";
-      if(this.get('content.healthStatus') != 'red'){
+      if 
(!this.get('content.hostComponents').filterProperty('staleConfigs').findProperty('workStatus',
 'INSTALLED')) {
         return;
       }
     };
@@ -1764,16 +1764,31 @@ App.MainServiceInfoConfigsController = 
Em.Controller.extend({
       onPrimary: function () {
         var selectedService = this.content.get('content.id');
         var hostComponents = 
App.HostComponent.find().filterProperty('service.id', 
selectedService).filterProperty('staleConfigs', true)
-        hostComponents.forEach(function(item){
-          var componentName = item.get('componentName');
-          var hostName = item.get('host.hostName');
+        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;
+          }
           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/82bb2103/ambari-web/app/utils/ajax.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/ajax.js b/ambari-web/app/utils/ajax.js
index 1175844..d2f2a41 100644
--- a/ambari-web/app/utils/ajax.js
+++ b/ambari-web/app/utils/ajax.js
@@ -289,44 +289,6 @@ var urls = {
       }
     }
   },
-  'config.stale.stop_component': {
-    'real': 
'/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}',
-    'mock': '',
-    'type': 'PUT',
-    'format': function (data) {
-      return {
-        data: JSON.stringify({
-          RequestInfo: {
-            "context": "Stop " + data.displayName
-          },
-          Body: {
-            "HostRoles": {
-              "state": "INSTALLED"
-            }
-          }
-        })
-      }
-    }
-  },
-  'config.stale.start_component': {
-    'real': 
'/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}',
-    'mock': '',
-    'type': 'PUT',
-    'format': function (data) {
-      return {
-        data: JSON.stringify({
-          RequestInfo: {
-            "context": "Start " + data.displayName
-          },
-          Body: {
-            "HostRoles": {
-              "state": "STARTED"
-            }
-          }
-        })
-      }
-    }
-  },
   'service.metrics.flume.channel_fill_percent': {
     'real': 
'/clusters/{clusterName}/services/FLUME/components/FLUME_SERVER?fields=host_components/metrics/flume/flume/CHANNEL/*/ChannelFillPercentage[{fromSeconds},{toSeconds},{stepSeconds}]',
     'mock': '/data/services/metrics/flume/channelFillPct.json',

http://git-wip-us.apache.org/repos/asf/ambari/blob/82bb2103/ambari-web/app/views/main/host/summary.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/host/summary.js 
b/ambari-web/app/views/main/host/summary.js
index da5d8b1..c416e88 100644
--- a/ambari-web/app/views/main/host/summary.js
+++ b/ambari-web/app/views/main/host/summary.js
@@ -39,22 +39,22 @@ App.MainHostSummaryView = Em.View.extend({
   }.property('[email protected]'),
 
   stopComponentsIsDisabled: function () {
-    var staleComponents = 
this.get('sortedComponents').filterProperty('staleConfigs', true);
+    var staleComponents = 
this.get('content.hostComponents').filterProperty('staleConfigs', true);
     if(!staleComponents.findProperty('workStatus','STARTED')){
       return true;
     } else {
       return false;
     }
-  }.property('[email protected]'),
+  }.property('[email protected]', 
'[email protected]'),
 
   startComponentsIsDisabled:function () {
-    var staleComponents = 
this.get('sortedComponents').filterProperty('staleConfigs', true);
+    var staleComponents = 
this.get('content.hostComponents').filterProperty('staleConfigs', true);
     if(!staleComponents.findProperty('workStatus','INSTALLED')){
       return true;
     } else {
       return false;
     }
-  }.property('[email protected]'),
+  }.property('[email protected]', 
'[email protected]'),
 
   needToRestartMessage: function() {
     var componentsCount, word;

http://git-wip-us.apache.org/repos/asf/ambari/blob/82bb2103/ambari-web/app/views/main/service/info/configs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/info/configs.js 
b/ambari-web/app/views/main/service/info/configs.js
index 28c8f6d..02d2fe8 100644
--- a/ambari-web/app/views/main/service/info/configs.js
+++ b/ambari-web/app/views/main/service/info/configs.js
@@ -31,7 +31,7 @@ App.MainServiceInfoConfigsView = Em.View.extend({
 
 
   stopComponentsIsDisabled: function () {
-    var staleComponents = 
this.get('controller.content.hostComponents').filterProperty('staleConfigs', 
true).filterProperty('isClient', false);
+    var staleComponents = 
this.get('controller.content.hostComponents').filterProperty('staleConfigs', 
true);
     if (!staleComponents.findProperty('workStatus', 'STARTED')) {
       return true;
     } else {
@@ -40,7 +40,7 @@ App.MainServiceInfoConfigsView = Em.View.extend({
   }.property('[email protected]', 
'[email protected]'),
 
   startComponentsIsDisabled: function () {
-    var staleComponents = 
this.get('controller.content.hostComponents').filterProperty('staleConfigs', 
true).filterProperty('isClient', false);
+    var staleComponents = 
this.get('controller.content.hostComponents').filterProperty('staleConfigs', 
true);
     if (!staleComponents.findProperty('workStatus', 'INSTALLED')) {
       return true;
     } else {

Reply via email to