aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/js
diff options
context:
space:
mode:
authorPeter Wu2014-07-31 10:23:27 +0200
committerPim van den Berg2014-11-14 00:09:42 +0100
commitd0557f227a2cffdd83ffe749c575c5a738b7dbd6 (patch)
tree1048ec8ddc14a2c0f04b1cf690fb5bd01b03fc7f /js
parentmake detail page accessible when using "canvas" graph_type (diff)
downloadapt-panopticon_cgp-d0557f227a2cffdd83ffe749c575c5a738b7dbd6.zip
apt-panopticon_cgp-d0557f227a2cffdd83ffe749c575c5a738b7dbd6.tar.gz
apt-panopticon_cgp-d0557f227a2cffdd83ffe749c575c5a738b7dbd6.tar.bz2
apt-panopticon_cgp-d0557f227a2cffdd83ffe749c575c5a738b7dbd6.tar.xz
jsrrdgraph: Fix undefined value issue in RrdDataFile
`RRDRRAInfo.pdp_cnt` does not exist. A reference to the pdp_cnt member in a struct exists, this is available via the `getPdpPerRow()` method, so use that. (actually, `getMinStep() * getPdpPerRow()` can be simplified further, see below). While at it, replace the combination `RRDRRAInfo.getPdpPerRow() * RRAInfo.pdp_step` by `RRDRRAInfo.getStep()` since this is the same thing. As `RRDHeader.pdp_step` is copied into `RRDRRAInfo`, this can also be substituted.
Diffstat (limited to 'js')
-rw-r--r--js/RrdDataFile.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/js/RrdDataFile.js b/js/RrdDataFile.js
index 2c0e846..08cc3ae 100644
--- a/js/RrdDataFile.js
+++ b/js/RrdDataFile.js
@@ -60,11 +60,13 @@ RrdDataFile.prototype = {
60 for (i = 0; i < rra_cnt; i++) { 60 for (i = 0; i < rra_cnt; i++) {
61 rra = rrd.getRRAInfo(i); 61 rra = rrd.getRRAInfo(i);
62 if (RrdGraphDesc.cf_conv(rra.getCFName()) === cf_idx) { 62 if (RrdGraphDesc.cf_conv(rra.getCFName()) === cf_idx) {
63 cal_end = (rrd.getLastUpdate() - (rrd.getLastUpdate() % (rra.getPdpPerRow() * rra.pdp_step))); 63 /* covered seconds in this RRA */
64 cal_start = (cal_end - (rra.getPdpPerRow() * rra.row_cnt * rra.pdp_step)); 64 var range_secs = rra.getStep();
65 cal_end = rrd.getLastUpdate() - (rrd.getLastUpdate() % range_secs);
66 cal_start = cal_end - (range_secs * rra.row_cnt);
65 full_match = gdp.end - gdp.start; 67 full_match = gdp.end - gdp.start;
66 68
67 tmp_step_diff = Math.abs(ft_step - (rrd.getMinStep() * rra.pdp_cnt)); 69 tmp_step_diff = Math.abs(ft_step - range_secs);
68 if (cal_start <= gdp.start) { 70 if (cal_start <= gdp.start) {
69 if (first_full || (tmp_step_diff < best_full_step_diff)) { 71 if (first_full || (tmp_step_diff < best_full_step_diff)) {
70 first_full = 0; 72 first_full = 0;
@@ -91,7 +93,7 @@ RrdDataFile.prototype = {
91 var rra_info = rrd.getRRAInfo(chosen_rra); 93 var rra_info = rrd.getRRAInfo(chosen_rra);
92 rra = rrd.getRRA(chosen_rra); 94 rra = rrd.getRRA(chosen_rra);
93 95
94 ft_step = rrd.rrd_header.pdp_step * rra_info.getPdpPerRow(); 96 ft_step = rra_info.getStep();
95 gdp.start -= (gdp.start % ft_step); 97 gdp.start -= (gdp.start % ft_step);
96 gdp.end += (ft_step - gdp.end % ft_step); 98 gdp.end += (ft_step - gdp.end % ft_step);
97 rows = (gdp.end - gdp.start) / ft_step + 1; 99 rows = (gdp.end - gdp.start) / ft_step + 1;