diff --git a/library/Notifications/Widget/ItemList/IncidentHistoryListItem.php b/library/Notifications/Widget/ItemList/IncidentHistoryListItem.php index dc39e748e..a94ea7d5c 100644 --- a/library/Notifications/Widget/ItemList/IncidentHistoryListItem.php +++ b/library/Notifications/Widget/ItemList/IncidentHistoryListItem.php @@ -76,11 +76,6 @@ protected function assembleHeader(BaseHtmlElement $header): void } $header->addHtml($this->createCaption()); - if ($this->item->type === 'opened' || $this->item->type === 'incident_severity_changed') { - $header->add( - (new SourceIcon(SourceIcon::SIZE_BIG))->addHtml($this->item->event->object->source->getIcon()) - ); - } $header->add(new TimeAgo($this->item->time->getTimestamp())); } diff --git a/library/Notifications/Widget/ItemList/IncidentListItem.php b/library/Notifications/Widget/ItemList/IncidentListItem.php index 57df92ca1..116a1ff2b 100644 --- a/library/Notifications/Widget/ItemList/IncidentListItem.php +++ b/library/Notifications/Widget/ItemList/IncidentListItem.php @@ -8,8 +8,11 @@ use Icinga\Module\Notifications\Common\Links; use Icinga\Module\Notifications\Model\Incident; use Icinga\Module\Notifications\Model\Objects; +use Icinga\Module\Notifications\Model\Source; +use Icinga\Module\Notifications\Widget\SourceIcon; use ipl\Html\BaseHtmlElement; use ipl\Html\Html; +use ipl\Orm\Query; use ipl\Web\Common\BaseListItem; use ipl\Web\Widget\Icon; use ipl\Web\Widget\Link; @@ -74,6 +77,14 @@ protected function assembleHeader(BaseHtmlElement $header): void { $header->add($this->createTitle()); + /** @var Source|Query $obj */ + $source = $this->item->object->source; + if ($source instanceof Query) { + $source = $source->first(); + } + + $header->add((new SourceIcon(SourceIcon::SIZE_BIG))->addHtml($source->getIcon())); + if ($this->item->recovered_at !== null) { $header->add(Html::tag( 'span', diff --git a/public/css/list/incident-list.less b/public/css/list/incident-list.less new file mode 100644 index 000000000..e7c987fc8 --- /dev/null +++ b/public/css/list/incident-list.less @@ -0,0 +1,6 @@ +.incident-list .list-item { + .source-icon { + margin-left: auto; + margin-right: 0.5em; + } +} \ No newline at end of file