2019-10-31 09:28:31 -04:00
|
|
|
<?php
|
|
|
|
|
|
2020-03-13 03:38:01 -04:00
|
|
|
/* Icinga DB Web | (c) 2020 Icinga GmbH | GPLv2 */
|
|
|
|
|
|
2019-11-04 19:07:30 -05:00
|
|
|
namespace Icinga\Module\Icingadb\Widget;
|
2019-10-31 09:28:31 -04:00
|
|
|
|
2019-11-25 03:18:22 -05:00
|
|
|
use Icinga\Module\Icingadb\Common\Links;
|
|
|
|
|
use Icinga\Module\Icingadb\Common\ServiceStates;
|
2023-07-20 03:36:36 -04:00
|
|
|
use Icinga\Module\Icingadb\Common\StateBadges;
|
2021-09-22 04:21:15 -04:00
|
|
|
use ipl\Web\Url;
|
2019-10-31 09:28:31 -04:00
|
|
|
|
|
|
|
|
class ServiceStateBadges extends StateBadges
|
|
|
|
|
{
|
2021-09-22 04:21:15 -04:00
|
|
|
protected function getBaseUrl(): Url
|
2019-11-25 03:18:22 -05:00
|
|
|
{
|
|
|
|
|
return Links::services();
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-12 07:11:49 -05:00
|
|
|
protected function getType(): string
|
|
|
|
|
{
|
|
|
|
|
return 'service';
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-22 04:21:15 -04:00
|
|
|
protected function getPrefix(): string
|
2019-10-31 09:28:31 -04:00
|
|
|
{
|
|
|
|
|
return 'services';
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-22 04:21:15 -04:00
|
|
|
protected function getStateInt(string $state): int
|
2019-11-25 03:18:22 -05:00
|
|
|
{
|
|
|
|
|
return ServiceStates::int($state);
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-31 09:28:31 -04:00
|
|
|
protected function assemble()
|
|
|
|
|
{
|
2020-11-24 08:03:24 -05:00
|
|
|
$this->addAttributes(['class' => 'service-state-badges']);
|
|
|
|
|
|
2019-10-31 09:28:31 -04:00
|
|
|
$this->add(array_filter([
|
|
|
|
|
$this->createGroup('critical'),
|
|
|
|
|
$this->createGroup('warning'),
|
|
|
|
|
$this->createGroup('unknown'),
|
|
|
|
|
$this->createBadge('ok'),
|
|
|
|
|
$this->createBadge('pending')
|
|
|
|
|
]));
|
|
|
|
|
}
|
|
|
|
|
}
|