diff options
Diffstat (limited to 'modules-available/statistics/inc/statisticsstyling.inc.php')
-rw-r--r-- | modules-available/statistics/inc/statisticsstyling.inc.php | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/modules-available/statistics/inc/statisticsstyling.inc.php b/modules-available/statistics/inc/statisticsstyling.inc.php index 1fd1d326..0e158026 100644 --- a/modules-available/statistics/inc/statisticsstyling.inc.php +++ b/modules-available/statistics/inc/statisticsstyling.inc.php @@ -3,19 +3,19 @@ class StatisticsStyling { - public static function ramColorClass($mb) + public static function ramColorClass(int $mb): string { - if ($mb < 1500) { + if ($mb < 2500) { return 'danger'; } - if ($mb < 2500) { + if ($mb < 5100) { return 'warning'; } return ''; } - public static function kvmColorClass($state) + public static function kvmColorClass(string $state): string { if ($state === 'DISABLED') { return 'danger'; @@ -27,7 +27,7 @@ class StatisticsStyling return ''; } - public static function hddColorClass($gb) + public static function hddColorClass(int $gb): string { if ($gb < 7) { return 'danger'; @@ -39,4 +39,24 @@ class StatisticsStyling 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'; + } + } + }
\ No newline at end of file |