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:
Jellyfrog
2020-11-11 01:15:20 +01:00
committed by GitHub
parent ac5920f45c
commit cfd9dce620
24 changed files with 363 additions and 237 deletions

View File

@@ -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'];
}
}
}