blob: 0e1580260489fc20db6c5e28e5ab99dee767e3aa (
plain) (
tree)
|
|
<?php
class StatisticsStyling
{
public static function ramColorClass(int $mb): string
{
if ($mb < 2500) {
return 'danger';
}
if ($mb < 5100) {
return 'warning';
}
return '';
}
public static function kvmColorClass(string $state): string
{
if ($state === 'DISABLED') {
return 'danger';
}
if ($state === 'UNKNOWN' || $state === 'UNSUPPORTED') {
return 'warning';
}
return '';
}
public static function hddColorClass(int $gb): string
{
if ($gb < 7) {
return 'danger';
}
if ($gb < 25) {
return 'warning';
}
return '';
}
/**
* Take a machine state enum value, return a matching glyphicon class.
* @param string $state State value (OFFLINE, IDLE, ...)
*/
public static function machineStateToIcon(string $state): string
{
switch ($state) {
case 'OFFLINE':
return 'glyphicon-off';
case 'IDLE':
return 'glyphicon-ok green';
case 'OCCUPIED':
return 'glyphicon-user red';
case 'STANDBY':
return 'glyphicon-off green';
default:
return 'glyphicon-question-sign';
}
}
}
|