Skip to content

Commit

Permalink
Fix active list item handling
Browse files Browse the repository at this point in the history
  • Loading branch information
raviks789 committed Jun 20, 2024
1 parent ba627b4 commit 3e84c7a
Show file tree
Hide file tree
Showing 12 changed files with 64 additions and 4 deletions.
7 changes: 7 additions & 0 deletions library/Notifications/Widget/ItemList/ContactGroupList.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Icinga\Module\Notifications\Widget\ItemList;

use ipl\Web\Common\BaseItemList;
use ipl\Web\Url;

class ContactGroupList extends BaseItemList
{
Expand All @@ -14,4 +15,10 @@ protected function getItemClass(): string
{
return ContactGroupListItem::class;
}

protected function init(): void
{
$this->getAttributes()
->set('data-icinga-detail-url', (string) Url::fromPath('notifications/contact-group'));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
use ipl\Html\BaseHtmlElement;
use ipl\Html\HtmlElement;
use ipl\Html\Text;
use ipl\Stdlib\Filter;
use ipl\Web\Common\BaseListItem;
use ipl\Web\Filter\QueryString;
use ipl\Web\Widget\Link;

class ContactGroupListItem extends BaseListItem
Expand All @@ -23,7 +25,9 @@ class ContactGroupListItem extends BaseListItem

protected function init(): void
{
$this->getAttributes()->set('data-action-item', true);
$this->getAttributes()
->set('data-action-item', true)
->set('data-icinga-detail-filter', QueryString::render(Filter::equal('id', $this->item->id)));
}

protected function assembleVisual(BaseHtmlElement $visual): void
Expand Down
7 changes: 7 additions & 0 deletions library/Notifications/Widget/ItemList/ContactList.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Icinga\Module\Notifications\Widget\ItemList;

use ipl\Web\Common\BaseItemList;
use ipl\Web\Url;

class ContactList extends BaseItemList
{
Expand All @@ -14,4 +15,10 @@ protected function getItemClass(): string
{
return ContactListItem::class;
}

protected function init(): void
{
$this->getAttributes()
->set('data-icinga-detail-url', (string) Url::fromPath('notifications/contact'));
}
}
5 changes: 4 additions & 1 deletion library/Notifications/Widget/ItemList/ContactListItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
use ipl\Html\BaseHtmlElement;
use ipl\Html\HtmlElement;
use ipl\Html\Text;
use ipl\Stdlib\Filter;
use ipl\Web\Common\BaseListItem;
use ipl\Web\Filter\QueryString;
use ipl\Web\Url;
use ipl\Web\Widget\Icon;
use ipl\Web\Widget\Link;
Expand All @@ -28,7 +30,8 @@ class ContactListItem extends BaseListItem
protected function init(): void
{
$this->getAttributes()
->set('data-action-item', true);
->set('data-action-item', true)
->set('data-icinga-detail-filter', QueryString::render(Filter::equal('id', $this->item->id)));
}

protected function assembleVisual(BaseHtmlElement $visual): void
Expand Down
5 changes: 5 additions & 0 deletions library/Notifications/Widget/ItemList/EventList.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@

namespace Icinga\Module\Notifications\Widget\ItemList;

use Icinga\Module\Notifications\Common\Links;
use Icinga\Module\Notifications\Common\LoadMore;
use Icinga\Module\Notifications\Common\NoSubjectLink;
use Icinga\Module\Notifications\Hook\ObjectsRendererHook;
use Icinga\Module\Notifications\Model\Event;
use ipl\Orm\ResultSet;
use ipl\Web\Common\BaseItemList;
use ipl\Web\Url;

class EventList extends BaseItemList
{
Expand Down Expand Up @@ -37,6 +39,9 @@ protected function init(): void
$this->on(self::ON_ASSEMBLED, function () {
ObjectsRendererHook::load();
});

$this->getAttributes()
->set('data-icinga-detail-url', (string) Url::fromPath('notifications/event'));
}

protected function getItemClass(): string
Expand Down
5 changes: 5 additions & 0 deletions library/Notifications/Widget/ItemList/EventListItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
use ipl\Html\BaseHtmlElement;
use ipl\Html\Html;
use ipl\Html\HtmlElement;
use ipl\Stdlib\Filter;
use ipl\Stdlib\Str;
use ipl\Web\Common\BaseListItem;
use ipl\Web\Filter\QueryString;
use ipl\Web\Widget\Icon;
use ipl\Web\Widget\Link;
use ipl\Web\Widget\TimeAgo;
Expand Down Expand Up @@ -47,6 +49,9 @@ protected function init(): void
$this->getAttributes()
->set('data-action-item', true);
}

$this->getAttributes()
->set('data-icinga-detail-filter', QueryString::render(Filter::equal('id', $this->item->id)));
}

protected function assembleVisual(BaseHtmlElement $visual): void
Expand Down
7 changes: 7 additions & 0 deletions library/Notifications/Widget/ItemList/EventRuleList.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Icinga\Module\Notifications\Common\LoadMore;
use ipl\Web\Common\BaseItemList;
use ipl\Web\Url;

class EventRuleList extends BaseItemList
{
Expand All @@ -17,4 +18,10 @@ protected function getItemClass(): string
{
return EventRuleListItem::class;
}

protected function init(): void
{
$this->getAttributes()
->set('data-icinga-detail-url', (string) Url::fromPath('notifications/event-rule'));
}
}
5 changes: 4 additions & 1 deletion library/Notifications/Widget/ItemList/EventRuleListItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
use Icinga\Module\Notifications\Widget\RuleEscalationRecipientBadge;
use ipl\Html\BaseHtmlElement;
use ipl\Html\Html;
use ipl\Stdlib\Filter;
use ipl\Web\Common\BaseListItem;
use ipl\Web\Filter\QueryString;
use ipl\Web\Widget\Icon;
use ipl\Web\Widget\Link;

Expand All @@ -28,7 +30,8 @@ class EventRuleListItem extends BaseListItem
protected function init(): void
{
$this->getAttributes()
->set('data-action-item', true);
->set('data-action-item', true)
->set('data-icinga-detail-filter', QueryString::render(Filter::equal('id', $this->item->id)));
}

protected function assembleVisual(BaseHtmlElement $visual): void
Expand Down
4 changes: 4 additions & 0 deletions library/Notifications/Widget/ItemList/IncidentList.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Icinga\Module\Notifications\Model\Incident;
use ipl\Web\Common\BaseItemList;
use Icinga\Module\Notifications\Common\NoSubjectLink;
use ipl\Web\Url;

class IncidentList extends BaseItemList
{
Expand All @@ -24,6 +25,9 @@ protected function init(): void
$this->on(self::ON_ASSEMBLED, function () {
ObjectsRendererHook::load();
});

$this->getAttributes()
->set('data-icinga-detail-url', (string) Url::fromPath('notifications/incident'));
}

protected function getItemClass(): string
Expand Down
5 changes: 5 additions & 0 deletions library/Notifications/Widget/ItemList/IncidentListItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
use ipl\Html\Html;
use ipl\Html\HtmlElement;
use ipl\I18n\Translation;
use ipl\Stdlib\Filter;
use ipl\Web\Common\BaseListItem;
use ipl\Web\Filter\QueryString;
use ipl\Web\Widget\Icon;
use ipl\Web\Widget\Link;
use ipl\Web\Widget\TimeAgo;
Expand All @@ -41,6 +43,9 @@ protected function init(): void
$this->getAttributes()
->set('data-action-item', true);
}

$this->getAttributes()
->set('data-icinga-detail-filter', QueryString::render(Filter::equal('id', $this->item->id)));
}

protected function assembleVisual(BaseHtmlElement $visual): void
Expand Down
7 changes: 7 additions & 0 deletions library/Notifications/Widget/ItemList/ScheduleList.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Icinga\Module\Notifications\Widget\ItemList;

use ipl\Web\Common\BaseItemList;
use ipl\Web\Url;

class ScheduleList extends BaseItemList
{
Expand All @@ -14,4 +15,10 @@ protected function getItemClass(): string
{
return ScheduleListItem::class;
}

protected function init(): void
{
$this->getAttributes()
->set('data-icinga-detail-url', (string) Url::fromPath('notifications/schedule'));
}
}
5 changes: 4 additions & 1 deletion library/Notifications/Widget/ItemList/ScheduleListItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
use Icinga\Module\Notifications\Common\Links;
use Icinga\Module\Notifications\Model\Schedule;
use ipl\Html\BaseHtmlElement;
use ipl\Stdlib\Filter;
use ipl\Web\Common\BaseListItem;
use ipl\Web\Filter\QueryString;
use ipl\Web\Widget\Link;

/**
Expand All @@ -24,7 +26,8 @@ class ScheduleListItem extends BaseListItem
protected function init(): void
{
$this->getAttributes()
->set('data-action-item', true);
->set('data-action-item', true)
->set('data-icinga-detail-filter', QueryString::render(Filter::equal('id', $this->item->id)));
}

protected function assembleTitle(BaseHtmlElement $title): void
Expand Down

0 comments on commit 3e84c7a

Please sign in to comment.