summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Wall <richard@largo>2011-08-14 08:16:33 +0100
committerRichard Wall <richard@largo>2011-08-14 08:16:33 +0100
commit39fa4b2381ddabef6afd797ebb1a0f9f3d3080fc (patch)
tree80fb85eaad91096a792647f3108ccc8f3191465d
parent3853f6d9aadb359d5798a46438a969e568562fcb (diff)
check for existing DEF
-rw-r--r--docs/examples/assets/js/jsrrdgraph.js12
1 files changed, 7 insertions, 5 deletions
diff --git a/docs/examples/assets/js/jsrrdgraph.js b/docs/examples/assets/js/jsrrdgraph.js
index a7d0b9e..7dfdcad 100644
--- a/docs/examples/assets/js/jsrrdgraph.js
+++ b/docs/examples/assets/js/jsrrdgraph.js
@@ -4220,7 +4220,7 @@ RRDGraph.prototype = {
for (var j = n, xlen = args.length ; j < xlen ; j++) {
var opts = args[j].split("=");
if (opts[0] === "step") step = opts[1];
- if (opts[0] === "reduce") reduce = opts[1]
+ if (opts[0] === "reduce") reduce = opts[1];
if (opts[0] === "start") start = opts[1];
if (opts[0] === "end") end = opts[1];
}
@@ -4229,7 +4229,7 @@ RRDGraph.prototype = {
},
create_def: function (vname, rrdfile, name, cf, step, start, end, reduce)
{
- var gdp = new RRDGraphDesc(this);
+ var gdp = new RRDGraphDesc(this);
var start_t = new RRDTime(this.start);
var end_t = new RRDTime(this.end);
@@ -4293,9 +4293,11 @@ RRDGraph.prototype = {
var index = rpn.indexOf(',');
var name = rpn.substring(0,index);
gdp.vidx = this.find_var(name); // FIXME checks
- if (this.gdes[gdp.vidx].gf != RRDGraphDesc.GF.DEF && this.gdes[gdp.vidx].gf != RRDGraphDesc.GF.CDEF) {
+ if (gdp.vidx === -1
+ || this.gdes[gdp.vidx].gf != RRDGraphDesc.GF.DEF
+ && this.gdes[gdp.vidx].gf != RRDGraphDesc.GF.CDEF) {
throw 'variable "'+name+'" not DEF nor CDEF in VDEF.';
- }
+ }
this.vdef_parse(gdp, rpn.substring(index+1));
@@ -4451,7 +4453,7 @@ RRDGraph.prototype = {
gdp.format = format;
}
// if (this.gdes[gdp.vidx].gf === RRDGraphDesc.GF.VDEF && gdp.strftm === true) // FIXME
- if (this.gdes[gdp.vidx].gf === RRDGraphDesc.GF.VDEF && strtime === true) // FIXME
+ if (this.gdes[gdp.vidx].gf === RRDGraphDesc.GF.VDEF && strftime === true) // FIXME
gdp.strftm = true;
this.gdes.push(gdp);
},