mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-23 22:50:09 +03:00
Feature #2778: Set usage bar colors by class, instead of a hardcoded value
TODO: add the classes to the css
This commit is contained in:
parent
7a7529d10c
commit
b1d2f8e8e8
@ -3437,18 +3437,19 @@ function usageBarHtml(usage, limit, info_str, color){
|
||||
|
||||
info_str = info_str || ( usage+' / '+((limit > 0) ? limit : '-') );
|
||||
|
||||
var classes = "meter";
|
||||
if (color){
|
||||
var r = Math.min(parseInt(255 * percentage / 50), 255);
|
||||
var g = Math.min(parseInt(255 * (100 - percentage) / 50), 255);
|
||||
var b = 0;
|
||||
|
||||
var style='width: '+percentage+'%; background: rgb('+r+','+g+','+b+') !important';
|
||||
} else {
|
||||
var style='width: '+percentage+'%';
|
||||
if (percentage <= 20){
|
||||
classes += " usage-low";
|
||||
} else if (percentage >= 80){
|
||||
classes += " usage-high";
|
||||
} else {
|
||||
classes += " usage-mid";
|
||||
}
|
||||
}
|
||||
|
||||
html = '<div class="progress-container"><div class="progress secondary radius">\
|
||||
<span class="meter" style="'+style+'"></span></div>\
|
||||
<span class="'+classes+'" style="width: '+percentage+'%"></span></div>\
|
||||
<div class="progress-text">'+info_str+'</div></div>';
|
||||
|
||||
return html;
|
||||
|
Loading…
x
Reference in New Issue
Block a user