Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 2 additions & 3 deletions application/controllers/ContactGroupController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@
use Icinga\Module\Notifications\Model\Contact;
use Icinga\Module\Notifications\Model\Contactgroup;
use Icinga\Module\Notifications\View\ContactRenderer;
use Icinga\Module\Notifications\Widget\Detail\ObjectHeader;
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\Stdlib\Filter;
use ipl\Web\Compat\CompatController;
Expand All @@ -34,7 +33,7 @@

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

Check failure on line 36 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 36 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 36 in application/controllers/ContactGroupController.php

View workflow job for this annotation

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

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

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

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

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

Check failure on line 45 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 $object of class Icinga\Module\Notifications\Widget\Detail\ObjectHeader constructor expects Item of Icinga\Module\Notifications\Model\Event|Icinga\Module\Notifications\Model\Incident, ipl\Orm\Model given.

Check failure on line 45 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 $object of class Icinga\Module\Notifications\Widget\Detail\ObjectHeader constructor expects Item of Icinga\Module\Notifications\Model\Event|Icinga\Module\Notifications\Model\Incident, ipl\Orm\Model given.

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

View workflow job for this annotation

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

Parameter #1 $object of class Icinga\Module\Notifications\Widget\Detail\ObjectHeader constructor expects Item of Icinga\Module\Notifications\Model\Event|Icinga\Module\Notifications\Model\Incident, ipl\Orm\Model given.

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

Check failure on line 49 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 49 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 49 in application/controllers/ContactGroupController.php

View workflow job for this annotation

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

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

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

Check failure on line 59 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 59 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 59 in application/controllers/ContactGroupController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.4 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()
Expand Down
6 changes: 5 additions & 1 deletion library/Notifications/View/ContactgroupRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ public function assembleVisual($item, HtmlDocument $visual, string $layout): voi

public function assembleTitle($item, HtmlDocument $title, string $layout): void
{
$title->addHtml(new Link($item->name, Links::contactGroup($item->id), ['class' => 'subject']));
if ($layout === 'header') {
$title->addHtml(new HtmlElement('span', new Attributes(['class' => 'subject']), Text::create($item->name)));
} else {
$title->addHtml(new Link($item->name, Links::contactGroup($item->id), ['class' => 'subject']));
}
}

public function assembleCaption($item, HtmlDocument $caption, string $layout): void
Expand Down
6 changes: 6 additions & 0 deletions library/Notifications/Widget/Detail/ObjectHeader.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
namespace Icinga\Module\Notifications\Widget\Detail;

use Icinga\Exception\NotImplementedError;
use Icinga\Module\Notifications\Model\Contactgroup;
use Icinga\Module\Notifications\Model\Event;
use Icinga\Module\Notifications\Model\Incident;
use Icinga\Module\Notifications\View\ContactgroupRenderer;
use Icinga\Module\Notifications\View\EventRenderer;
use Icinga\Module\Notifications\View\IncidentRenderer;
use ipl\Html\BaseHtmlElement;
Expand Down Expand Up @@ -50,6 +52,10 @@ protected function assemble(): void
case $this->object instanceof Incident:
$renderer = new IncidentRenderer();

break;
case $this->object instanceof Contactgroup:
$renderer = new ContactgroupRenderer();

break;
default:
throw new NotImplementedError('Not implemented');
Expand Down
Loading