Author: yusaku
Date: Fri Jan 11 02:46:24 2013
New Revision: 1431832

URL: http://svn.apache.org/viewvc?rev=1431832&view=rev
Log:
AMBARI-1132. Stopping service doesn't cause blinking status until refresh. 
(Srimanth Gunturi via yusaku)

Modified:
    incubator/ambari/trunk/CHANGES.txt
    incubator/ambari/trunk/ambari-web/app/mappers/service_mapper.js
    incubator/ambari/trunk/ambari-web/app/mappers/status_mapper.js
    incubator/ambari/trunk/ambari-web/app/models/component.js
    incubator/ambari/trunk/ambari-web/app/models/host_component.js
    incubator/ambari/trunk/ambari-web/app/models/service.js

Modified: incubator/ambari/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1431832&r1=1431831&r2=1431832&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Fri Jan 11 02:46:24 2013
@@ -675,6 +675,9 @@ AMBARI-666 branch (unreleased changes)
 
   BUG FIXES
 
+  AMBARI-1132. Stopping service doesn't cause blinking status until refresh.
+  (Srimanth Gunturi via yusaku)
+
   AMBARI-1143. tmpfs filesystem being added to the list in the dir used by
   Ambari. (Arun Kandregula via yusaku) 
 

Modified: incubator/ambari/trunk/ambari-web/app/mappers/service_mapper.js
URL: 
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/mappers/service_mapper.js?rev=1431832&r1=1431831&r2=1431832&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/mappers/service_mapper.js (original)
+++ incubator/ambari/trunk/ambari-web/app/mappers/service_mapper.js Fri Jan 11 
02:46:24 2013
@@ -127,6 +127,7 @@ App.servicesMapper = App.QuickDataMapper
     // page must be careful because, it will randomly
     // pick a host.
     work_status: 'host_components[0].HostRoles.state',
+    desired_status: 'host_components[0].HostRoles.desired_state',
     host_id: 'host_components[0].HostRoles.host_name'
   },
 
@@ -134,6 +135,7 @@ App.servicesMapper = App.QuickDataMapper
   config3: {
     id: 'id',
     work_status: 'HostRoles.state',
+    desired_status: 'HostRoles.desired_state',
     component_name: 'HostRoles.component_name',
     host_id: 'HostRoles.host_name',
     service_id: 'component[0].ServiceComponentInfo.service_name'
@@ -207,6 +209,7 @@ App.servicesMapper = App.QuickDataMapper
         if (component && component.get('isLoaded')) { // UPDATE
           if (componentJson.work_status) {
             component.set('workStatus', componentJson.work_status);
+            component.set('desiredStatus', componentJson.desired_status);
           }
           if (componentJson.host_id) {
             component.set('host', App.Host.find(componentJson.host_id));
@@ -235,6 +238,7 @@ App.servicesMapper = App.QuickDataMapper
         if (component && component.get('isLoaded')) { // UPDATE
           if (hcJson.work_status) {
             component.set('workStatus', hcJson.work_status);
+            component.set('desiredStatus', hcJson.desired_status);
           }
           if (hcJson.component_name) {
             component.set('componentName', hcJson.component_name);

Modified: incubator/ambari/trunk/ambari-web/app/mappers/status_mapper.js
URL: 
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/mappers/status_mapper.js?rev=1431832&r1=1431831&r2=1431832&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/mappers/status_mapper.js (original)
+++ incubator/ambari/trunk/ambari-web/app/mappers/status_mapper.js Fri Jan 11 
02:46:24 2013
@@ -24,12 +24,14 @@ App.statusMapper = App.QuickDataMapper.c
 
   config2:{
     id:'ServiceComponentInfo.component_name',
-    work_status:'host_components[0].HostRoles.state'
+    work_status:'host_components[0].HostRoles.state',
+    desired_status: 'host_components[0].HostRoles.desired_state'
   },
 
   config3:{
     id:'id',
-    work_status:'HostRoles.state'
+    work_status:'HostRoles.state',
+    desired_status: 'HostRoles.desired_state'
   },
 
   map:function (json) {
@@ -71,6 +73,7 @@ App.statusMapper = App.QuickDataMapper.c
         var component = components.findProperty('id', item.id);
         if(component){
           component.set('workStatus', item.work_status);
+          component.set('desiredStatus', item.desired_status);
         }
       })
 
@@ -89,6 +92,7 @@ App.statusMapper = App.QuickDataMapper.c
         var hostComponent = hostComponents.findProperty('id', item.id);
         if(hostComponent){
           hostComponent.set('workStatus', item.work_status);
+          hostComponent.set('desiredStatus', item.desired_status);
         }
       })
     }

Modified: incubator/ambari/trunk/ambari-web/app/models/component.js
URL: 
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/models/component.js?rev=1431832&r1=1431831&r2=1431832&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/models/component.js (original)
+++ incubator/ambari/trunk/ambari-web/app/models/component.js Fri Jan 11 
02:46:24 2013
@@ -33,7 +33,9 @@ App.Component = DS.Model.extend({
   //host_id: DS.attr('string'),
 
   workStatus: DS.attr('string'),
-
+  
+  desiredStatus: DS.attr('string'),
+  
   isMaster: function () {
     switch (this.get('componentName')) {
       case 'NAMENODE':

Modified: incubator/ambari/trunk/ambari-web/app/models/host_component.js
URL: 
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/models/host_component.js?rev=1431832&r1=1431831&r2=1431832&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/models/host_component.js (original)
+++ incubator/ambari/trunk/ambari-web/app/models/host_component.js Fri Jan 11 
02:46:24 2013
@@ -20,6 +20,7 @@ var App = require('app');
 
 App.HostComponent = DS.Model.extend({
   workStatus: DS.attr('string'),
+  desiredStatus: DS.attr('string'),
   componentName: DS.attr('string'),
   host: DS.belongsTo('App.Host'),
   service: DS.belongsTo('App.Service'),

Modified: incubator/ambari/trunk/ambari-web/app/models/service.js
URL: 
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/models/service.js?rev=1431832&r1=1431831&r2=1431832&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/models/service.js (original)
+++ incubator/ambari/trunk/ambari-web/app/models/service.js Fri Jan 11 02:46:24 
2013
@@ -40,10 +40,16 @@ App.Service = DS.Model.extend({
   healthStatus: function () {
     var components = this.get('components').filterProperty('isMaster', true);
     if (components.everyProperty('workStatus', App.Component.Status.started)) {
+      if (components.someProperty('desiredStatus', 
App.Component.Status.stopped)) {
+        return 'red-blinking';
+      }
       return 'green';
     } else if (components.someProperty('workStatus', 
App.Component.Status.starting)) {
       return 'green-blinking';
     } else if (components.someProperty('workStatus', 
App.Component.Status.stopped)) {
+      if (components.someProperty('desiredStatus', 
App.Component.Status.started)) {
+        return 'green-blinking';
+      }
       return 'red';
     } else {
       return 'red-blinking';


Reply via email to