diff --git a/library/Notifications/Common/Icons.php b/library/Notifications/Common/Icons.php index 5a7a4d220..d63fecad2 100644 --- a/library/Notifications/Common/Icons.php +++ b/library/Notifications/Common/Icons.php @@ -39,4 +39,6 @@ private function __construct() public const NOTIFIED = 'paper-plane'; public const RULE_MATCHED = 'filter'; + + public const UNDEFINED = 'notdef'; } diff --git a/library/Notifications/Widget/Detail/IncidentDetail.php b/library/Notifications/Widget/Detail/IncidentDetail.php index 010239319..9780ad284 100644 --- a/library/Notifications/Widget/Detail/IncidentDetail.php +++ b/library/Notifications/Widget/Detail/IncidentDetail.php @@ -4,7 +4,6 @@ namespace Icinga\Module\Notifications\Widget\Detail; -use Icinga\Module\Notifications\Common\Database; use Icinga\Module\Notifications\Model\Incident; use Icinga\Module\Notifications\Model\Objects; use Icinga\Module\Notifications\Widget\EventSourceBadge; @@ -15,8 +14,6 @@ use ipl\Html\Html; use ipl\Html\HtmlElement; use ipl\Html\Table; -use ipl\Orm\Query; -use ipl\Sql\Select; use ipl\Web\Widget\Link; use ipl\Web\Widget\StateBall; @@ -93,28 +90,22 @@ protected function createRelatedObject() protected function createHistory() { - $history = $this->incident->incident_history - ->with([ - 'event', - 'event.object', - 'event.object.source', - 'contact', - 'rule', - 'rule_escalation', - 'contactgroup', - 'schedule', - 'channel' - ]); - - $history - ->withColumns('event.object.id_tags') - ->on(Query::ON_SELECT_ASSEMBLED, function (Select $select) use ($history) { - Database::registerGroupBy($history, $select); - }); - return [ Html::tag('h2', t('Incident History')), - new IncidentHistoryList($history) + new IncidentHistoryList( + $this->incident->incident_history + ->with([ + 'event', + 'event.object', + 'event.object.source', + 'contact', + 'rule', + 'rule_escalation', + 'contactgroup', + 'schedule', + 'channel' + ]) + ) ]; } diff --git a/library/Notifications/Widget/IconBall.php b/library/Notifications/Widget/IconBall.php index 08b5af957..41cfa15da 100644 --- a/library/Notifications/Widget/IconBall.php +++ b/library/Notifications/Widget/IconBall.php @@ -13,7 +13,7 @@ class IconBall extends BaseHtmlElement protected $defaultAttributes = ['class' => ['icon-ball']]; - public function __construct(string $name, ?string $style = null) + public function __construct(string $name, ?string $style = 'fa-solid') { $icon = new Icon($name); if ($style !== null) { diff --git a/library/Notifications/Widget/ItemList/IncidentHistoryListItem.php b/library/Notifications/Widget/ItemList/IncidentHistoryListItem.php index 1e8b6e7de..69a6ca24b 100644 --- a/library/Notifications/Widget/ItemList/IncidentHistoryListItem.php +++ b/library/Notifications/Widget/ItemList/IncidentHistoryListItem.php @@ -28,29 +28,10 @@ class IncidentHistoryListItem extends BaseListItem protected function assembleVisual(BaseHtmlElement $visual): void { $incidentIcon = $this->getIncidentEventIcon(); - if ($incidentIcon === '') { - $content = new IconBall('ellipsis', 'fa-solid'); + if ($this->item->type === 'incident_severity_changed') { + $content = new Icon($incidentIcon, ['class' => 'severity-' . $this->item->new_severity]); } else { - switch ($this->item->type) { - case 'incident_severity_changed': - $content = new Icon($incidentIcon, ['class' => 'severity-' . $this->item->new_severity]); - - break; - case 'rule_matched': - case 'opened': - case 'closed': - $content = new IconBall($incidentIcon); - - break; - case 'notified': - case 'escalation_triggered': - case 'recipient_role_changed': - $content = new IconBall($incidentIcon, 'fa-solid'); - - break; - default: - $content = new IconBall('ellipsis', 'fa-solid'); - } + $content = new IconBall($incidentIcon); } $visual->addHtml($content); @@ -93,8 +74,10 @@ protected function getIncidentEventIcon(): string return Icons::RULE_MATCHED; case 'escalation_triggered': return Icons::TRIGGERED; - default: + case 'notified': return Icons::NOTIFIED; + default: + return Icons::UNDEFINED; } } @@ -103,12 +86,14 @@ protected function getSeverityIcon(): string switch ($this->item->new_severity) { case 'ok': return Icons::OK; + case 'warning': + return Icons::WARNING; case 'err': return Icons::ERROR; case 'crit': return Icons::CRITICAL; default: - return Icons::WARNING; + return Icons::UNDEFINED; } } @@ -128,7 +113,7 @@ protected function getRoleIcon(): string } } - return ''; + return Icons::UNDEFINED; } } diff --git a/public/css/common.less b/public/css/common.less index 242369c45..6924c3063 100644 --- a/public/css/common.less +++ b/public/css/common.less @@ -54,11 +54,11 @@ margin-top: 0.15em; } - i.icon:before { + i.icon::before { font-size: 0.6em; } - i.icon.fa-paper-plane:before { + i.icon.fa-paper-plane::before { margin-right: .2em; } }