Skip to content

Commit 3a60c84

Browse files
author
Jesse White
committed
1.1.4 release artifacts
1 parent 4357be3 commit 3a60c84

File tree

4 files changed

+42
-26
lines changed

4 files changed

+42
-26
lines changed

dist/backshift.js

+18-10
Original file line numberDiff line numberDiff line change
@@ -1376,7 +1376,7 @@ Backshift.Graph = Backshift.Class.create(Backshift.Class.Configurable, {
13761376
if (results.constants && results.constants[prop]) {
13771377
value = results.constants[prop];
13781378
} else {
1379-
value = prop;
1379+
value = "null";
13801380
}
13811381
if (title) { title = title.replace(re, value); }
13821382
if (verticalLabel) { verticalLabel = verticalLabel.replace(re, value); }
@@ -1752,7 +1752,7 @@ Backshift.DataSource.OpenNMS = Backshift.Class.create(Backshift.DataSource, {
17521752
},
17531753

17541754
_parseResponse: function (json) {
1755-
var k, columns, columnNames, columnNameToIndex, constants,
1755+
var k, columns, columnNames, columnNameToIndex, constants, parts,
17561756
numMetrics = json.labels.length;
17571757

17581758
columns = new Array(1 + numMetrics);
@@ -1774,13 +1774,14 @@ Backshift.DataSource.OpenNMS = Backshift.Class.create(Backshift.DataSource, {
17741774
for (var c=0, len=json.constants.length, key, value, label; c < len; c++) {
17751775
key = json.constants[c].key;
17761776
value = json.constants[c].value;
1777-
for (var l=0; l < numMetrics; l++) {
1778-
label = json.labels[l];
1779-
if (key.indexOf(label+'.') === 0) {
1780-
// constant matches the label, extract the constant name
1781-
key = key.substring((label+'.').length);
1782-
constants[key] = (value === undefined? null: value);
1783-
}
1777+
1778+
// All of the constants are prefixed with the label of the associated source, but
1779+
// the graph definitions don't support this prefix, so we just cut the prefix
1780+
// off the constant name
1781+
parts = key.split('.');
1782+
if (parts.length > 1) {
1783+
key = parts[1];
1784+
constants[key] = (value === undefined? null: value);
17841785
}
17851786
}
17861787
}
@@ -1789,7 +1790,7 @@ Backshift.DataSource.OpenNMS = Backshift.Class.create(Backshift.DataSource, {
17891790
columns: columns,
17901791
columnNames: columnNames,
17911792
columnNameToIndex: columnNameToIndex,
1792-
constants: constants,
1793+
constants: constants
17931794
};
17941795
}
17951796
});
@@ -2331,6 +2332,13 @@ Backshift.Graph.Flot = Backshift.Class.create(Backshift.Graph, {
23312332
numSeries = this.model.series.length;
23322333
numValues = timestamps.length;
23332334

2335+
// Rendering will silently fail if the timestamps are not ordered, throw an exception if this is detected
2336+
for (i = 1; i < numValues; i++) {
2337+
if (timestamps[i] < timestamps[i-1]) {
2338+
throw "Timestamps are not properly ordered! (" + timestamps[i] + " < " + timestamps[i-1] + ")";
2339+
}
2340+
}
2341+
23342342
var from, to;
23352343
if (numValues >= 2) {
23362344
from = timestamps[0];

dist/backshift.min.js

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/backshift.onms.js

+18-10
Original file line numberDiff line numberDiff line change
@@ -1190,7 +1190,7 @@ Backshift.Graph = Backshift.Class.create(Backshift.Class.Configurable, {
11901190
if (results.constants && results.constants[prop]) {
11911191
value = results.constants[prop];
11921192
} else {
1193-
value = prop;
1193+
value = "null";
11941194
}
11951195
if (title) { title = title.replace(re, value); }
11961196
if (verticalLabel) { verticalLabel = verticalLabel.replace(re, value); }
@@ -1408,6 +1408,13 @@ Backshift.Graph.Flot = Backshift.Class.create(Backshift.Graph, {
14081408
numSeries = this.model.series.length;
14091409
numValues = timestamps.length;
14101410

1411+
// Rendering will silently fail if the timestamps are not ordered, throw an exception if this is detected
1412+
for (i = 1; i < numValues; i++) {
1413+
if (timestamps[i] < timestamps[i-1]) {
1414+
throw "Timestamps are not properly ordered! (" + timestamps[i] + " < " + timestamps[i-1] + ")";
1415+
}
1416+
}
1417+
14111418
var from, to;
14121419
if (numValues >= 2) {
14131420
from = timestamps[0];
@@ -1853,7 +1860,7 @@ Backshift.DataSource.OpenNMS = Backshift.Class.create(Backshift.DataSource, {
18531860
},
18541861

18551862
_parseResponse: function (json) {
1856-
var k, columns, columnNames, columnNameToIndex, constants,
1863+
var k, columns, columnNames, columnNameToIndex, constants, parts,
18571864
numMetrics = json.labels.length;
18581865

18591866
columns = new Array(1 + numMetrics);
@@ -1875,13 +1882,14 @@ Backshift.DataSource.OpenNMS = Backshift.Class.create(Backshift.DataSource, {
18751882
for (var c=0, len=json.constants.length, key, value, label; c < len; c++) {
18761883
key = json.constants[c].key;
18771884
value = json.constants[c].value;
1878-
for (var l=0; l < numMetrics; l++) {
1879-
label = json.labels[l];
1880-
if (key.indexOf(label+'.') === 0) {
1881-
// constant matches the label, extract the constant name
1882-
key = key.substring((label+'.').length);
1883-
constants[key] = (value === undefined? null: value);
1884-
}
1885+
1886+
// All of the constants are prefixed with the label of the associated source, but
1887+
// the graph definitions don't support this prefix, so we just cut the prefix
1888+
// off the constant name
1889+
parts = key.split('.');
1890+
if (parts.length > 1) {
1891+
key = parts[1];
1892+
constants[key] = (value === undefined? null: value);
18851893
}
18861894
}
18871895
}
@@ -1890,7 +1898,7 @@ Backshift.DataSource.OpenNMS = Backshift.Class.create(Backshift.DataSource, {
18901898
columns: columns,
18911899
columnNames: columnNames,
18921900
columnNameToIndex: columnNameToIndex,
1893-
constants: constants,
1901+
constants: constants
18941902
};
18951903
}
18961904
});

dist/backshift.onms.min.js

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)