diff --git a/application/controllers/RedundancygroupController.php b/application/controllers/RedundancygroupController.php index 159b2e33c..cd3107fa2 100644 --- a/application/controllers/RedundancygroupController.php +++ b/application/controllers/RedundancygroupController.php @@ -304,8 +304,10 @@ private function fetchNodes(bool $fetchParents = false): Query ->with([ 'host', 'host.state', + 'host.state.last_comment', 'service', 'service.state', + 'service.state.last_comment', 'service.host', 'service.host.state' ]) diff --git a/library/Icingadb/Widget/ItemList/DependencyNodeList.php b/library/Icingadb/Widget/ItemList/DependencyNodeList.php index 04dfc6ffa..c95f883fa 100644 --- a/library/Icingadb/Widget/ItemList/DependencyNodeList.php +++ b/library/Icingadb/Widget/ItemList/DependencyNodeList.php @@ -5,6 +5,7 @@ namespace Icinga\Module\Icingadb\Widget\ItemList; use Icinga\Module\Icingadb\Model\DependencyNode; +use Icinga\Module\Icingadb\Model\Host; use Icinga\Module\Icingadb\Model\UnreachableParent; use ipl\Web\Common\BaseListItem; @@ -30,10 +31,23 @@ protected function createListItem(object $data): BaseListItem /** @var UnreachableParent|DependencyNode $data */ if ($data->redundancy_group_id !== null) { return new RedundancyGroupListItem($data->redundancy_group, $this); - } elseif ($data->service_id !== null) { - return new ServiceListItem($data->service, $this); - } else { - return new HostListItem($data->host, $this); } + + $object = $data->service_id !== null ? $data->service : $data->host; + + switch ($this->getViewMode()) { + case 'minimal': + $class = $object instanceof Host ? HostListItemMinimal::class : ServiceListItemMinimal::class; + break; + case 'detailed': + $this->removeAttribute('class', 'default-layout'); + + $class = $object instanceof Host ? HostListItemDetailed::class : ServiceListItemDetailed::class; + break; + default: + $class = $object instanceof Host ? HostListItem::class : ServiceListItem::class; + } + + return new $class($object, $this); } }