icingadb-web/library/Icingadb/Widget/ItemTable/ServicegroupTableRow.php

43 lines
1.1 KiB
PHP
Raw Normal View History

2019-11-01 18:07:36 -04:00
<?php
2020-03-13 03:38:01 -04:00
/* Icinga DB Web | (c) 2020 Icinga GmbH | GPLv2 */
namespace Icinga\Module\Icingadb\Widget\ItemTable;
2019-11-01 18:07:36 -04:00
use Icinga\Module\Icingadb\Model\Servicegroup;
use Icinga\Module\Icingadb\Widget\Detail\ServiceStatistics;
2019-11-01 18:07:36 -04:00
use ipl\Html\BaseHtmlElement;
use ipl\Stdlib\Filter;
2019-11-01 18:07:36 -04:00
/**
* Servicegroup item of a servicegroup list. Represents one database row.
*
* @property Servicegroup $item
* @property ServicegroupTable $table
*/
class ServicegroupTableRow extends BaseServiceGroupItem
2019-11-01 18:07:36 -04:00
{
use TableRowLayout;
protected $defaultAttributes = ['class' => 'servicegroup-table-row'];
/**
* Create Service statistics cell
*
* @return BaseHtmlElement[]
*/
protected function createStatistics(): array
2019-11-01 18:07:36 -04:00
{
$serviceStats = new ServiceStatistics($this->item);
$serviceStats->setBaseFilter(Filter::equal('servicegroup.name', $this->item->name));
if (isset($this->table) && $this->table->hasBaseFilter()) {
$serviceStats->setBaseFilter(
Filter::all($serviceStats->getBaseFilter(), $this->table->getBaseFilter())
);
2019-11-01 18:07:36 -04:00
}
return [$this->createColumn($serviceStats)];
2019-11-01 18:07:36 -04:00
}
}