@cryptotaxi247 / netdata-1 / commits / 0a0be5e9c

allow charts to be given a forced update-every frequency

Costa Tsaousis (ktsaou) committed Dec 26, 2017 at 20:56 UTC 0a0be5e9c39b24b768f47915f6c0949bac64606c
2 files changed +15 -2
web/dashboard.js
+14 -1
@@ -2403,6 +2403,8 @@ var NETDATA = window.NETDATA || {};
2403 this.running = false; // boolean - true when the chart is being refreshed now
2404 this.enabled = true; // boolean - is the chart enabled for refresh?
2405
2406 + this.force_update_every = null; // number - overwrite the visualization update frequency of the chart
2407 +
2408 that.tmp = {};
2409
2410 // ============================================================================================================
@@ -2472,6 +2474,13 @@ var NETDATA = window.NETDATA || {};
2474 that.pixels_per_point = NETDATA.dataAttribute(that.element, 'pixels-per-point', 1);
2475 that.points = NETDATA.dataAttribute(that.element, 'points', null);
2476
2477 + // the forced update_every
2478 + that.force_update_every = NETDATA.dataAttribute(that.element, 'update-every', null);
2479 + if(typeof that.force_update_every !== 'number' || that.force_update_every <= 1) {
2480 + that.log('ignoring invalid value of property data-update-every');
2481 + that.force_update_every = null;
2482 + }
2483 +
2484 // the dimensions requested by the user
2485 that.dimensions = NETDATA.dataAttribute(that.element, 'dimensions', null);
2486
@@ -4819,7 +4828,11 @@ var NETDATA = window.NETDATA || {};
4828 return false;
4829 }
4830
4822 - if(now - this.tm.last_autorefreshed >= this.data_update_every) {
4831 + var data_update_every = this.data_update_every;
4832 + if(typeof this.force_update_every === 'number')
4833 + data_update_every = this.force_update_every;
4834 +
4835 + if(now - this.tm.last_autorefreshed >= data_update_every) {
4836 if(this.debug === true)
4837 this.log('canBeAutoRefreshed(): It is time to update me.');
4838
web/index.html
+1 -1
@@ -5622,6 +5622,6 @@
5622 </div>
5623 </div>
5624 <div id="hiddenDownloadLinks" style="display: none;" hidden></div>
5625 - <script type="text/javascript" src="dashboard.js?v20171224-1"></script>
5625 + <script type="text/javascript" src="dashboard.js?v20171226-1"></script>
5626 </body>
5627 </html>