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 */
|
|
|
|
|
|
2023-05-25 05:18:21 -04:00
|
|
|
namespace Icinga\Module\Icingadb\Widget\ItemTable;
|
2019-11-01 18:07:36 -04:00
|
|
|
|
2021-04-29 10:55:19 -04:00
|
|
|
use Icinga\Module\Icingadb\Model\Servicegroup;
|
2020-02-06 09:18:44 -05:00
|
|
|
use Icinga\Module\Icingadb\Widget\Detail\ServiceStatistics;
|
2019-11-01 18:07:36 -04:00
|
|
|
use ipl\Html\BaseHtmlElement;
|
2020-12-03 11:05:51 -05:00
|
|
|
use ipl\Stdlib\Filter;
|
2019-11-01 18:07:36 -04:00
|
|
|
|
2021-04-29 10:55:19 -04:00
|
|
|
/**
|
|
|
|
|
* Servicegroup item of a servicegroup list. Represents one database row.
|
|
|
|
|
*
|
|
|
|
|
* @property Servicegroup $item
|
2023-05-25 05:18:21 -04:00
|
|
|
* @property ServicegroupTable $table
|
2021-04-29 10:55:19 -04:00
|
|
|
*/
|
2023-06-07 07:50:06 -04:00
|
|
|
class ServicegroupTableRow extends BaseServiceGroupItem
|
2019-11-01 18:07:36 -04:00
|
|
|
{
|
2023-06-07 07:50:06 -04:00
|
|
|
use TableRowLayout;
|
2021-04-29 10:55:19 -04:00
|
|
|
|
2023-06-07 07:50:06 -04:00
|
|
|
protected $defaultAttributes = ['class' => 'servicegroup-table-row'];
|
2021-04-29 10:55:19 -04:00
|
|
|
|
2023-06-07 07:50:06 -04:00
|
|
|
/**
|
|
|
|
|
* Create Service statistics cell
|
|
|
|
|
*
|
|
|
|
|
* @return BaseHtmlElement[]
|
|
|
|
|
*/
|
|
|
|
|
protected function createStatistics(): array
|
2019-11-01 18:07:36 -04:00
|
|
|
{
|
2020-03-04 01:56:39 -05:00
|
|
|
$serviceStats = new ServiceStatistics($this->item);
|
2019-12-18 08:31:56 -05:00
|
|
|
|
2020-12-03 11:05:51 -05:00
|
|
|
$serviceStats->setBaseFilter(Filter::equal('servicegroup.name', $this->item->name));
|
2023-05-25 05:18:21 -04:00
|
|
|
if (isset($this->table) && $this->table->hasBaseFilter()) {
|
2020-03-04 01:56:39 -05:00
|
|
|
$serviceStats->setBaseFilter(
|
2023-05-25 05:18:21 -04:00
|
|
|
Filter::all($serviceStats->getBaseFilter(), $this->table->getBaseFilter())
|
2020-03-04 01:56:39 -05:00
|
|
|
);
|
2019-11-01 18:07:36 -04:00
|
|
|
}
|
2020-03-04 01:56:39 -05:00
|
|
|
|
2023-06-07 07:50:06 -04:00
|
|
|
return [$this->createColumn($serviceStats)];
|
2019-11-01 18:07:36 -04:00
|
|
|
}
|
|
|
|
|
}
|