Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
raviks789 committed Apr 23, 2024
1 parent 0a3b06c commit 8357989
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
2 changes: 1 addition & 1 deletion application/controllers/IncidentsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function indexAction(): void
$this->addTitleTab(t('Incidents'));

$incidents = Incident::on(Database::get())
->with('object');
->with(['object']);

$limitControl = $this->createLimitControl();
$sortControl = $this->createSortControl(
Expand Down
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
13 changes: 13 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,16 @@ 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 8357989

Please sign in to comment.