From: Michael Tremer Date: Tue, 31 Oct 2023 11:51:07 +0000 (+0000) Subject: builders: Make statistics percentage value range from 0 - 1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b18d0bc9c935287b6bf684198e0c3950776e3612;p=pbs.git builders: Make statistics percentage value range from 0 - 1 Signed-off-by: Michael Tremer --- diff --git a/src/buildservice/builders.py b/src/buildservice/builders.py index 4cf1014c..c51c3a04 100644 --- a/src/buildservice/builders.py +++ b/src/buildservice/builders.py @@ -863,7 +863,7 @@ class BuilderStats(base.Object): """ Returns the CPU usage in percent """ - return 100 - self.data.cpu_idle + return 1 - self.data.cpu_idle @property def mem_usage(self): diff --git a/src/static/js/builders-stats.js b/src/static/js/builders-stats.js index 81d5efca..b65bd70f 100644 --- a/src/static/js/builders-stats.js +++ b/src/static/js/builders-stats.js @@ -15,15 +15,15 @@ $(".builders-stats").each(function() { // Updates the progressbar and sets a colour updateProgressBar = function(e, percentage) { // Set the value - e.val(percentage); + e.val(percentage * 100); // Remove all classes e.removeClass("is-dark is-light is-danger is-warning is-success"); - if (percentage >= 90) { + if (percentage >= 0.9) { e.addClass("is-danger"); - } else if (percentage >= 75) { + } else if (percentage >= 0.75) { e.addClass("is-warning"); } else {