summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Wuerthwein <fkw@ucsd.edu>2009-05-10 14:38:03 +0000
committerFrank Wuerthwein <fkw@ucsd.edu>2009-05-10 14:38:03 +0000
commit43ac4fe5697f20705d980dccee9cea918d9ab32e (patch)
tree3826d2e138677c5ad901f0d0b8dc7c81d391dbec
parent98630eefa847aefbf980309d2a51ea11a637e5ea (diff)
Add ds_list - allow user to specify a list of DSs
-rw-r--r--src/lib/rrdFlotMatrix.js31
1 files changed, 23 insertions, 8 deletions
diff --git a/src/lib/rrdFlotMatrix.js b/src/lib/rrdFlotMatrix.js
index 54505a5..23bacb2 100644
--- a/src/lib/rrdFlotMatrix.js
+++ b/src/lib/rrdFlotMatrix.js
@@ -24,6 +24,13 @@
*/
/*
+ * The ds_list is a list of
+ * [ds_id, ds_title] pairs
+ * If not defined, the list will be created from the RRDs
+ *
+ */
+
+/*
* Local dependencies:
* rrdFlotSupport.py
*
@@ -51,9 +58,21 @@
* }
*/
-function rrdFlotMatrix(html_id, rrd_files, graph_options, rrd_graph_options) {
+function rrdFlotMatrix(html_id, rrd_files, ds_list, graph_options, rrd_graph_options) {
this.html_id=html_id;
this.rrd_files=rrd_files;
+ if (ds_list==null) {
+ this.ds_list=[];
+ var rrd_file=this.rrd_files[0][1]; // get the first one... they are all the same
+ var nrDSs=rrd_file.getNrDSs();
+ for (var i=0; i<nrDSs; i++) {
+ var ds=this.rrd_files[0][1].getDS(i);
+ var name=ds.getName();
+ this.ds_list.push([name,name]);
+ }
+ } else {
+ this.ds_list=ds_list;
+ }
this.graph_options=graph_options;
if (rrd_graph_options==null) {
this.rrd_graph_options=new Object(); // empty object, just not to be null
@@ -159,13 +178,9 @@ rrdFlotMatrix.prototype.populateDS = function() {
// First clean up anything in the element
while (form_el.lastChild!=null) form_el.removeChild(form_el.lastChild);
- var rrd_file=this.rrd_files[0][1]; // get the first one... they are all the same
- // now populate with RRA info
- var nrDSs=rrd_file.getNrDSs();
- for (var i=0; i<nrDSs; i++) {
- var ds=this.rrd_files[0][1].getDS(i);
- var name=ds.getName();
- form_el.appendChild(new Option(name,name));
+ for (i in this.ds_list) {
+ var ds=this.ds_list[i];
+ form_el.appendChild(new Option(ds[1],ds[0]));
}
};