aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/js
diff options
context:
space:
mode:
authorVincent Brillault2013-12-16 21:46:12 +0100
committerPim van den Berg2014-01-12 14:35:01 +0100
commit097dfa6584418001181eebae28cb09e7d7761a63 (patch)
tree3de27ed834a50e03bf8ffb87be2c29fc86b5372a /js
parentjsrrdgraph: RrdDataFile.js: fix space/tabulation (diff)
downloadapt-panopticon_cgp-097dfa6584418001181eebae28cb09e7d7761a63.zip
apt-panopticon_cgp-097dfa6584418001181eebae28cb09e7d7761a63.tar.gz
apt-panopticon_cgp-097dfa6584418001181eebae28cb09e7d7761a63.tar.bz2
apt-panopticon_cgp-097dfa6584418001181eebae28cb09e7d7761a63.tar.xz
jsrrdgraph: RrdDataFile.js: splitting fetch into fetch & build
Diffstat (limited to 'js')
-rw-r--r--js/RrdDataFile.js25
1 files changed, 15 insertions, 10 deletions
diff --git a/js/RrdDataFile.js b/js/RrdDataFile.js
index ebe0857..e3e74e6 100644
--- a/js/RrdDataFile.js
+++ b/js/RrdDataFile.js
@@ -35,7 +35,7 @@ RrdDataFile.prototype = {
35 { 35 {
36 this.rrdfiles = {}; 36 this.rrdfiles = {};
37 }, 37 },
38 fetch: function(gdp, ft_step) 38 build: function(gdp, ft_step, rrd)
39 { 39 {
40 var cal_start, cal_end; 40 var cal_start, cal_end;
41 var best_full_rra = 0, best_part_rra = 0, chosen_rra = 0; 41 var best_full_rra = 0, best_part_rra = 0, chosen_rra = 0;
@@ -43,18 +43,9 @@ RrdDataFile.prototype = {
43 var full_match, rra_base; 43 var full_match, rra_base;
44 var first_full = 1; 44 var first_full = 1;
45 var first_part = 1; 45 var first_part = 1;
46 var rrd;
47 var data_ptr; 46 var data_ptr;
48 var rows; 47 var rows;
49 48
50 if (gdp.rrd in this.rrdfiles) {
51 rrd = this.rrdfiles[gdp.rrd];
52 } else {
53 var bf = FetchBinaryURL(gdp.rrd);
54 rrd = new RRDFile(bf);
55 this.rrdfiles[gdp.rrd] = rrd;
56 }
57
58 var cf_idx = gdp.cf; 49 var cf_idx = gdp.cf;
59 var ds_cnt = rrd.getNrDSs(); 50 var ds_cnt = rrd.getNrDSs();
60 var rra_cnt = rrd.getNrRRAs(); 51 var rra_cnt = rrd.getNrRRAs();
@@ -125,5 +116,19 @@ RrdDataFile.prototype = {
125 } 116 }
126 } 117 }
127 return ft_step; 118 return ft_step;
119 },
120 fetch: function(gdp, ft_step)
121 {
122 var rrd;
123
124 if (gdp.rrd in this.rrdfiles) {
125 rrd = this.rrdfiles[gdp.rrd];
126 } else {
127 var bf = FetchBinaryURL(gdp.rrd);
128 rrd = new RRDFile(bf);
129 this.rrdfiles[gdp.rrd] = rrd;
130 }
131
132 return this.build(gdp, ft_step, rrd);
128 } 133 }
129}; 134};