]> git.ipfire.org Git - pbs.git/commitdiff
builders: Make statistics percentage value range from 0 - 1
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 31 Oct 2023 11:51:07 +0000 (11:51 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 31 Oct 2023 11:51:07 +0000 (11:51 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/buildservice/builders.py
src/static/js/builders-stats.js

index 4cf1014c01e25816b40e1b4ae2ffc092787a50e7..c51c3a04ae65c54c7ceb0cbd444db8ad0ea601c2 100644 (file)
@@ -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):
index 81d5efcaae042f6e0be29cd7daaf636cb6b1be18..b65bd70fa615f112ab8bb6533223a746e30653c8 100644 (file)
@@ -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 {