diff --git a/application/controllers/ChannelsController.php b/application/controllers/ChannelsController.php index 1e87254a..b55d1eda 100644 --- a/application/controllers/ChannelsController.php +++ b/application/controllers/ChannelsController.php @@ -4,7 +4,6 @@ namespace Icinga\Module\Notifications\Controllers; -use Icinga\Module\Notifications\Common\BaseItemList; use Icinga\Module\Notifications\Common\Database; use Icinga\Module\Notifications\Forms\ChannelForm; use Icinga\Module\Notifications\Model\Channel; @@ -16,6 +15,7 @@ use ipl\Html\ValidHtml; use ipl\Sql\Connection; use ipl\Stdlib\Filter; +use ipl\Web\Common\BaseItemList; use ipl\Web\Compat\CompatController; use ipl\Web\Compat\SearchControls; use ipl\Web\Control\LimitControl; diff --git a/application/controllers/ContactsController.php b/application/controllers/ContactsController.php index c2e1e29e..c15742ed 100644 --- a/application/controllers/ContactsController.php +++ b/application/controllers/ContactsController.php @@ -5,7 +5,6 @@ namespace Icinga\Module\Notifications\Controllers; use Icinga\Module\Notifications\Web\Control\SearchBar\ObjectSuggestions; -use Icinga\Module\Notifications\Common\BaseItemList; use Icinga\Module\Notifications\Common\Database; use Icinga\Module\Notifications\Model\Contact; use Icinga\Module\Notifications\Web\Form\ContactForm; @@ -13,6 +12,7 @@ use Icinga\Web\Notification; use ipl\Sql\Connection; use ipl\Stdlib\Filter; +use ipl\Web\Common\BaseItemList; use ipl\Web\Compat\CompatController; use ipl\Web\Compat\SearchControls; use ipl\Web\Control\LimitControl; diff --git a/library/Notifications/Common/BaseItemList.php b/library/Notifications/Common/BaseItemList.php deleted file mode 100644 index f261730f..00000000 --- a/library/Notifications/Common/BaseItemList.php +++ /dev/null @@ -1,76 +0,0 @@ - 'item-list', - 'data-base-target' => '_next', - 'data-pdfexport-page-breaks-at' => '.list-item' - ]; - - protected $tag = 'ul'; - - /** @var iterable */ - protected $data; - - /** - * Create a new item list - * - * @param iterable $data Data source of the list - */ - public function __construct($data) - { - if (! is_iterable($data)) { - throw new InvalidArgumentException('Data must be an array or an instance of Traversable'); - } - - $this->data = $data; - - $this->addAttributes($this->baseAttributes); - $this->getAttributes() - ->registerAttributeCallback('class', function () { - return 'action-list'; - }); - - $this->init(); - } - - /** - * Initialize the item list - * - * If you want to adjust the item list after construction, override this method. - */ - protected function init(): void - { - } - - abstract protected function getItemClass(): string; - - protected function assemble() - { - $itemClass = $this->getItemClass(); - - foreach ($this->data as $data) { - /** @var BaseListItem $item */ - $item = new $itemClass($data, $this); - - $this->add($item); - } - - if ($this->isEmpty()) { - $this->setTag('div'); - $this->add(new EmptyState(t('No items found.'))); - } - } -} diff --git a/library/Notifications/Common/BaseListItem.php b/library/Notifications/Common/BaseListItem.php deleted file mode 100644 index a6162707..00000000 --- a/library/Notifications/Common/BaseListItem.php +++ /dev/null @@ -1,132 +0,0 @@ - 'list-item']; - - /** @var object The associated list item */ - protected $item; - - /** @var BaseItemList The list where the item is part of */ - protected $list; - - protected $tag = 'li'; - - /** - * Create a new list item - * - * @param object $item - * @param BaseItemList $list - */ - public function __construct($item, BaseItemList $list) - { - $this->item = $item; - $this->list = $list; - - $this->addAttributes($this->baseAttributes); - - $this->init(); - } - - /** - * Initialize the list item - * - * If you want to adjust the list item after construction, override this method. - */ - protected function init(): void - { - } - - abstract protected function assembleHeader(BaseHtmlElement $header): void; - - abstract protected function assembleMain(BaseHtmlElement $main): void; - - protected function assembleFooter(BaseHtmlElement $footer): void - { - } - - protected function assembleCaption(BaseHtmlElement $caption) - { - } - - protected function assembleTitle(BaseHtmlElement $title): void - { - } - - protected function assembleVisual(BaseHtmlElement $visual): void - { - } - - protected function createCaption(): BaseHtmlElement - { - $caption = Html::tag('section', ['class' => 'caption']); - - $this->assembleCaption($caption); - - return $caption; - } - - protected function createHeader(): BaseHtmlElement - { - $header = Html::tag('header'); - - $this->assembleHeader($header); - - return $header; - } - - protected function createMain(): BaseHtmlElement - { - $main = Html::tag('div', ['class' => 'main']); - - $this->assembleMain($main); - - return $main; - } - - protected function createFooter(): BaseHtmlElement - { - $footer = new HtmlElement('footer'); - - $this->assembleFooter($footer); - - return $footer; - } - - protected function createTitle(): BaseHtmlElement - { - $title = HTML::tag('div', ['class' => 'title']); - - $this->assembleTitle($title); - - return $title; - } - - protected function createVisual(): ?BaseHtmlElement - { - $visual = Html::tag('div', ['class' => 'visual']); - - $this->assembleVisual($visual); - - return $visual; - } - - protected function assemble() - { - $this->add([ - $this->createVisual(), - $this->createMain() - ]); - } -} diff --git a/library/Notifications/Model/Event.php b/library/Notifications/Model/Event.php index 09f58b3d..4d34f215 100644 --- a/library/Notifications/Model/Event.php +++ b/library/Notifications/Model/Event.php @@ -8,8 +8,14 @@ use ipl\Orm\Behavior\MillisecondTimestamp; use ipl\Orm\Behaviors; use ipl\Orm\Model; +use ipl\Orm\Query; use ipl\Orm\Relations; +/** + * Event model + * + * @property Query|Incident $incident + */ class Event extends Model { public function getTableName() diff --git a/library/Notifications/Model/Incident.php b/library/Notifications/Model/Incident.php index acb5f64e..fcf08fc1 100644 --- a/library/Notifications/Model/Incident.php +++ b/library/Notifications/Model/Incident.php @@ -10,6 +10,11 @@ use ipl\Orm\Model; use ipl\Orm\Relations; +/** + * Incident Model + * + * @property int $id + */ class Incident extends Model { public function getTableName() diff --git a/library/Notifications/Widget/Detail/EventDetail.php b/library/Notifications/Widget/Detail/EventDetail.php index b96275e0..0a67d2b6 100644 --- a/library/Notifications/Widget/Detail/EventDetail.php +++ b/library/Notifications/Widget/Detail/EventDetail.php @@ -6,9 +6,11 @@ use Icinga\Date\DateFormatter; use Icinga\Module\Notifications\Model\Event; +use Icinga\Module\Notifications\Model\Incident; use Icinga\Module\Notifications\Model\Objects; use Icinga\Module\Notifications\Widget\EventSourceBadge; use Icinga\Module\Notifications\Widget\ItemList\IncidentList; +use InvalidArgumentException; use ipl\Html\BaseHtmlElement; use ipl\Html\Html; use ipl\Html\ValidHtml; @@ -21,6 +23,9 @@ class EventDetail extends BaseHtmlElement /** @var Event */ protected $event; + /** @var Incident */ + protected $incident; + protected $defaultAttributes = [ 'class' => 'event-detail', 'data-pdfexport-page-breaks-at' => 'h2' @@ -30,7 +35,12 @@ class EventDetail extends BaseHtmlElement public function __construct(Event $event) { + if (! $event->incident instanceof Incident) { + throw new InvalidArgumentException('Incidents must be loaded with the event'); + } + $this->event = $event; + $this->incident = $event->incident; } /** @return ValidHtml[] */ @@ -107,13 +117,13 @@ protected function createRelatedObject(): array /** @return ValidHtml[]|null */ protected function createIncident(): ?array { - if ($this->event->incident->id === null) { + if ($this->incident->id === null) { return null; } return [ Html::tag('h2', t('Incident')), - new IncidentList([$this->event->incident]) + new IncidentList([$this->incident]) ]; } diff --git a/library/Notifications/Widget/EmptyState.php b/library/Notifications/Widget/EmptyState.php deleted file mode 100644 index 294450c3..00000000 --- a/library/Notifications/Widget/EmptyState.php +++ /dev/null @@ -1,27 +0,0 @@ - 'empty-state']; - - public function __construct($content) - { - $this->content = $content; - } - - protected function assemble() - { - $this->add($this->content); - } -} diff --git a/library/Notifications/Widget/ItemList/ChannelList.php b/library/Notifications/Widget/ItemList/ChannelList.php index f0e72898..25e97e09 100644 --- a/library/Notifications/Widget/ItemList/ChannelList.php +++ b/library/Notifications/Widget/ItemList/ChannelList.php @@ -4,14 +4,14 @@ namespace Icinga\Module\Notifications\Widget\ItemList; -use Icinga\Module\Notifications\Common\BaseItemList; +use ipl\Web\Common\BaseItemList; /** * A channel list */ class ChannelList extends BaseItemList { - protected $defaultAttributes = ['class' => 'channel-list']; + protected $defaultAttributes = ['class' => ['action-list', 'channel-list']]; protected function getItemClass(): string { diff --git a/library/Notifications/Widget/ItemList/ChannelListItem.php b/library/Notifications/Widget/ItemList/ChannelListItem.php index 47b8b766..4881eea1 100644 --- a/library/Notifications/Widget/ItemList/ChannelListItem.php +++ b/library/Notifications/Widget/ItemList/ChannelListItem.php @@ -4,9 +4,9 @@ namespace Icinga\Module\Notifications\Widget\ItemList; -use Icinga\Module\Notifications\Common\BaseListItem; use Icinga\Module\Notifications\Model\Channel; use ipl\Html\BaseHtmlElement; +use ipl\Web\Common\BaseListItem; use ipl\Web\Url; use ipl\Web\Widget\Icon; use ipl\Web\Widget\Link; diff --git a/library/Notifications/Widget/ItemList/ContactList.php b/library/Notifications/Widget/ItemList/ContactList.php index 936aeb79..7735a115 100644 --- a/library/Notifications/Widget/ItemList/ContactList.php +++ b/library/Notifications/Widget/ItemList/ContactList.php @@ -4,11 +4,11 @@ namespace Icinga\Module\Notifications\Widget\ItemList; -use Icinga\Module\Notifications\Common\BaseItemList; +use ipl\Web\Common\BaseItemList; class ContactList extends BaseItemList { - protected $defaultAttributes = ['class' => 'contact-list']; + protected $defaultAttributes = ['class' => ['action-list', 'contact-list']]; protected function getItemClass(): string { diff --git a/library/Notifications/Widget/ItemList/ContactListItem.php b/library/Notifications/Widget/ItemList/ContactListItem.php index b73cbab1..151d411b 100644 --- a/library/Notifications/Widget/ItemList/ContactListItem.php +++ b/library/Notifications/Widget/ItemList/ContactListItem.php @@ -4,12 +4,12 @@ namespace Icinga\Module\Notifications\Widget\ItemList; -use Icinga\Module\Notifications\Common\BaseListItem; use Icinga\Module\Notifications\Model\Contact; use ipl\Html\Attributes; use ipl\Html\BaseHtmlElement; use ipl\Html\HtmlElement; use ipl\Html\Text; +use ipl\Web\Common\BaseListItem; use ipl\Web\Url; use ipl\Web\Widget\Icon; use ipl\Web\Widget\Link; diff --git a/library/Notifications/Widget/ItemList/EventList.php b/library/Notifications/Widget/ItemList/EventList.php index 550c35a2..2ef47006 100644 --- a/library/Notifications/Widget/ItemList/EventList.php +++ b/library/Notifications/Widget/ItemList/EventList.php @@ -5,16 +5,16 @@ namespace Icinga\Module\Notifications\Widget\ItemList; use Icinga\Module\Notifications\Common\LoadMore; -use Icinga\Module\Notifications\Common\BaseItemList; use Icinga\Module\Notifications\Common\NoSubjectLink; use ipl\Orm\ResultSet; +use ipl\Web\Common\BaseItemList; class EventList extends BaseItemList { use LoadMore; use NoSubjectLink; - protected $defaultAttributes = ['class' => 'event-list']; + protected $defaultAttributes = ['class' => ['action-list', 'event-list']]; /** @var ResultSet */ protected $data; diff --git a/library/Notifications/Widget/ItemList/EventListItem.php b/library/Notifications/Widget/ItemList/EventListItem.php index 51bd09b9..5e6f691e 100644 --- a/library/Notifications/Widget/ItemList/EventListItem.php +++ b/library/Notifications/Widget/ItemList/EventListItem.php @@ -4,13 +4,15 @@ namespace Icinga\Module\Notifications\Widget\ItemList; -use Icinga\Module\Notifications\Common\BaseListItem; use Icinga\Module\Notifications\Common\Links; use Icinga\Module\Notifications\Model\Event; +use Icinga\Module\Notifications\Model\Incident; use Icinga\Module\Notifications\Model\Objects; use Icinga\Module\Notifications\Widget\SourceIcon; +use InvalidArgumentException; use ipl\Html\BaseHtmlElement; use ipl\Html\Html; +use ipl\Web\Common\BaseListItem; use ipl\Web\Widget\Icon; use ipl\Web\Widget\Link; use ipl\Web\Widget\TimeAgo; @@ -23,11 +25,20 @@ class EventListItem extends BaseListItem /** @var Event The associated list item */ protected $item; + /** @var Incident The related incident */ + protected $incident; + /** @var EventList The list where the item is part of */ protected $list; protected function init(): void { + if (! $this->item->incident instanceof Incident) { + throw new InvalidArgumentException('Incidents must be loaded with the event'); + } else { + $this->incident = $this->item->incident; + } + if (! $this->list->getNoSubjectLink()) { $this->getAttributes() ->set('data-action-item', true); @@ -76,8 +87,8 @@ protected function assembleVisual(BaseHtmlElement $visual): void protected function assembleTitle(BaseHtmlElement $title): void { - if ($this->item->incident->id !== null) { - $title->addHtml(Html::tag('span', [], sprintf('#%d:', $this->item->incident->id))); + if ($this->incident->id !== null) { + $title->addHtml(Html::tag('span', [], sprintf('#%d:', $this->incident->id))); } /** @var Objects $obj */ @@ -102,7 +113,7 @@ protected function assembleTitle(BaseHtmlElement $title): void $title->addHtml(Html::tag('span', ['class' => 'state'], $msg)); } - protected function assembleCaption(BaseHtmlElement $caption) + protected function assembleCaption(BaseHtmlElement $caption): void { $caption->add($this->item->message); } diff --git a/library/Notifications/Widget/ItemList/EventRuleList.php b/library/Notifications/Widget/ItemList/EventRuleList.php index 78d7d68d..533448fc 100644 --- a/library/Notifications/Widget/ItemList/EventRuleList.php +++ b/library/Notifications/Widget/ItemList/EventRuleList.php @@ -5,14 +5,13 @@ namespace Icinga\Module\Notifications\Widget\ItemList; use Icinga\Module\Notifications\Common\LoadMore; -use Icinga\Module\Notifications\Common\BaseItemList; -use ipl\Orm\ResultSet; +use ipl\Web\Common\BaseItemList; class EventRuleList extends BaseItemList { use LoadMore; - protected $defaultAttributes = ['class' => 'event-rule-list']; + protected $defaultAttributes = ['class' => ['action-list', 'event-rule-list']]; protected function getItemClass(): string { diff --git a/library/Notifications/Widget/ItemList/EventRuleListItem.php b/library/Notifications/Widget/ItemList/EventRuleListItem.php index 59eefa31..cb4127a0 100644 --- a/library/Notifications/Widget/ItemList/EventRuleListItem.php +++ b/library/Notifications/Widget/ItemList/EventRuleListItem.php @@ -4,13 +4,13 @@ namespace Icinga\Module\Notifications\Widget\ItemList; -use Icinga\Module\Notifications\Common\BaseListItem; use Icinga\Module\Notifications\Common\Links; use Icinga\Module\Notifications\Model\Rule; use Icinga\Module\Notifications\Widget\CheckboxIcon; use Icinga\Module\Notifications\Widget\RuleEscalationRecipientBadge; use ipl\Html\BaseHtmlElement; use ipl\Html\Html; +use ipl\Web\Common\BaseListItem; use ipl\Web\Widget\Icon; use ipl\Web\Widget\Link; diff --git a/library/Notifications/Widget/ItemList/IncidentContactList.php b/library/Notifications/Widget/ItemList/IncidentContactList.php index f4917a73..93cee140 100644 --- a/library/Notifications/Widget/ItemList/IncidentContactList.php +++ b/library/Notifications/Widget/ItemList/IncidentContactList.php @@ -4,11 +4,11 @@ namespace Icinga\Module\Notifications\Widget\ItemList; -use Icinga\Module\Notifications\Common\BaseItemList; +use ipl\Web\Common\BaseItemList; class IncidentContactList extends BaseItemList { - protected $defaultAttributes = ['class' => ['minimal', 'incident-contact-list']]; + protected $defaultAttributes = ['class' => ['action-list', 'minimal', 'incident-contact-list']]; protected function getItemClass(): string { diff --git a/library/Notifications/Widget/ItemList/IncidentContactListItem.php b/library/Notifications/Widget/ItemList/IncidentContactListItem.php index bea649c1..1f885045 100644 --- a/library/Notifications/Widget/ItemList/IncidentContactListItem.php +++ b/library/Notifications/Widget/ItemList/IncidentContactListItem.php @@ -4,11 +4,11 @@ namespace Icinga\Module\Notifications\Widget\ItemList; -use Icinga\Module\Notifications\Common\BaseListItem; use Icinga\Module\Notifications\Common\Icons; use Icinga\Module\Notifications\Model\Contact; use ipl\Html\BaseHtmlElement; use ipl\Html\Html; +use ipl\Web\Common\BaseListItem; use ipl\Web\Url; use ipl\Web\Widget\Icon; use ipl\Web\Widget\Link; diff --git a/library/Notifications/Widget/ItemList/IncidentHistoryList.php b/library/Notifications/Widget/ItemList/IncidentHistoryList.php index b002dcb6..cbd6ac42 100644 --- a/library/Notifications/Widget/ItemList/IncidentHistoryList.php +++ b/library/Notifications/Widget/ItemList/IncidentHistoryList.php @@ -4,11 +4,11 @@ namespace Icinga\Module\Notifications\Widget\ItemList; -use Icinga\Module\Notifications\Common\BaseItemList; +use ipl\Web\Common\BaseItemList; class IncidentHistoryList extends BaseItemList { - protected $defaultAttributes = ['class' => 'minimal']; + protected $defaultAttributes = ['class' => ['action-list', 'minimal']]; protected function getItemClass(): string { diff --git a/library/Notifications/Widget/ItemList/IncidentHistoryListItem.php b/library/Notifications/Widget/ItemList/IncidentHistoryListItem.php index 4c4c765e..dc39e748 100644 --- a/library/Notifications/Widget/ItemList/IncidentHistoryListItem.php +++ b/library/Notifications/Widget/ItemList/IncidentHistoryListItem.php @@ -4,7 +4,6 @@ namespace Icinga\Module\Notifications\Widget\ItemList; -use Icinga\Module\Notifications\Common\BaseListItem; use Icinga\Module\Notifications\Common\Icons; use Icinga\Module\Notifications\Common\Links; use Icinga\Module\Notifications\Model\Event; @@ -13,6 +12,7 @@ use Icinga\Module\Notifications\Widget\SourceIcon; use ipl\Html\BaseHtmlElement; use ipl\Web\Widget\IcingaIcon; +use ipl\Web\Common\BaseListItem; use ipl\Web\Widget\Icon; use ipl\Web\Widget\Link; use ipl\Web\Widget\TimeAgo; @@ -63,7 +63,7 @@ protected function assembleTitle(BaseHtmlElement $title): void } } - protected function assembleCaption(BaseHtmlElement $caption) + protected function assembleCaption(BaseHtmlElement $caption): void { $caption->add($this->buildMessage()); } diff --git a/library/Notifications/Widget/ItemList/IncidentList.php b/library/Notifications/Widget/ItemList/IncidentList.php index 1968ea2d..9992f1d5 100644 --- a/library/Notifications/Widget/ItemList/IncidentList.php +++ b/library/Notifications/Widget/ItemList/IncidentList.php @@ -4,14 +4,14 @@ namespace Icinga\Module\Notifications\Widget\ItemList; -use Icinga\Module\Notifications\Common\BaseItemList; +use ipl\Web\Common\BaseItemList; use Icinga\Module\Notifications\Common\NoSubjectLink; class IncidentList extends BaseItemList { use NoSubjectLink; - protected $defaultAttributes = ['class' => 'incident-list']; + protected $defaultAttributes = ['class' => ['action-list', 'incident-list']]; protected function getItemClass(): string { diff --git a/library/Notifications/Widget/ItemList/IncidentListItem.php b/library/Notifications/Widget/ItemList/IncidentListItem.php index 6893c4f0..57df92ca 100644 --- a/library/Notifications/Widget/ItemList/IncidentListItem.php +++ b/library/Notifications/Widget/ItemList/IncidentListItem.php @@ -5,12 +5,12 @@ namespace Icinga\Module\Notifications\Widget\ItemList; use Icinga\Module\Notifications\Common\Icons; -use Icinga\Module\Notifications\Common\BaseListItem; use Icinga\Module\Notifications\Common\Links; use Icinga\Module\Notifications\Model\Incident; use Icinga\Module\Notifications\Model\Objects; use ipl\Html\BaseHtmlElement; use ipl\Html\Html; +use ipl\Web\Common\BaseListItem; use ipl\Web\Widget\Icon; use ipl\Web\Widget\Link; use ipl\Web\Widget\TimeAgo; diff --git a/phpstan-baseline-standard.neon b/phpstan-baseline-standard.neon index 7ed8cdc1..013b84df 100644 --- a/phpstan-baseline-standard.neon +++ b/phpstan-baseline-standard.neon @@ -215,11 +215,6 @@ parameters: count: 1 path: application/controllers/IncidentController.php - - - message: "#^Parameter \\#1 \\$id of static method Icinga\\\\Module\\\\Notifications\\\\Common\\\\Links\\:\\:incident\\(\\) expects int, mixed given\\.$#" - count: 1 - path: application/controllers/IncidentController.php - - message: "#^Parameter \\#2 \\$currentUserId of class Icinga\\\\Module\\\\Notifications\\\\Widget\\\\Detail\\\\IncidentQuickActions constructor expects int, mixed given\\.$#" count: 1 @@ -635,41 +630,6 @@ parameters: count: 1 path: application/forms/ScheduleForm.php - - - message: "#^Method Icinga\\\\Module\\\\Notifications\\\\Common\\\\BaseItemList\\:\\:__construct\\(\\) has parameter \\$data with no value type specified in iterable type iterable\\.$#" - count: 1 - path: library/Notifications/Common/BaseItemList.php - - - - message: "#^Method Icinga\\\\Module\\\\Notifications\\\\Common\\\\BaseItemList\\:\\:assemble\\(\\) has no return type specified\\.$#" - count: 1 - path: library/Notifications/Common/BaseItemList.php - - - - message: "#^Property Icinga\\\\Module\\\\Notifications\\\\Common\\\\BaseItemList\\:\\:\\$baseAttributes has no type specified\\.$#" - count: 1 - path: library/Notifications/Common/BaseItemList.php - - - - message: "#^Property Icinga\\\\Module\\\\Notifications\\\\Common\\\\BaseItemList\\:\\:\\$data type has no value type specified in iterable type iterable\\.$#" - count: 1 - path: library/Notifications/Common/BaseItemList.php - - - - message: "#^Method Icinga\\\\Module\\\\Notifications\\\\Common\\\\BaseListItem\\:\\:assemble\\(\\) has no return type specified\\.$#" - count: 1 - path: library/Notifications/Common/BaseListItem.php - - - - message: "#^Method Icinga\\\\Module\\\\Notifications\\\\Common\\\\BaseListItem\\:\\:assembleCaption\\(\\) has no return type specified\\.$#" - count: 1 - path: library/Notifications/Common/BaseListItem.php - - - - message: "#^Property Icinga\\\\Module\\\\Notifications\\\\Common\\\\BaseListItem\\:\\:\\$baseAttributes has no type specified\\.$#" - count: 1 - path: library/Notifications/Common/BaseListItem.php - - message: "#^Argument of an invalid type array\\|null supplied for foreach, only iterables are supported\\.$#" count: 1 @@ -1320,11 +1280,6 @@ parameters: count: 1 path: library/Notifications/Widget/CheckboxIcon.php - - - message: "#^Cannot access property \\$id on mixed\\.$#" - count: 1 - path: library/Notifications/Widget/Detail/EventDetail.php - - message: "#^Cannot access property \\$source on mixed\\.$#" count: 1 @@ -1405,26 +1360,11 @@ parameters: count: 1 path: library/Notifications/Widget/Detail/IncidentQuickActions.php - - - message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:equal\\(\\) expects array\\|bool\\|float\\|int\\|string, mixed given\\.$#" - count: 1 - path: library/Notifications/Widget/Detail/IncidentQuickActions.php - - message: "#^Property Icinga\\\\Module\\\\Notifications\\\\Widget\\\\Detail\\\\IncidentQuickActions\\:\\:\\$incidentContact \\(Icinga\\\\Module\\\\Notifications\\\\Model\\\\IncidentContact\\) does not accept ipl\\\\Orm\\\\Model\\.$#" count: 1 path: library/Notifications/Widget/Detail/IncidentQuickActions.php - - - message: "#^Method Icinga\\\\Module\\\\Notifications\\\\Widget\\\\EmptyState\\:\\:__construct\\(\\) has parameter \\$content with no type specified\\.$#" - count: 1 - path: library/Notifications/Widget/EmptyState.php - - - - message: "#^Method Icinga\\\\Module\\\\Notifications\\\\Widget\\\\EmptyState\\:\\:assemble\\(\\) has no return type specified\\.$#" - count: 1 - path: library/Notifications/Widget/EmptyState.php - - message: "#^Method Icinga\\\\Module\\\\Notifications\\\\Widget\\\\Escalations\\:\\:addEscalation\\(\\) has no return type specified\\.$#" count: 1 @@ -1555,11 +1495,6 @@ parameters: count: 1 path: library/Notifications/Widget/ItemList/EventList.php - - - message: "#^Cannot access property \\$id on mixed\\.$#" - count: 2 - path: library/Notifications/Widget/ItemList/EventListItem.php - - message: "#^Cannot access property \\$source on mixed\\.$#" count: 1 @@ -1570,11 +1505,6 @@ parameters: count: 1 path: library/Notifications/Widget/ItemList/EventListItem.php - - - message: "#^Method Icinga\\\\Module\\\\Notifications\\\\Widget\\\\ItemList\\\\EventListItem\\:\\:assembleCaption\\(\\) has no return type specified\\.$#" - count: 1 - path: library/Notifications/Widget/ItemList/EventListItem.php - - message: "#^Parameter \\#1 \\$id of static method Icinga\\\\Module\\\\Notifications\\\\Common\\\\Links\\:\\:event\\(\\) expects int, mixed given\\.$#" count: 1 @@ -1625,11 +1555,6 @@ parameters: count: 1 path: library/Notifications/Widget/ItemList/IncidentHistoryListItem.php - - - message: "#^Method Icinga\\\\Module\\\\Notifications\\\\Widget\\\\ItemList\\\\IncidentHistoryListItem\\:\\:assembleCaption\\(\\) has no return type specified\\.$#" - count: 1 - path: library/Notifications/Widget/ItemList/IncidentHistoryListItem.php - - message: "#^Method Icinga\\\\Module\\\\Notifications\\\\Widget\\\\ItemList\\\\IncidentHistoryListItem\\:\\:buildMessage\\(\\) should return string but returns mixed\\.$#" count: 1 @@ -1655,16 +1580,6 @@ parameters: count: 2 path: library/Notifications/Widget/ItemList/IncidentListItem.php - - - message: "#^Parameter \\#1 \\$id of static method Icinga\\\\Module\\\\Notifications\\\\Common\\\\Links\\:\\:incident\\(\\) expects int, mixed given\\.$#" - count: 1 - path: library/Notifications/Widget/ItemList/IncidentListItem.php - - - - message: "#^Parameter \\#2 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#" - count: 1 - path: library/Notifications/Widget/ItemList/IncidentListItem.php - - message: "#^Method Icinga\\\\Module\\\\Notifications\\\\Widget\\\\ItemList\\\\PageSeparatorItem\\:\\:assemble\\(\\) has no return type specified\\.$#" count: 1 diff --git a/public/css/list/item-list.less b/public/css/list/item-list.less index 66ebfc80..4125b105 100644 --- a/public/css/list/item-list.less +++ b/public/css/list/item-list.less @@ -1,70 +1,14 @@ -// Style - -.item-list { - list-style-type: none; - - > .empty-state { - .rounded-corners(); - background-color: @gray-lighter; - } -} - // Layout .item-list { - margin: 0; - padding: 0; - - .list-item { - display: flex; + .visual { + .icon { // TODO: should this be default in ipl-web? + font-size: 1.5em; - .main { - flex: 1 1 auto; - padding: .5em 0; - width: 0; - margin-left: .5em; - } - - .visual { - display: flex; - justify-content: center; - - .icon { - font-size: 1.5em; - - &:before { - margin-right: 0; - } - } - } - - header { - display: flex; - align-items: flex-start; - justify-content: space-between; - } - - .caption { - height: 3em; - text-overflow: ellipsis; - overflow: hidden; - - .line-clamp(); - - img { - max-height: 1em; + &:before { + margin-right: 0; } } - - footer { - display: flex; - justify-content: space-between; - } - } - - > .empty-state { - padding: 1em; - text-align: center; } } @@ -75,6 +19,7 @@ .list-item { align-items: center; + header { max-width: 100%; } @@ -94,28 +39,3 @@ } } } - -.item-list .list-item { - .title { - display: inline-flex; - align-items: baseline; - white-space: nowrap; - min-width: 0; - - > * { - margin: 0 .28125em; // 0 calculated   width - - &:first-child { - margin-left: 0; - } - - &:last-child { - margin-right: 0; - } - } - - .subject { - .text-ellipsis(); - } - } -} diff --git a/public/css/list/list-item.less b/public/css/list/list-item.less deleted file mode 100644 index 5d75d4ea..00000000 --- a/public/css/list/list-item.less +++ /dev/null @@ -1,64 +0,0 @@ -// Style - -.list-item { - color: @text-color-light; - - &:not(:first-child) > .main { - border-top: 1px solid @gray-light; - } - - &:not(:first-child) .visual { - margin-top: 1px; - } - - .title { - .subject { - color: @text-color; - } - - a { - font-weight: bold; - - &:hover { - color: @icinga-blue; - text-decoration: none; - } - } - } - - footer { - padding-top: .5em; - } -} - -@media print { - .list-item.page-break-follows + .list-item { - .main { - border-top: 1px solid transparent; - } - } -} - -// Layout - -.list-item { - .visual { - padding: .5em 0; - width: 2.5em; - } - - .title { - margin-right: 1em; - - p { - margin: 0; - } - } - - footer { - > * { - font-size: .857em; - line-height: 1.5*.857em; - } - } -} diff --git a/public/css/mixins.less b/public/css/mixins.less index 8e5ad934..d2463f6b 100644 --- a/public/css/mixins.less +++ b/public/css/mixins.less @@ -1,20 +1,3 @@ -.text-ellipsis() { - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} - -.line-clamp(@numOfLines: 2) when (@numOfLines > 1) { - display: -webkit-box; - -webkit-line-clamp: @numOfLines; - -webkit-box-orient: vertical; -} -.line-clamp(@numOfLines: 2) when (@numOfLines = "reset") { - display: block; // Would have used "revert", but browser support is still poor and it's not final yet - -webkit-line-clamp: initial; - -webkit-box-orient: initial; -} - .event-rule-button() { color: @icinga-blue; background: @low-sat-blue;