mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Convert Virtual Machine pages to Laravel (#12287)
* Convert Virtual Machine pages to Laravel * wip * wip * wip * wip * wip * wip * delete * wip * wip * move powerStateLabel
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
namespace LibreNMS\Util;
|
||||
|
||||
use LibreNMS\Config;
|
||||
use LibreNMS\Enum\PowerState;
|
||||
|
||||
class Html
|
||||
{
|
||||
@@ -154,4 +155,23 @@ class Html
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int|string $state
|
||||
*/
|
||||
public static function powerStateLabel($state): array
|
||||
{
|
||||
$state = is_string($state) ? PowerState::STATES[$state] : $state;
|
||||
|
||||
switch ($state) {
|
||||
case PowerState::OFF:
|
||||
return ['OFF', 'label-default'];
|
||||
case PowerState::ON:
|
||||
return ['ON', 'label-success'];
|
||||
case PowerState::SUSPENDED:
|
||||
return ['SUSPENDED', 'label-warning'];
|
||||
default:
|
||||
return ['UNKNOWN', 'label-default'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user