IcingaServiceSetServiceTable: branch classes

This commit is contained in:
Thomas Gelf 2022-09-20 12:19:31 +02:00
parent 4d8e3f6db7
commit 4d2f285c01

View File

@ -9,7 +9,6 @@ use ipl\Html\Html;
use Icinga\Module\Director\Forms\RemoveLinkForm; use Icinga\Module\Director\Forms\RemoveLinkForm;
use Icinga\Module\Director\Objects\IcingaHost; use Icinga\Module\Director\Objects\IcingaHost;
use Icinga\Module\Director\Objects\IcingaServiceSet; use Icinga\Module\Director\Objects\IcingaServiceSet;
use ipl\Html\HtmlElement;
use gipfl\IcingaWeb2\Link; use gipfl\IcingaWeb2\Link;
use gipfl\IcingaWeb2\Table\ZfQueryBasedTable; use gipfl\IcingaWeb2\Table\ZfQueryBasedTable;
use gipfl\IcingaWeb2\Url; use gipfl\IcingaWeb2\Url;
@ -142,17 +141,28 @@ class IcingaServiceSetServiceTable extends ZfQueryBasedTable
$tr = $this::row([ $tr = $this::row([
$this->getServiceLink($row) $this->getServiceLink($row)
]); ]);
$classes = $this->getRowClasses($row);
if ($row->disabled === 'y') { if ($row->disabled === 'y') {
$tr->getAttributes()->add('class', 'disabled'); $classes[] = 'disabled';
} }
if ($row->blacklisted === 'y') { if ($row->blacklisted === 'y') {
$tr->getAttributes()->add('class', 'strike-links'); $classes[] = 'strike-links';
}
if (! empty($classes)) {
$tr->getAttributes()->add('class', $classes);
} }
return $tr; return $tr;
} }
protected function getRowClasses($row)
{
if ($row->branch_uuid !== null) {
return ['branch_modified'];
}
return [];
}
protected function getTitle() protected function getTitle()
{ {
return $this->title ?: $this->translate('Servicename'); return $this->title ?: $this->translate('Servicename');