Author: croberts
Date: 2012-04-27 15:59:46 +0000 (Fri, 27 Apr 2012)
New Revision: 5349
Modified:
trunk/cumin/resources/app.js
Log:
Cleaning-up some commented-out code and a few changes for code readability.
Modified: trunk/cumin/resources/app.js
===================================================================
--- trunk/cumin/resources/app.js 2012-04-27 15:44:40 UTC (rev 5348)
+++ trunk/cumin/resources/app.js 2012-04-27 15:59:46 UTC (rev 5349)
@@ -427,11 +427,15 @@
return false;
}
-
+var ONE_MINUTE = 60;
+var TEN_MINUTES = 600;
var ONE_HOUR = 3600;
var ONE_DAY = 86400;
var ONE_MONTH = 2592000;
+var ONE_YEAR = 31557600;
var MAX_UPDATE_CHART_DURATION = ONE_DAY;
+
+var CHART_UPDATE_INTERVAL_MS = 10000;
/*
This block of code sets up the allCharts object which is where all of the
charts will be stored. If a given chart already exists in the allCharts
@@ -485,20 +489,20 @@
allCharts['chartNowTime'] = new Date();
wooly.setIntervalUpdate(jsonurl, stathandler, 0, passback, true);
}
- }
+ }3600
}
/*
This function sets up the timer that will trigger the updating of each chart
*/
startChartMonitor = function(id) {
- allCharts[id].intervalId = setInterval(function() {updateSingleChart(id)}, 10000); //
maybe there needs to be updatesinglechart that will check duration, etc
+ allCharts[id].intervalId = setInterval(function() {updateSingleChart(id)},
CHART_UPDATE_INTERVAL_MS);
}
/*
This function is meant to take the JSON response from cumin and do some basic work on
it (determine max/min).
A lot of the dirtier work is done in the parseJson function.
- After getting the data into the dataContainer object, the drawChart function is
called
+ After getting the data into the dataContainer object, the drawChart funct// maybe
there needs to be updatesinglechart that will check duration, etcion is called
*/
stathandler = function(response) {
try {
@@ -515,7 +519,7 @@
}
/*
- The parseJson function takes the output from cumin and massages it into
+ The parseJson function takes the output from cumin and massages it into// maybe there
needs to be updatesinglechart that will check duration, etc
something that is useful for the charting library in use (currently jqplot).
It is most definitely easier to tweak this function as needed than it is to
make significant (and possibly temporary) adjustments to the cumin output
@@ -528,24 +532,24 @@
dataContainer['duration'] = json['duration'];
switch(json['duration']) {
- case 600:
- dataContainer['x_axis_normalizer'] = 60;
+ case TEN_MINUTES:
+ dataContainer['x_axis_normalizer'] = ONE_MINUTE;
dataContainer['x_axis_unit_label'] = "min";
break;
- case 3600:
- dataContainer['x_axis_normalizer'] = 60;
+ case ONE_HOUR:
+ dataContainer['x_axis_normalizer'] = ONE_MINUTE;
dataContainer['x_axis_unit_label'] = "min";
break;
- case 86400:
- dataContainer['x_axis_normalizer'] = 3600;
+ case ONE_DAY:
+ dataContainer['x_axis_normalizer'] = ONE_HOUR;
dataContainer['x_axis_unit_label'] = "hr";
break;
- case 2592000:
- dataContainer['x_axis_normalizer'] = 86400;
+ case ONE_MONTH:
+ dataContainer['x_axis_normalizer'] = ONE_DAY;
dataContainer['x_axis_unit_label'] = "day";
break;
- case 31557600:
- dataContainer['x_axis_normalizer'] = 2592000;
+ case ONE_YEAR:
+ dataContainer['x_axis_normalizer'] = ONE_MONTH;
dataContainer['x_axis_unit_label'] = "mo";
break;
}
@@ -561,7 +565,6 @@
for ( var j = 0; j < json.elements[i].values.length; j++) {
dataContainer['x_coordinate_values'][i]
.append([ json.elements[i].values[j].dt / dataContainer['x_axis_normalizer']
]);
- //console.log("X-coordinate value of: " + json.elements[i].values[j].dt +
" going to divide by " + dataContainer['x_axis_normalizer']);
}
}
@@ -584,11 +587,6 @@
dataContainer['x_axis_values'] = dataContainer['x_axis_values']
.append([ json.x_axis.labels.labels[i].text ]);
}
-
-// console.log("end_secs: " + dataContainer['end_secs'] + "
tnow: " + dataContainer['tnow']);
-// console.log("x-axis vals: " + dataContainer['x_axis_values']);
-// console.log("x_coord_vals: " +
dataContainer['x_coordinate_values']);
-// console.log("y_coord_vals: " +
dataContainer['y_coordinate_values']);
return dataContainer;
}
@@ -727,9 +725,6 @@
// when called to render a popup tooltip, the caller is named "g"...not
sure why. Whattup, g?
if(arguments.callee.caller.getName() == 'g') {
var tempTime = allCharts['chartNowTime'].clone();
- //console.log("Using tempTime (chartNowTime) of: " + tempTime);
- //console.log("Input offset timestamp of: "+ val);
- //console.log("Subtract offset in months from temptime: " +
tempTime.increment('month', val));
timeFormat = "%b %e, %T";
if(format.search(/min/) > -1) {
modifier = 60 * val;
Show replies by date