You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@edgent.apache.org by ho...@apache.org on 2016/03/11 01:17:40 UTC

incubator-quarks git commit: cleaned up oplet short name based on oplet id, instead of idx

Repository: incubator-quarks
Updated Branches:
  refs/heads/console_improvements 504a50b1d -> d41304d8f


cleaned up oplet short name based on oplet id, instead of idx


Project: http://git-wip-us.apache.org/repos/asf/incubator-quarks/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-quarks/commit/d41304d8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-quarks/tree/d41304d8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-quarks/diff/d41304d8

Branch: refs/heads/console_improvements
Commit: d41304d8fce49306691c06113a71aa6171a94c3f
Parents: 504a50b
Author: Susan L. Cline <ho...@apache.org>
Authored: Thu Mar 10 16:17:31 2016 -0800
Committer: Susan L. Cline <ho...@apache.org>
Committed: Thu Mar 10 16:17:31 2016 -0800

----------------------------------------------------------------------
 console/servlets/webapp_content/js/index.js   |  4 +--
 console/servlets/webapp_content/js/metrics.js | 37 +++++++++++++++++++---
 2 files changed, 33 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-quarks/blob/d41304d8/console/servlets/webapp_content/js/index.js
----------------------------------------------------------------------
diff --git a/console/servlets/webapp_content/js/index.js b/console/servlets/webapp_content/js/index.js
index b12f2a1..b7b3ef5 100644
--- a/console/servlets/webapp_content/js/index.js
+++ b/console/servlets/webapp_content/js/index.js
@@ -428,13 +428,11 @@ var renderGraph = function(jobId, counterMetrics, bIsNewJob) {
 	   .attr("transform", "translate(" + margin.left + "," + margin.top + ")");
 
 
-		var j = 0;
 		graph.vertices.forEach(function(vertex){
-			vertex.idx = j;
+			vertex.idx = parseInt(vertex.id.substring("OP_".length, vertex.id.length));
 			if (!vertexMap[vertex.id]) {
 				vertexMap[vertex.id] = vertex;
 			}
-			j++;
 		});
 		
 		var i = 0;

http://git-wip-us.apache.org/repos/asf/incubator-quarks/blob/d41304d8/console/servlets/webapp_content/js/metrics.js
----------------------------------------------------------------------
diff --git a/console/servlets/webapp_content/js/metrics.js b/console/servlets/webapp_content/js/metrics.js
index 8d33c7a..6807bdd 100644
--- a/console/servlets/webapp_content/js/metrics.js
+++ b/console/servlets/webapp_content/js/metrics.js
@@ -248,7 +248,8 @@ metricFunction = function(selectedJobId, metricSelected) {
 			  var metrics = op.metrics;
 			  metrics.forEach(function(met) {
 				 obj.type = met.type;
-				 obj.name = obj.opId; 
+				 obj.name = obj.opId;
+				 obj.shortName = obj.opId.substring("OP_".length, obj.opId.length);
 				 obj.value = met.value;
 				 obj.metricName = met.name;
 				 obj.opKind = vertexMap[obj.opId].invocation.kind;
@@ -256,10 +257,23 @@ metricFunction = function(selectedJobId, metricSelected) {
 			  data.push(obj);
 		   });
 		   
+		   var sortData = function(objA, objB) {
+        		 if (parseInt(objA.shortName) < parseInt(objB.shortName))  {
+	         	    	return -1;
+	         	     } else if (parseInt(objA.shortName) > parseInt(objB.shortName)){
+	         	    	return 1;
+	         	     } else {
+	         	    	return 0;
+	         	    }
+		   };
+		   
+		   data.sort(sortData);
+		   
 	   x.domain(
 			   data.map(
 					   function(d) { 
-						   return d.name; }));
+						   // this is the value shown on the x axis tick marks
+						   return  d.shortName; }));
 	   
 	   
 	   var max = d3.max(data, function(d) {
@@ -306,7 +320,7 @@ metricFunction = function(selectedJobId, metricSelected) {
 	      .style("fill", function(d) {
 	    		return opletColor[d.opKind];
 	      })
-	      .attr("x", function(d) { return x(d.name); })
+	      .attr("x", function(d) { return x(d.shortName); })
 	      .attr("width", x.rangeBand())
 	      .attr("y", function(d) { 
 	   	   if (d.type === "double") {
@@ -329,7 +343,7 @@ metricFunction = function(selectedJobId, metricSelected) {
 	  
 	  rect.append("title")
       .text(function(d) {
-    	  return "Name: " + d.name +
+    	  return "Name: " + d.shortName +
     	  "\nValue: " + d.value;
     	  });
 	  
@@ -640,7 +654,20 @@ metricsAvailable = function(queryString, jobId, bIsNewJob) {
         	    			// get the value for the Rate Unit, append it for all "meter" types
         	    			rateUnitVal = obj.value;
         	    		} else {
-        	    		   var opsText = obj.ops.toString();
+        	    		   var opsText = "";
+        	    		   var sortOps = function(opA, opB) {
+        	          		 if (parseInt(opA.substring("OP_".length, opA.length)) < parseInt(opB.substring("OP_".length, opB.length)))  {
+        	         	    	return -1;
+        	         	     } else if (parseInt(opA.substring("OP_".length, opA.length)) > parseInt(opB.substring("OP_".length, opB.length))){
+        	         	    	return 1;
+        	         	     } else {
+        	         	    	return 0;
+        	         	    }
+        	    		   };
+        	    		   obj.ops.sort(sortOps);
+        	    		   obj.ops.forEach(function (op){
+        	    			   opsText += op.substring("OP_".length, op.length) + ",";
+        	    		   });
         	    		   if (opsText.length > 100) {
         	    			   var splitOps = opsText.split(",");
         	    			   var scale = 100/opsText.length;