From 8967189fd272d7783d21977af7846cd0124a9e03 Mon Sep 17 00:00:00 2001 From: Danielv123 Date: Fri, 17 Mar 2017 09:24:53 +0100 Subject: [PATCH] Setting to disable production graph for performance Related to #45 --- static/main.js | 1 + static/slaveDisplay.js | 13 ++++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/static/main.js b/static/main.js index 14e29a08..68f5f515 100644 --- a/static/main.js +++ b/static/main.js @@ -1,6 +1,7 @@ (function (){ ensureSetting("Display offline slaves", "boolean", false); + ensureSetting("Enable production graphs", "boolean", true); }()) function ensureSetting(setting, type, defaultSetting) { diff --git a/static/slaveDisplay.js b/static/slaveDisplay.js index d921105e..741e6012 100644 --- a/static/slaveDisplay.js +++ b/static/slaveDisplay.js @@ -27,11 +27,14 @@ setTimeout(function() { } } document.querySelector("#slaves > #display").innerHTML = HTML - let graphs = document.querySelectorAll(".productionGraph"); - for(let i = 0; i < graphs.length; i++) { - // execute functions to make graphs - // ID of slave, ID of canvasjs div without # - makeGraph(graphs[i].id, graphs[i].id) + + if(JSON.parse(localStorage.settings)["Enable production graphs"]) { + let graphs = document.querySelectorAll(".productionGraph"); + for(let i = 0; i < graphs.length; i++) { + // execute functions to make graphs + // ID of slave, ID of canvasjs div without # + makeGraph(graphs[i].id, graphs[i].id) + } } } }