Allow 'refresh_immune_slices' (#2974)

* Allow 'refresh_immune_slices'

* Changed param name, added note in FAQ

* Linting
This commit is contained in:
Rich @ RadICS
2017-08-02 17:46:19 +02:00
committed by Maxime Beauchemin
parent 90592d3e3d
commit 163f4e359c
5 changed files with 39 additions and 6 deletions

View File

@@ -245,15 +245,18 @@ export function dashboardContainer(dashboard, datasources, userid) {
startPeriodicRender(interval) {
this.stopPeriodicRender();
const dash = this;
const immune = this.metadata.timed_refresh_immune_slices || [];
const maxRandomDelay = Math.max(interval * 0.2, 5000);
const refreshAll = () => {
dash.sliceObjects.forEach((slice) => {
const force = !dash.firstLoad;
setTimeout(() => {
slice.render(force);
},
// Randomize to prevent all widgets refreshing at the same time
maxRandomDelay * Math.random());
if (immune.indexOf(slice.data.slice_id) === -1) {
setTimeout(() => {
slice.render(force);
},
// Randomize to prevent all widgets refreshing at the same time
maxRandomDelay * Math.random());
}
});
dash.firstLoad = false;
};