mirror of
https://github.com/Icinga/icingadb-web.git
synced 2026-05-28 04:36:06 -04:00
StateBadges: Prepend base table name to state filters
This commit is contained in:
parent
4f156b76dc
commit
8b7e83fbb2
3 changed files with 30 additions and 3 deletions
|
|
@ -19,6 +19,9 @@ abstract class StateBadges extends BaseHtmlElement
|
|||
/** @var object $item */
|
||||
protected $item;
|
||||
|
||||
/** @var string */
|
||||
protected $type;
|
||||
|
||||
/** @var string Prefix */
|
||||
protected $prefix;
|
||||
|
||||
|
|
@ -37,6 +40,7 @@ abstract class StateBadges extends BaseHtmlElement
|
|||
public function __construct($item)
|
||||
{
|
||||
$this->item = $item;
|
||||
$this->type = $this->getType();
|
||||
$this->prefix = $this->getPrefix();
|
||||
$this->url = $this->getBaseUrl();
|
||||
}
|
||||
|
|
@ -48,6 +52,13 @@ abstract class StateBadges extends BaseHtmlElement
|
|||
*/
|
||||
abstract protected function getBaseUrl(): Url;
|
||||
|
||||
/**
|
||||
* Get the type of the items
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
abstract protected function getType(): string;
|
||||
|
||||
/**
|
||||
* Get the prefix for accessing state information
|
||||
*
|
||||
|
|
@ -125,7 +136,7 @@ abstract class StateBadges extends BaseHtmlElement
|
|||
if (isset($this->item->$key) && $this->item->$key) {
|
||||
return Html::tag('li', $this->createLink(
|
||||
new StateBadge($this->item->$key, $state),
|
||||
['state.soft_state' => $this->getStateInt($state)]
|
||||
[$this->type . '.state.soft_state' => $this->getStateInt($state)]
|
||||
));
|
||||
}
|
||||
|
||||
|
|
@ -148,14 +159,20 @@ abstract class StateBadges extends BaseHtmlElement
|
|||
if (isset($this->item->$unhandledKey) && $this->item->$unhandledKey) {
|
||||
$content[] = Html::tag('li', $this->createLink(
|
||||
new StateBadge($this->item->$unhandledKey, $state),
|
||||
['state.soft_state' => $this->getStateInt($state), 'state.is_handled' => 'n']
|
||||
[
|
||||
$this->type . '.state.soft_state' => $this->getStateInt($state),
|
||||
$this->type . '.state.is_handled' => 'n'
|
||||
]
|
||||
));
|
||||
}
|
||||
|
||||
if (isset($this->item->$handledKey) && $this->item->$handledKey) {
|
||||
$content[] = Html::tag('li', $this->createLink(
|
||||
new StateBadge($this->item->$handledKey, $state, true),
|
||||
['state.soft_state' => $this->getStateInt($state), 'state.is_handled' => 'y']
|
||||
[
|
||||
$this->type . '.state.soft_state' => $this->getStateInt($state),
|
||||
$this->type . '.state.is_handled' => 'y'
|
||||
]
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,11 @@ class HostStateBadges extends StateBadges
|
|||
return Links::hosts();
|
||||
}
|
||||
|
||||
protected function getType(): string
|
||||
{
|
||||
return 'host';
|
||||
}
|
||||
|
||||
protected function getPrefix(): string
|
||||
{
|
||||
return 'hosts';
|
||||
|
|
|
|||
|
|
@ -16,6 +16,11 @@ class ServiceStateBadges extends StateBadges
|
|||
return Links::services();
|
||||
}
|
||||
|
||||
protected function getType(): string
|
||||
{
|
||||
return 'service';
|
||||
}
|
||||
|
||||
protected function getPrefix(): string
|
||||
{
|
||||
return 'services';
|
||||
|
|
|
|||
Loading…
Reference in a new issue