Skip to content

Use new item list implementation #315

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
Apr 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
f973dfb
Introduce class ChannelRenderer and ObjectList
sukhwinder33445 Apr 2, 2025
5e9788c
Introduce class ContactRenderer
sukhwinder33445 Apr 2, 2025
7b3db01
Introduce class ContactgroupRenderer
sukhwinder33445 Apr 2, 2025
eea075f
Introduce classes EventRenderer, ObjectHeader and LoadMoreObjectList
sukhwinder33445 Apr 2, 2025
666c811
Introduce class IncidentRenderer
sukhwinder33445 Apr 3, 2025
a39e428
ObjectsRenderer: Use new ItemLayout class instead
sukhwinder33445 Apr 3, 2025
52b6759
Introduce class EventRuleRenderer
sukhwinder33445 Apr 3, 2025
4631db8
Introduce class ScheduleRenderer
sukhwinder33445 Apr 3, 2025
f28edb8
Introduce IncidentContactRenderer
sukhwinder33445 Apr 3, 2025
b85b833
Introduce IncidentHistoryRenderer
sukhwinder33445 Apr 7, 2025
7e83eb1
Introduce SourceRenderer
sukhwinder33445 Apr 7, 2025
475ed04
Controllers: Don't add css class `full-width`
sukhwinder33445 Apr 7, 2025
1c7b89a
Remove now superfluous css
sukhwinder33445 Apr 7, 2025
2e45fe8
ObjectList: Add php generics
sukhwinder33445 Apr 7, 2025
e23418a
Fix `add` button margin
sukhwinder33445 Apr 9, 2025
bdba639
Remove file `item-list.less`
sukhwinder33445 Apr 25, 2025
0ce43e3
Move Schedule class to detail and rename it to ScheduleDetail
sukhwinder33445 Apr 25, 2025
0b0bc57
ScheduleRenderer: Use `schedule` as css class
sukhwinder33445 Apr 25, 2025
db1946a
Schedules (list): Align the schedule header with list items
sukhwinder33445 Apr 25, 2025
574e8e1
Remove superfluous margin-right
sukhwinder33445 Apr 25, 2025
b0ff808
Cleanup phpstan baseline
sukhwinder33445 Apr 25, 2025
b5cd11e
Phpstan: Remove now obsolete version based baseline files
sukhwinder33445 Apr 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 12 additions & 28 deletions application/controllers/ChannelsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@
namespace Icinga\Module\Notifications\Controllers;

use Icinga\Module\Notifications\Common\Database;
use Icinga\Module\Notifications\Common\Links;
use Icinga\Module\Notifications\Forms\ChannelForm;
use Icinga\Module\Notifications\Model\Channel;
use Icinga\Module\Notifications\View\ChannelRenderer;
use Icinga\Module\Notifications\Web\Control\SearchBar\ObjectSuggestions;
use Icinga\Module\Notifications\Widget\ItemList\ChannelList;
use Icinga\Module\Notifications\Widget\ItemList\ObjectList;
use Icinga\Web\Notification;
use Icinga\Web\Widget\Tab;
use Icinga\Web\Widget\Tabs;
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;
use ipl\Web\Control\SortControl;
use ipl\Web\Filter\QueryString;
use ipl\Web\Url;
use ipl\Web\Layout\MinimalItemLayout;
use ipl\Web\Widget\ButtonLink;

class ChannelsController extends CompatController
Expand Down Expand Up @@ -85,15 +85,15 @@
$this->addControl($limitControl);
$this->addControl($searchBar);
$this->addContent(
(new ButtonLink(
t('Add Channel'),
Url::fromPath('notifications/channels/add'),
'plus'
))->setBaseTarget('_next')
->addAttributes(['class' => 'add-new-component'])
(new ButtonLink(t('Add Channel'), Links::channelAdd(), 'plus'))
->setBaseTarget('_next')
->addAttributes(['class' => 'add-new-component'])
);

$this->addContent(new ChannelList($channels));
$this->addContent(
(new ObjectList($channels, new ChannelRenderer()))
->setItemLayoutClass(MinimalItemLayout::class)
);

if (! $searchBar->hasBeenSubmitted() && $searchBar->hasBeenSent()) {
$this->sendMultipartUpdate();
Expand All @@ -112,29 +112,13 @@
$form->getValue('name')
)
);
$this->redirectNow(Url::fromPath('notifications/channels'));
$this->redirectNow(Links::channels());
})
->handleRequest($this->getServerRequest());

$this->addContent($form);
}

/**
* Add attribute 'class' => 'full-width' if the content is an instance of BaseItemList
*
* @param ValidHtml $content
*
* @return ChannelsController
*/
protected function addContent(ValidHtml $content)
{
if ($content instanceof BaseItemList) {
$this->content->getAttributes()->add('class', 'full-width');
}

return parent::addContent($content);
}

public function completeAction(): void
{
$suggestions = new ObjectSuggestions();
Expand Down Expand Up @@ -182,7 +166,7 @@
{
/** @var Tab $tab */
foreach ($tabs->getTabs() as $tab) {
$this->tabs->add($tab->getName(), $tab);

Check failure on line 169 in application/controllers/ChannelsController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.3 on ubuntu-latest

Parameter #1 $name of method ipl\Web\Widget\Tabs::add() expects string, string|null given.

Check failure on line 169 in application/controllers/ChannelsController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.1 on ubuntu-latest

Parameter #1 $name of method ipl\Web\Widget\Tabs::add() expects string, string|null given.

Check failure on line 169 in application/controllers/ChannelsController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.4 on ubuntu-latest

Parameter #1 $name of method ipl\Web\Widget\Tabs::add() expects string, string|null given.

Check failure on line 169 in application/controllers/ChannelsController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.2 on ubuntu-latest

Parameter #1 $name of method ipl\Web\Widget\Tabs::add() expects string, string|null given.

Check failure on line 169 in application/controllers/ChannelsController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.3 on ubuntu-latest

Parameter #1 $name of method ipl\Web\Widget\Tabs::add() expects string, string|null given.

Check failure on line 169 in application/controllers/ChannelsController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.0 on ubuntu-latest

Parameter #1 $name of method ipl\Web\Widget\Tabs::add() expects string, string|null given.

Check failure on line 169 in application/controllers/ChannelsController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.2 on ubuntu-latest

Parameter #1 $name of method ipl\Web\Widget\Tabs::add() expects string, string|null given.
}
}
}
2 changes: 0 additions & 2 deletions application/controllers/ConfigController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@

use Icinga\Application\Config;
use Icinga\Module\Notifications\Forms\DatabaseConfigForm;
use Icinga\Web\Form;
use Icinga\Web\Notification;
use Icinga\Web\Widget\Tab;
use Icinga\Web\Widget\Tabs;
use ipl\Html\HtmlString;
use ipl\Web\Compat\CompatController;

class ConfigController extends CompatController
Expand All @@ -28,7 +26,7 @@
$form = (new DatabaseConfigForm())
->populate($moduleConfig->getSection('database'))
->on(DatabaseConfigForm::ON_SUCCESS, function ($form) use ($moduleConfig) {
$moduleConfig->setSection('database', $form->getValues());

Check failure on line 29 in application/controllers/ConfigController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.3 on ubuntu-latest

Parameter #2 $config of method Icinga\Application\Config::setSection() expects array|Icinga\Data\ConfigObject|null, mixed given.

Check failure on line 29 in application/controllers/ConfigController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.3 on ubuntu-latest

Cannot call method getValues() on mixed.

Check failure on line 29 in application/controllers/ConfigController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.1 on ubuntu-latest

Parameter #2 $config of method Icinga\Application\Config::setSection() expects array|Icinga\Data\ConfigObject|null, mixed given.

Check failure on line 29 in application/controllers/ConfigController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.1 on ubuntu-latest

Cannot call method getValues() on mixed.

Check failure on line 29 in application/controllers/ConfigController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.4 on ubuntu-latest

Parameter #2 $config of method Icinga\Application\Config::setSection() expects array|Icinga\Data\ConfigObject|null, mixed given.

Check failure on line 29 in application/controllers/ConfigController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.4 on ubuntu-latest

Cannot call method getValues() on mixed.

Check failure on line 29 in application/controllers/ConfigController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.2 on ubuntu-latest

Parameter #2 $config of method Icinga\Application\Config::setSection() expects array|Icinga\Data\ConfigObject|null, mixed given.

Check failure on line 29 in application/controllers/ConfigController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.2 on ubuntu-latest

Cannot call method getValues() on mixed.

Check failure on line 29 in application/controllers/ConfigController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.0 on ubuntu-latest

Parameter #2 $config of method Icinga\Application\Config::setSection() expects array|Icinga\Data\ConfigObject|null, mixed given.

Check failure on line 29 in application/controllers/ConfigController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.0 on ubuntu-latest

Cannot call method getValues() on mixed.
$moduleConfig->saveIni();

Notification::success(t('New configuration has successfully been stored'));
Expand All @@ -50,7 +48,7 @@
{
/** @var Tab $tab */
foreach ($tabs->getTabs() as $tab) {
$this->tabs->add($tab->getName(), $tab);

Check failure on line 51 in application/controllers/ConfigController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.3 on ubuntu-latest

Parameter #1 $name of method ipl\Web\Widget\Tabs::add() expects string, string|null given.

Check failure on line 51 in application/controllers/ConfigController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.1 on ubuntu-latest

Parameter #1 $name of method ipl\Web\Widget\Tabs::add() expects string, string|null given.

Check failure on line 51 in application/controllers/ConfigController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.4 on ubuntu-latest

Parameter #1 $name of method ipl\Web\Widget\Tabs::add() expects string, string|null given.

Check failure on line 51 in application/controllers/ConfigController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.2 on ubuntu-latest

Parameter #1 $name of method ipl\Web\Widget\Tabs::add() expects string, string|null given.

Check failure on line 51 in application/controllers/ConfigController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.3 on ubuntu-latest

Parameter #1 $name of method ipl\Web\Widget\Tabs::add() expects string, string|null given.

Check failure on line 51 in application/controllers/ConfigController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.0 on ubuntu-latest

Parameter #1 $name of method ipl\Web\Widget\Tabs::add() expects string, string|null given.

Check failure on line 51 in application/controllers/ConfigController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.2 on ubuntu-latest

Parameter #1 $name of method ipl\Web\Widget\Tabs::add() expects string, string|null given.
}
}
}
4 changes: 0 additions & 4 deletions application/controllers/ContactController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,8 @@
namespace Icinga\Module\Notifications\Controllers;

use Icinga\Module\Notifications\Common\Database;
use Icinga\Module\Notifications\Model\Contact;
use Icinga\Module\Notifications\Web\Form\ContactForm;
use Icinga\Web\Notification;
use ipl\Html\FormElement\FieldsetElement;
use ipl\Sql\Connection;
use ipl\Stdlib\Filter;
use ipl\Web\Compat\CompatController;

class ContactController extends CompatController
Expand All @@ -25,7 +21,7 @@
$contactId = $this->params->getRequired('id');

$form = (new ContactForm(Database::get()))
->loadContact($contactId)

Check failure on line 24 in application/controllers/ContactController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.3 on ubuntu-latest

Parameter #1 $id of method Icinga\Module\Notifications\Web\Form\ContactForm::loadContact() expects int, mixed given.

Check failure on line 24 in application/controllers/ContactController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.1 on ubuntu-latest

Parameter #1 $id of method Icinga\Module\Notifications\Web\Form\ContactForm::loadContact() expects int, mixed given.

Check failure on line 24 in application/controllers/ContactController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.4 on ubuntu-latest

Parameter #1 $id of method Icinga\Module\Notifications\Web\Form\ContactForm::loadContact() expects int, mixed given.

Check failure on line 24 in application/controllers/ContactController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.2 on ubuntu-latest

Parameter #1 $id of method Icinga\Module\Notifications\Web\Form\ContactForm::loadContact() expects int, mixed given.

Check failure on line 24 in application/controllers/ContactController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.3 on ubuntu-latest

Parameter #1 $id of method Icinga\Module\Notifications\Web\Form\ContactForm::loadContact() expects int, mixed given.

Check failure on line 24 in application/controllers/ContactController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.0 on ubuntu-latest

Parameter #1 $id of method Icinga\Module\Notifications\Web\Form\ContactForm::loadContact() expects int, mixed given.

Check failure on line 24 in application/controllers/ContactController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.2 on ubuntu-latest

Parameter #1 $id of method Icinga\Module\Notifications\Web\Form\ContactForm::loadContact() expects int, mixed given.
->on(ContactForm::ON_SUCCESS, function (ContactForm $form) {
$form->editContact();
Notification::success(sprintf(
Expand Down
21 changes: 7 additions & 14 deletions application/controllers/ContactGroupController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,16 @@
use Icinga\Module\Notifications\Forms\ContactGroupForm;
use Icinga\Module\Notifications\Model\Contact;
use Icinga\Module\Notifications\Model\Contactgroup;
use Icinga\Module\Notifications\Model\ContactgroupMember;
use Icinga\Module\Notifications\Widget\ItemList\ContactList;
use Icinga\Module\Notifications\View\ContactRenderer;
use Icinga\Module\Notifications\Widget\ItemList\ObjectList;
use Icinga\Web\Notification;
use ipl\Html\Attributes;
use ipl\Html\Form;
use ipl\Html\HtmlElement;
use ipl\Html\Text;
use ipl\Html\ValidHtml;
use ipl\Stdlib\Filter;
use ipl\Web\Common\BaseItemList;
use ipl\Web\Compat\CompatController;
use ipl\Web\Layout\MinimalItemLayout;
use ipl\Web\Widget\ButtonLink;

class ContactGroupController extends CompatController
Expand All @@ -35,7 +34,7 @@

$query = Contactgroup::on(Database::get())
->columns(['id', 'name'])
->filter(Filter::equal('id', $groupId));

Check failure on line 37 in application/controllers/ContactGroupController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.3 on ubuntu-latest

Parameter #2 $value of static method ipl\Stdlib\Filter::equal() expects array<mixed>|bool|float|int|string, mixed given.

Check failure on line 37 in application/controllers/ContactGroupController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.1 on ubuntu-latest

Parameter #2 $value of static method ipl\Stdlib\Filter::equal() expects array<mixed>|bool|float|int|string, mixed given.

Check failure on line 37 in application/controllers/ContactGroupController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.4 on ubuntu-latest

Parameter #2 $value of static method ipl\Stdlib\Filter::equal() expects array<mixed>|bool|float|int|string, mixed given.

Check failure on line 37 in application/controllers/ContactGroupController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.2 on ubuntu-latest

Parameter #2 $value of static method ipl\Stdlib\Filter::equal() expects array<mixed>|bool|float|int|string, mixed given.

Check failure on line 37 in application/controllers/ContactGroupController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.3 on ubuntu-latest

Parameter #2 $value of static method ipl\Stdlib\Filter::equal() expects array|bool|float|int|string, mixed given.

Check failure on line 37 in application/controllers/ContactGroupController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.0 on ubuntu-latest

Parameter #2 $value of static method ipl\Stdlib\Filter::equal() expects array<mixed>|bool|float|int|string, mixed given.

Check failure on line 37 in application/controllers/ContactGroupController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.2 on ubuntu-latest

Parameter #2 $value of static method ipl\Stdlib\Filter::equal() expects array|bool|float|int|string, mixed given.

$group = $query->first();
if ($group === null) {
Expand All @@ -44,11 +43,11 @@

$this->controls->addAttributes(['class' => 'contactgroup-detail']);

$this->addControl(new HtmlElement('div', new Attributes(['class' => 'header']), Text::create($group->name)));

Check failure on line 46 in application/controllers/ContactGroupController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.3 on ubuntu-latest

Parameter #1 $content of static method ipl\Html\Text::create() expects string, mixed given.

Check failure on line 46 in application/controllers/ContactGroupController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.1 on ubuntu-latest

Parameter #1 $content of static method ipl\Html\Text::create() expects string, mixed given.

Check failure on line 46 in application/controllers/ContactGroupController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.4 on ubuntu-latest

Parameter #1 $content of static method ipl\Html\Text::create() expects string, mixed given.

Check failure on line 46 in application/controllers/ContactGroupController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.2 on ubuntu-latest

Parameter #1 $content of static method ipl\Html\Text::create() expects string, mixed given.

Check failure on line 46 in application/controllers/ContactGroupController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.3 on ubuntu-latest

Parameter #1 $content of static method ipl\Html\Text::create() expects string, mixed given.

Check failure on line 46 in application/controllers/ContactGroupController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.0 on ubuntu-latest

Parameter #1 $content of static method ipl\Html\Text::create() expects string, mixed given.

Check failure on line 46 in application/controllers/ContactGroupController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.2 on ubuntu-latest

Parameter #1 $content of static method ipl\Html\Text::create() expects string, mixed given.

$contacts = Contact::on(Database::get())
->filter(Filter::all(
Filter::equal('contactgroup_member.contactgroup_id', $groupId),

Check failure on line 50 in application/controllers/ContactGroupController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.3 on ubuntu-latest

Parameter #2 $value of static method ipl\Stdlib\Filter::equal() expects array<mixed>|bool|float|int|string, mixed given.

Check failure on line 50 in application/controllers/ContactGroupController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.1 on ubuntu-latest

Parameter #2 $value of static method ipl\Stdlib\Filter::equal() expects array<mixed>|bool|float|int|string, mixed given.

Check failure on line 50 in application/controllers/ContactGroupController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.4 on ubuntu-latest

Parameter #2 $value of static method ipl\Stdlib\Filter::equal() expects array<mixed>|bool|float|int|string, mixed given.

Check failure on line 50 in application/controllers/ContactGroupController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.2 on ubuntu-latest

Parameter #2 $value of static method ipl\Stdlib\Filter::equal() expects array<mixed>|bool|float|int|string, mixed given.

Check failure on line 50 in application/controllers/ContactGroupController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.3 on ubuntu-latest

Parameter #2 $value of static method ipl\Stdlib\Filter::equal() expects array|bool|float|int|string, mixed given.

Check failure on line 50 in application/controllers/ContactGroupController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.0 on ubuntu-latest

Parameter #2 $value of static method ipl\Stdlib\Filter::equal() expects array<mixed>|bool|float|int|string, mixed given.

Check failure on line 50 in application/controllers/ContactGroupController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.2 on ubuntu-latest

Parameter #2 $value of static method ipl\Stdlib\Filter::equal() expects array|bool|float|int|string, mixed given.
Filter::equal('contactgroup_member.deleted', 'n')
));

Expand All @@ -58,16 +57,19 @@
$this->addContent(
(new ButtonLink(
Text::create(t('Edit Contact Group')),
Links::contactGroupEdit($groupId)->with(['showCompact' => true, '_disableLayout' => 1]),

Check failure on line 60 in application/controllers/ContactGroupController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.3 on ubuntu-latest

Parameter #1 $id of static method Icinga\Module\Notifications\Common\Links::contactGroupEdit() expects int, mixed given.

Check failure on line 60 in application/controllers/ContactGroupController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.1 on ubuntu-latest

Parameter #1 $id of static method Icinga\Module\Notifications\Common\Links::contactGroupEdit() expects int, mixed given.

Check failure on line 60 in application/controllers/ContactGroupController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.4 on ubuntu-latest

Parameter #1 $id of static method Icinga\Module\Notifications\Common\Links::contactGroupEdit() expects int, mixed given.

Check failure on line 60 in application/controllers/ContactGroupController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.2 on ubuntu-latest

Parameter #1 $id of static method Icinga\Module\Notifications\Common\Links::contactGroupEdit() expects int, mixed given.

Check failure on line 60 in application/controllers/ContactGroupController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.3 on ubuntu-latest

Parameter #1 $id of static method Icinga\Module\Notifications\Common\Links::contactGroupEdit() expects int, mixed given.

Check failure on line 60 in application/controllers/ContactGroupController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.0 on ubuntu-latest

Parameter #1 $id of static method Icinga\Module\Notifications\Common\Links::contactGroupEdit() expects int, mixed given.

Check failure on line 60 in application/controllers/ContactGroupController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.2 on ubuntu-latest

Parameter #1 $id of static method Icinga\Module\Notifications\Common\Links::contactGroupEdit() expects int, mixed given.
'edit',
['class' => 'add-new-component']
))->openInModal()
);

$this->addContent(new ContactList($contacts));
$this->addContent(
(new ObjectList($contacts, new ContactRenderer()))
->setItemLayoutClass(MinimalItemLayout::class)
);

$this->addTitleTab(t('Contact Group'));
$this->setTitle(sprintf(t('Contact Group: %s'), $group->name));

Check failure on line 72 in application/controllers/ContactGroupController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.3 on ubuntu-latest

Parameter #2 ...$values of function sprintf expects bool|float|int|string|null, mixed given.

Check failure on line 72 in application/controllers/ContactGroupController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.2 on ubuntu-latest

Parameter #2 ...$values of function sprintf expects bool|float|int|string|null, mixed given.
}

public function editAction(): void
Expand All @@ -75,7 +77,7 @@
$groupId = $this->params->getRequired('id');

$form = (new ContactGroupForm(Database::get()))
->loadContactgroup($groupId)

Check failure on line 80 in application/controllers/ContactGroupController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.3 on ubuntu-latest

Parameter #1 $groupId of method Icinga\Module\Notifications\Forms\ContactGroupForm::loadContactgroup() expects int, mixed given.

Check failure on line 80 in application/controllers/ContactGroupController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.2 on ubuntu-latest

Parameter #1 $groupId of method Icinga\Module\Notifications\Forms\ContactGroupForm::loadContactgroup() expects int, mixed given.
->setAction(
(string) Links::contactGroupEdit($groupId)->with(['showCompact' => true, '_disableLayout' => 1])
)
Expand Down Expand Up @@ -111,13 +113,4 @@
$this->addContent($form);
$this->setTitle(t('Edit Contact Group'));
}

protected function addContent(ValidHtml $content): self
{
if ($content instanceof BaseItemList) {
$this->content->getAttributes()->add('class', 'full-width');
}

return parent::addContent($content);
}
}
20 changes: 7 additions & 13 deletions application/controllers/ContactGroupsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@
use Icinga\Module\Notifications\Common\Links;
use Icinga\Module\Notifications\Forms\ContactGroupForm;
use Icinga\Module\Notifications\Model\Contactgroup;
use Icinga\Module\Notifications\View\ContactgroupRenderer;
use Icinga\Module\Notifications\Web\Control\SearchBar\ObjectSuggestions;
use Icinga\Module\Notifications\Widget\ItemList\ContactGroupList;
use Icinga\Module\Notifications\Widget\ItemList\ObjectList;
use Icinga\Module\Notifications\Widget\MemberSuggestions;
use Icinga\Web\Notification;
use ipl\Html\Form;
use ipl\Html\Text;
use ipl\Html\ValidHtml;
use ipl\Stdlib\Filter;
use ipl\Web\Common\BaseItemList;
use ipl\Web\Compat\CompatController;
use ipl\Web\Compat\SearchControls;
use ipl\Web\Control\LimitControl;
use ipl\Web\Control\SortControl;
use ipl\Web\Filter\QueryString;
use ipl\Web\Layout\MinimalItemLayout;
use ipl\Web\Widget\ButtonLink;
use ipl\Web\Widget\Tabs;

Expand Down Expand Up @@ -87,7 +87,10 @@ public function indexAction(): void
))->openInModal()
);

$this->addContent(new ContactGroupList($groups));
$this->addContent(
(new ObjectList($groups, new ContactgroupRenderer()))
->setItemLayoutClass(MinimalItemLayout::class)
);

if (! $searchBar->hasBeenSubmitted() && $searchBar->hasBeenSent()) {
$this->sendMultipartUpdate();
Expand Down Expand Up @@ -178,15 +181,6 @@ public function getTabs(): Tabs
]);
}

protected function addContent(ValidHtml $content): self
{
if ($content instanceof BaseItemList) {
$this->content->getAttributes()->add('class', 'full-width');
}

return parent::addContent($content);
}

/**
* Get the filter created from query string parameters
*
Expand Down
36 changes: 10 additions & 26 deletions application/controllers/ContactsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@
namespace Icinga\Module\Notifications\Controllers;

use Icinga\Module\Notifications\Common\Links;
use Icinga\Module\Notifications\View\ContactRenderer;
use Icinga\Module\Notifications\Web\Control\SearchBar\ObjectSuggestions;
use Icinga\Module\Notifications\Common\Database;
use Icinga\Module\Notifications\Model\Contact;
use Icinga\Module\Notifications\Web\Form\ContactForm;
use Icinga\Module\Notifications\Widget\ItemList\ContactList;
use Icinga\Module\Notifications\Widget\ItemList\ObjectList;
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;
use ipl\Web\Control\SortControl;
use ipl\Web\Filter\QueryString;
use ipl\Web\Layout\MinimalItemLayout;
use ipl\Web\Widget\ButtonLink;
use ipl\Html\ValidHtml;

class ContactsController extends CompatController
{
Expand Down Expand Up @@ -80,15 +80,15 @@ public function indexAction()
$this->addControl($limitControl);
$this->addControl($searchBar);
$this->addContent(
(new ButtonLink(
t('Add Contact'),
'notifications/contacts/add',
'plus'
))->setBaseTarget('_next')
->addAttributes(['class' => 'add-new-component'])
(new ButtonLink(t('Add Contact'), Links::contactAdd(), 'plus'))
->setBaseTarget('_next')
->addAttributes(['class' => 'add-new-component'])
);

$this->addContent(new ContactList($contacts));
$this->addContent(
(new ObjectList($contacts, new ContactRenderer()))
->setItemLayoutClass(MinimalItemLayout::class)
);

if (! $searchBar->hasBeenSubmitted() && $searchBar->hasBeenSent()) {
$this->sendMultipartUpdate();
Expand All @@ -114,22 +114,6 @@ public function addAction(): void
$this->addContent($form);
}

/**
* Add attribute 'class' => 'full-width' if the content is an instance of BaseItemList
*
* @param ValidHtml $content
*
* @return ContactsController
*/
protected function addContent(ValidHtml $content)
{
if ($content instanceof BaseItemList) {
$this->content->getAttributes()->add('class', 'full-width');
}

return parent::addContent($content);
}

public function completeAction(): void
{
$suggestions = new ObjectSuggestions();
Expand Down
10 changes: 2 additions & 8 deletions application/controllers/EventController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@

namespace Icinga\Module\Notifications\Controllers;

use ArrayObject;
use Icinga\Module\Notifications\Common\Auth;
use Icinga\Module\Notifications\Common\Database;
use Icinga\Module\Notifications\Model\Event;
use Icinga\Module\Notifications\Widget\Detail\EventDetail;
use Icinga\Module\Notifications\Widget\ItemList\EventList;
use ipl\Orm\ResultSet;
use Icinga\Module\Notifications\Widget\Detail\ObjectHeader;
use ipl\Stdlib\Filter;
use ipl\Web\Compat\CompatController;

Expand Down Expand Up @@ -40,11 +38,7 @@ public function indexAction(): void
$this->httpNotFound(t('Event not found'));
}

$this->addControl(
(new EventList(new ResultSet(new ArrayObject([$event]))))
->setPageSize(1)
->setNoSubjectLink()
);
$this->addControl(new ObjectHeader($event));

$this->controls->addAttributes(['class' => 'event-detail']);

Expand Down
1 change: 0 additions & 1 deletion application/controllers/EventRuleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use Icinga\Module\Notifications\Common\Links;
use Icinga\Module\Notifications\Forms\EventRuleForm;
use Icinga\Module\Notifications\Forms\SaveEventRuleForm;
use Icinga\Module\Notifications\Model\Incident;
use Icinga\Module\Notifications\Model\Rule;
use Icinga\Module\Notifications\Web\Control\SearchBar\ExtraTagSuggestions;
use Icinga\Module\Notifications\Widget\EventRuleConfig;
Expand Down
11 changes: 8 additions & 3 deletions application/controllers/EventRulesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
use Icinga\Module\Notifications\Common\Links;
use Icinga\Module\Notifications\Forms\SaveEventRuleForm;
use Icinga\Module\Notifications\Model\Rule;
use Icinga\Module\Notifications\View\EventRuleRenderer;
use Icinga\Module\Notifications\Web\Control\SearchBar\ObjectSuggestions;
use Icinga\Module\Notifications\Widget\EventRuleConfig;
use Icinga\Module\Notifications\Widget\ItemList\EventRuleList;
use Icinga\Module\Notifications\Widget\ItemList\ObjectList;
use Icinga\Web\Notification;
use Icinga\Web\Session;
use ipl\Html\Html;
Expand All @@ -21,6 +22,7 @@
use ipl\Web\Control\SearchEditor;
use ipl\Web\Control\SortControl;
use ipl\Web\Filter\QueryString;
use ipl\Web\Layout\DetailedItemLayout;
use ipl\Web\Url;
use ipl\Web\Widget\ButtonLink;
use ipl\Web\Widget\Icon;
Expand Down Expand Up @@ -88,10 +90,13 @@ public function indexAction(): void
Url::fromPath('notifications/event-rule/edit', ['id' => -1, 'clearCache' => true]),
'plus'
))->openInModal()
->addAttributes(['class' => 'new-event-rule'])
->addAttributes(['class' => 'add-new-component'])
);

$this->addContent(new EventRuleList($eventRules));
$this->addContent(
(new ObjectList($eventRules, new EventRuleRenderer()))
->setItemLayoutClass(DetailedItemLayout::class)
);

if (! $searchBar->hasBeenSubmitted() && $searchBar->hasBeenSent()) {
$this->sendMultipartUpdate();
Expand Down
15 changes: 12 additions & 3 deletions application/controllers/EventsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,19 @@

use Icinga\Module\Notifications\Common\Auth;
use Icinga\Module\Notifications\Common\Database;
use Icinga\Module\Notifications\Hook\ObjectsRendererHook;
use Icinga\Module\Notifications\Web\Control\SearchBar\ObjectSuggestions;
use Icinga\Module\Notifications\Widget\ItemList\EventList;
use Icinga\Module\Notifications\Model\Event;
use Icinga\Module\Notifications\Widget\ItemList\LoadMoreObjectList;
use ipl\Stdlib\Filter;
use ipl\Web\Compat\CompatController;
use ipl\Web\Compat\SearchControls;
use ipl\Web\Control\LimitControl;
use ipl\Web\Control\SortControl;
use ipl\Web\Filter\QueryString;
use ipl\Web\Url;
use ipl\Web\Widget\ItemList;
use ipl\Web\Widget\ListItem;

class EventsController extends CompatController
{
Expand Down Expand Up @@ -83,9 +86,15 @@ public function indexAction(): void
$url = Url::fromRequest()->onlyWith($preserveParams);
$url->setQueryString(QueryString::render($filter) . '&' . $url->getParams()->toString());

$eventList = (new EventList($events->execute()))
$eventList = (new LoadMoreObjectList($events->execute()))
->setPageSize($limitControl->getLimit())
->setLoadMoreUrl($url->setParam('before', $before));
->setLoadMoreUrl($url->setParam('before', $before))
->on(ItemList::ON_ITEM_ADD, function (ListItem $item, Event $data) {
ObjectsRendererHook::register($data->object);
})
->on(ItemList::ON_ASSEMBLED, function () {
ObjectsRendererHook::load();
});

if ($compact) {
$eventList->setPageNumber($page);
Expand Down
Loading
Loading