blob: 1843fe306ec9135709ccca069d917db8f83b1cbb (
plain) (
tree)
|
|
<?php
class StatisticsStyling
{
public static function ramColorClass($mb)
{
if ($mb < 2500) {
return 'danger';
}
if ($mb < 5100) {
return 'warning';
}
return '';
}
public static function kvmColorClass($state)
{
if ($state === 'DISABLED') {
return 'danger';
}
if ($state === 'UNKNOWN' || $state === 'UNSUPPORTED') {
return 'warning';
}
return '';
}
public static function hddColorClass($gb)
{
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';
}
}
}
|