diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 12:36:40 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 12:36:40 +0000 |
commit | a0901c4b7f2db488cb4fb3be2dd921a0308f4659 (patch) | |
tree | fafb393cf330a60df129ff10d0059eb7b14052a7 /library/Icingadb/Widget/ItemTable/ServiceRowItem.php | |
parent | Initial commit. (diff) | |
download | icingadb-web-a0901c4b7f2db488cb4fb3be2dd921a0308f4659.tar.xz icingadb-web-a0901c4b7f2db488cb4fb3be2dd921a0308f4659.zip |
Adding upstream version 1.0.2.upstream/1.0.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'library/Icingadb/Widget/ItemTable/ServiceRowItem.php')
-rw-r--r-- | library/Icingadb/Widget/ItemTable/ServiceRowItem.php | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/library/Icingadb/Widget/ItemTable/ServiceRowItem.php b/library/Icingadb/Widget/ItemTable/ServiceRowItem.php new file mode 100644 index 0000000..0fb95d0 --- /dev/null +++ b/library/Icingadb/Widget/ItemTable/ServiceRowItem.php @@ -0,0 +1,64 @@ +<?php + +/* Icinga DB Web | (c) 2022 Icinga GmbH | GPLv2 */ + +namespace Icinga\Module\Icingadb\Widget\ItemTable; + +use Icinga\Module\Icingadb\Common\Links; +use Icinga\Module\Icingadb\Model\Service; +use ipl\Html\BaseHtmlElement; +use ipl\Stdlib\Filter; +use ipl\Web\Widget\Link; + +class ServiceRowItem extends StateRowItem +{ + /** @var ServiceItemTable */ + protected $list; + + /** @var Service */ + protected $item; + + protected function init() + { + parent::init(); + + $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) + ) + ); + } + + protected function assembleCell(BaseHtmlElement $cell, string $path, $value) + { + switch ($path) { + case 'name': + case 'display_name': + $cell->addHtml(new Link( + $this->item->$path, + Links::service($this->item, $this->item->host), + [ + 'class' => 'subject', + 'title' => $this->item->$path + ] + )); + break; + case 'host.name': + case 'host.display_name': + $column = substr($path, 5); + $cell->addHtml(new Link($this->item->host->$column, Links::host($this->item->host))); + break; + default: + parent::assembleCell($cell, $path, $value); + } + } +} |