Skip to content

Commit

Permalink
RedundancyGroupListItem: Make list item clickable
Browse files Browse the repository at this point in the history
  • Loading branch information
sukhwinder33445 committed Nov 15, 2024
1 parent 6dc9179 commit a26c584
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions library/Icingadb/Widget/ItemList/RedundancyGroupListItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
use Icinga\Module\Icingadb\Widget\DependencyNodeStatistics;
use ipl\Html\BaseHtmlElement;
use ipl\Stdlib\Filter;
use ipl\Web\Url;
use ipl\Web\Widget\Link;
use ipl\Web\Widget\StateBall;
use ipl\Html\HtmlElement;
use ipl\Html\Attributes;
use ipl\Html\Text;
use ipl\Web\Widget\TimeSince;

Expand All @@ -33,6 +34,14 @@ class RedundancyGroupListItem extends StateListItem
/** @var RedundancyGroupState */
protected $state;

protected function init(): void
{
parent::init();

$this->getAttributes()
->registerAttributeCallback('data-action-item', function () {return true;});
}

protected function getStateBallSize(): string
{
return StateBall::SIZE_LARGE;
Expand All @@ -43,12 +52,12 @@ protected function createTimestamp(): BaseHtmlElement
return new TimeSince($this->state->last_state_change->getTimestamp());
}

protected function createSubject(): BaseHtmlElement
protected function createSubject(): Link
{
return new HtmlElement(
'span',
Attributes::create(['class' => 'subject']),
Text::create($this->item->display_name)
return new Link(
$this->item->display_name,
Url::fromPath('icingadb/redundancygroup', ['id' => bin2hex($this->item->id)]),
['class' => 'subject']
);
}

Expand Down

0 comments on commit a26c584

Please sign in to comment.