From b18bc644404e02b57635bfcc8258e85abb141146 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 13 Apr 2024 13:44:46 +0200 Subject: Adding upstream version 1.1.1. Signed-off-by: Daniel Baumann --- .../Widget/ItemList/BaseServiceListItem.php | 70 ++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 library/Icingadb/Widget/ItemList/BaseServiceListItem.php (limited to 'library/Icingadb/Widget/ItemList/BaseServiceListItem.php') diff --git a/library/Icingadb/Widget/ItemList/BaseServiceListItem.php b/library/Icingadb/Widget/ItemList/BaseServiceListItem.php new file mode 100644 index 0000000..fe4f014 --- /dev/null +++ b/library/Icingadb/Widget/ItemList/BaseServiceListItem.php @@ -0,0 +1,70 @@ +item->display_name; + $host = [ + new StateBall($this->item->host->state->getStateText(), StateBall::SIZE_MEDIUM), + ' ', + $this->item->host->display_name + ]; + + $host = new Link($host, Links::host($this->item->host), ['class' => 'subject']); + if ($this->getNoSubjectLink()) { + $service = new HtmlElement('span', Attributes::create(['class' => 'subject']), Text::create($service)); + } else { + $service = new Link($service, Links::service($this->item, $this->item->host), ['class' => 'subject']); + } + + return [Html::sprintf(t('%s on %s', ' on '), $service, $host)]; + } + + protected function init(): void + { + parent::init(); + + if ($this->list->getNoSubjectLink()) { + $this->setNoSubjectLink(); + } + + $this->list->addMultiselectFilterAttribute( + $this, + Filter::all( + Filter::equal('service.name', $this->item->name), + Filter::equal('host.name', $this->item->host->name) + ) + ); + $this->list->addDetailFilterAttribute( + $this, + Filter::all( + Filter::equal('name', $this->item->name), + Filter::equal('host.name', $this->item->host->name) + ) + ); + } +} -- cgit v1.2.3