Skip to content

Commit

Permalink
Remove superfluous trait NoSujectLink and its uses
Browse files Browse the repository at this point in the history
  • Loading branch information
sukhwinder33445 committed Dec 6, 2024
1 parent 2a6cf0e commit b5c9062
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 69 deletions.
35 changes: 0 additions & 35 deletions library/Icingadb/Common/NoSubjectLink.php

This file was deleted.

4 changes: 2 additions & 2 deletions library/Icingadb/Widget/ItemList/BaseCommentListItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ protected function getObject(): Comment

protected function wantSubjectLink(): bool
{
return ! $this->list->getNoSubjectLink();
return true;
}

protected function wantObjectLink(): bool
{
return ! $this->list->getObjectLinkDisabled();
return true;
}

protected function init(): void
Expand Down
4 changes: 2 additions & 2 deletions library/Icingadb/Widget/ItemList/BaseDowntimeListItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ protected function getObject(): Downtime

protected function wantSubjectLink(): bool
{
return ! $this->list->getNoSubjectLink();
return true;
}

protected function wantObjectLink(): bool
{
return ! $this->list->getObjectLinkDisabled();
return true;
}

protected function init(): void
Expand Down
2 changes: 1 addition & 1 deletion library/Icingadb/Widget/ItemList/BaseHistoryListItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ protected function getObject(): History

protected function wantSubjectLink(): bool
{
return ! $this->list->getNoSubjectLink();
return true;
}
}
29 changes: 9 additions & 20 deletions library/Icingadb/Widget/ItemList/BaseNotificationListItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,32 @@
use Icinga\Module\Icingadb\Common\HostStates;
use Icinga\Module\Icingadb\Common\Icons;
use Icinga\Module\Icingadb\Common\Links;
use Icinga\Module\Icingadb\Common\NoSubjectLink;
use Icinga\Module\Icingadb\Common\ServiceLink;
use Icinga\Module\Icingadb\Common\ServiceStates;
use Icinga\Module\Icingadb\Util\PluginOutput;
use Icinga\Module\Icingadb\Widget\PluginOutputContainer;
use Icinga\Module\Icingadb\Widget\StateChange;
use ipl\Stdlib\Filter;
use ipl\Web\Common\BaseListItem;
use ipl\Web\Widget\EmptyState;
use ipl\Web\Widget\TimeAgo;
use InvalidArgumentException;
use ipl\Html\BaseHtmlElement;
use ipl\Html\HtmlElement;
use ipl\Html\Text;
use ipl\Stdlib\Filter;
use ipl\Web\Common\BaseListItem;
use ipl\Web\Widget\EmptyState;
use ipl\Web\Widget\Icon;
use ipl\Web\Widget\Link;
use ipl\Web\Widget\TimeAgo;

abstract class BaseNotificationListItem extends BaseListItem
{
use HostLink;
use NoSubjectLink;
use ServiceLink;

/** @var NotificationList */
protected $list;

protected function init(): void
{
$this->setNoSubjectLink($this->list->getNoSubjectLink());
$this->list->addDetailFilterAttribute($this, Filter::equal('id', bin2hex($this->item->history->id)));
}

Expand Down Expand Up @@ -159,19 +156,11 @@ protected function assembleVisual(BaseHtmlElement $visual): void

protected function assembleTitle(BaseHtmlElement $title): void
{
if ($this->getNoSubjectLink()) {
$title->addHtml(HtmlElement::create(
'span',
['class' => 'subject'],
sprintf(self::phraseForType($this->item->type), ucfirst($this->item->object_type))
));
} else {
$title->addHtml(new Link(
sprintf(self::phraseForType($this->item->type), ucfirst($this->item->object_type)),
Links::event($this->item->history),
['class' => 'subject']
));
}
$title->addHtml(new Link(
sprintf(self::phraseForType($this->item->type), ucfirst($this->item->object_type)),
Links::event($this->item->history),
['class' => 'subject']
));

if ($this->item->object_type === 'host') {
$link = $this->createHostLink($this->item->host, true);
Expand Down
2 changes: 0 additions & 2 deletions library/Icingadb/Widget/ItemList/CommentList.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

use Icinga\Module\Icingadb\Common\DetailActions;
use Icinga\Module\Icingadb\Common\Links;
use Icinga\Module\Icingadb\Common\NoSubjectLink;
use Icinga\Module\Icingadb\Common\ObjectLinkDisabled;
use Icinga\Module\Icingadb\Common\TicketLinks;
use Icinga\Module\Icingadb\Common\ViewMode;
Expand All @@ -15,7 +14,6 @@

class CommentList extends BaseItemList
{
use NoSubjectLink;
use ObjectLinkDisabled;
use ViewMode;
use TicketLinks;
Expand Down
2 changes: 0 additions & 2 deletions library/Icingadb/Widget/ItemList/DowntimeList.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

use Icinga\Module\Icingadb\Common\DetailActions;
use Icinga\Module\Icingadb\Common\Links;
use Icinga\Module\Icingadb\Common\NoSubjectLink;
use Icinga\Module\Icingadb\Common\ObjectLinkDisabled;
use Icinga\Module\Icingadb\Common\TicketLinks;
use Icinga\Module\Icingadb\Common\ViewMode;
Expand All @@ -15,7 +14,6 @@

class DowntimeList extends BaseItemList
{
use NoSubjectLink;
use ObjectLinkDisabled;
use ViewMode;
use TicketLinks;
Expand Down
2 changes: 0 additions & 2 deletions library/Icingadb/Widget/ItemList/HistoryList.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

use Icinga\Module\Icingadb\Common\DetailActions;
use Icinga\Module\Icingadb\Common\LoadMore;
use Icinga\Module\Icingadb\Common\NoSubjectLink;
use Icinga\Module\Icingadb\Common\TicketLinks;
use Icinga\Module\Icingadb\Common\ViewMode;
use ipl\Orm\ResultSet;
Expand All @@ -15,7 +14,6 @@

class HistoryList extends BaseItemList
{
use NoSubjectLink;
use ViewMode;
use LoadMore;
use TicketLinks;
Expand Down
1 change: 0 additions & 1 deletion library/Icingadb/Widget/ItemList/HostListItemDetailed.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ protected function assembleFooter(BaseHtmlElement $footer): void
);

$comment = (new CommentList([$COMMENTTOREMOVE])) //TODO: remove it
->setNoSubjectLink()
->setObjectLinkDisabled()
->setDetailActionsDisabled();

Expand Down
2 changes: 0 additions & 2 deletions library/Icingadb/Widget/ItemList/NotificationList.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@

use Icinga\Module\Icingadb\Common\DetailActions;
use Icinga\Module\Icingadb\Common\LoadMore;
use Icinga\Module\Icingadb\Common\NoSubjectLink;
use Icinga\Module\Icingadb\Common\ViewMode;
use ipl\Orm\ResultSet;
use ipl\Web\Common\BaseItemList;
use ipl\Web\Url;

class NotificationList extends BaseItemList
{
use NoSubjectLink;
use ViewMode;
use LoadMore;
use DetailActions;
Expand Down

0 comments on commit b5c9062

Please sign in to comment.