From 23c267b6c5a6fd6fe5041562c7c8a5ad1454d75d Mon Sep 17 00:00:00 2001 From: Xaver Maierhofer Date: Sat, 7 Jan 2017 16:09:35 +0100 Subject: [PATCH] [TASK] One loadavg per core --- lib/infobox/node.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/infobox/node.js b/lib/infobox/node.js index 337ca41..5b3994a 100644 --- a/lib/infobox/node.js +++ b/lib/infobox/node.js @@ -149,18 +149,15 @@ define(["chroma-js", "moment/moment", "tablesort", "helper", "moment/locale/de"] return span; } - function showLoadBar(v) { + function showLoadBar(v, p) { var span = document.createElement("span"); span.classList.add("bar"); var bar = document.createElement("span"); - if (v >= 1) { - bar.style.width = ((v * 100) % 100) + "%"; + bar.style.width = ((v * 100) % 100) + "%"; + if (v >= p) { span.classList.add("warning"); } - else { - bar.style.width = (v * 100) + "%"; - } span.appendChild(bar); var label = document.createElement("label"); @@ -176,7 +173,7 @@ define(["chroma-js", "moment/moment", "tablesort", "helper", "moment/locale/de"] } return function (el) { - el.appendChild(showLoadBar(d.statistics.loadavg.toFixed(2))); + el.appendChild(showLoadBar(d.statistics.loadavg.toFixed(2), d.nodeinfo.hardware.nproc)); }; }