Skip to content

Commit

Permalink
Move source icon in incident detail to the header
Browse files Browse the repository at this point in the history
  • Loading branch information
raviks789 committed Apr 24, 2024
1 parent 0a3b06c commit 0777a12
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
}
Expand Down
11 changes: 11 additions & 0 deletions library/Notifications/Widget/ItemList/IncidentListItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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',
Expand Down
6 changes: 6 additions & 0 deletions public/css/list/incident-list.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.incident-list .list-item {
.source-icon {
margin-left: auto;
margin-right: 0.5em;
}
}

0 comments on commit 0777a12

Please sign in to comment.