You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by yu...@apache.org on 2012/12/09 14:57:37 UTC

svn commit: r1418958 - in /incubator/ambari/branches/AMBARI-666: AMBARI-666-CHANGES.txt ambari-web/app/mappers/services_mapper.js ambari-web/app/messages.js ambari-web/app/utils/helper.js

Author: yusaku
Date: Sun Dec  9 13:57:36 2012
New Revision: 1418958

URL: http://svn.apache.org/viewvc?rev=1418958&view=rev
Log:
AMBARI-1023. Dashboard page should handle API sending JSON as strings and objects. (Srimanth Gunturi via yusaku)

Modified:
    incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt
    incubator/ambari/branches/AMBARI-666/ambari-web/app/mappers/services_mapper.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/messages.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/utils/helper.js

Modified: incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt?rev=1418958&r1=1418957&r2=1418958&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt (original)
+++ incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt Sun Dec  9 13:57:36 2012
@@ -420,6 +420,9 @@ AMBARI-666 branch (unreleased changes)
 
   IMPROVEMENTS
 
+  AMBARI-1023. Dashboard page should handle API sending JSON as strings and
+  object. (Srimanth Gunturi via yusaku)
+
   AMBARI-1011. Create 2 missing HDFS service graphs. (Srimanth Gunturi via
   yusaku)
 

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/mappers/services_mapper.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/mappers/services_mapper.js?rev=1418958&r1=1418957&r2=1418958&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/mappers/services_mapper.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/mappers/services_mapper.js Sun Dec  9 13:57:36 2012
@@ -155,9 +155,9 @@ App.servicesMapper = App.QuickDataMapper
               item.nameNodeComponent = component;
               finalConfig = jQuery.extend(finalConfig, hdfsConfig);
               // Get the live, dead & decommision nodes from string json
-              var liveNodesJson = jQuery.parseJSON(component.ServiceComponentInfo.LiveNodes);
-              var deadNodesJson = jQuery.parseJSON(component.ServiceComponentInfo.DeadNodes);
-              var decommisionNodesJson = jQuery.parseJSON(component.ServiceComponentInfo.DecomNodes);
+              var liveNodesJson = App.parseJSON(component.ServiceComponentInfo.LiveNodes);
+              var deadNodesJson = App.parseJSON(component.ServiceComponentInfo.DeadNodes);
+              var decommisionNodesJson = App.parseJSON(component.ServiceComponentInfo.DecomNodes);
               item.live_data_nodes = [];
               item.dead_data_nodes = [];
               item.decommision_data_nodes = [];
@@ -200,9 +200,9 @@ App.servicesMapper = App.QuickDataMapper
               // Get the live, gray & black nodes from string json
               item.map_slots = 0;
               item.reduce_slots = 0;
-              var liveNodesJson = jQuery.parseJSON(component.ServiceComponentInfo.AliveNodes);
-              var grayNodesJson = jQuery.parseJSON(component.ServiceComponentInfo.GrayListedNodes);
-              var blackNodesJson = jQuery.parseJSON(component.ServiceComponentInfo.BlackListedNodes);
+              var liveNodesJson = App.parseJSON(component.ServiceComponentInfo.AliveNodes);
+              var grayNodesJson = App.parseJSON(component.ServiceComponentInfo.GrayListedNodes);
+              var blackNodesJson = App.parseJSON(component.ServiceComponentInfo.BlackListedNodes);
               item.alive_trackers = [];
               item.gray_list_trackers = [];
               item.black_list_trackers = [];
@@ -253,7 +253,7 @@ App.servicesMapper = App.QuickDataMapper
             if (component.ServiceComponentInfo && component.ServiceComponentInfo.component_name == "HBASE_MASTER") {
               item.masterComponent = component;
               finalConfig = jQuery.extend(finalConfig, hbaseConfig);
-              var regionsArray = jQuery.parseJSON(component.ServiceComponentInfo.RegionsInTransition);
+              var regionsArray = App.parseJSON(component.ServiceComponentInfo.RegionsInTransition);
               item.regions_in_transition = regionsArray == null ? 0 : regionsArray.length;
             }
             if (component.ServiceComponentInfo && component.ServiceComponentInfo.component_name == "HBASE_REGIONSERVER") {

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/messages.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/messages.js?rev=1418958&r1=1418957&r2=1418958&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/messages.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/messages.js Sun Dec  9 13:57:36 2012
@@ -316,7 +316,7 @@ Em.I18n.translations = {
   'dashboard.services.mapreduce.reduceSlots':'Reduce Slots',
   'dashboard.services.mapreduce.tasks.maps':'Tasks: Maps',
   'dashboard.services.mapreduce.tasks.reduces':'Tasks: Reduces',
-  'dashboard.services.mapreduce.reduceSlotsSummary':'{0} occuped / {1} reserved',
+  'dashboard.services.mapreduce.reduceSlotsSummary':'{0} occupied / {1} reserved',
   'dashboard.services.mapreduce.tasksSummary':'{0} running / {1} waiting',
   'dashboard.services.mapreduce.slotCapacitySummary':'{0} maps / {1} reduces / {2} avg per node',
   'dashboard.services.mapreduce.jobTrackerHeap':'JobTracker Heap',

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/utils/helper.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/utils/helper.js?rev=1418958&r1=1418957&r2=1418958&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/utils/helper.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/utils/helper.js Sun Dec  9 13:57:36 2012
@@ -137,6 +137,17 @@ App.formatUrl = function (urlTemplate, s
   return formatted;
 }
 
+/**
+ * Certain variables can have JSON in string
+ * format, or in JSON format itself.
+ */
+App.parseJSON = function(value){
+  if(typeof value == "string"){
+    return jQuery.parseJSON(value);
+  }
+  return value;
+};
+
 App.format = {
   role: function (role) {
     switch (role) {