2019-10-31 11:17:29 -04:00
|
|
|
<?php
|
|
|
|
|
|
2019-11-04 19:07:30 -05:00
|
|
|
namespace Icinga\Module\Icingadb\Controllers;
|
2019-10-31 11:17:29 -04:00
|
|
|
|
2019-11-04 19:07:30 -05:00
|
|
|
use Icinga\Module\Icingadb\Model\Hostgroupsummary;
|
|
|
|
|
use Icinga\Module\Icingadb\Web\Controller;
|
|
|
|
|
use Icinga\Module\Icingadb\Widget\ItemList\HostgroupList;
|
2019-10-31 11:17:29 -04:00
|
|
|
|
|
|
|
|
class HostgroupsController extends Controller
|
|
|
|
|
{
|
|
|
|
|
public function indexAction() {
|
|
|
|
|
|
|
|
|
|
$this->setTitle($this->translate('Host Groups'));
|
|
|
|
|
|
|
|
|
|
$db = $this->getDb();
|
|
|
|
|
|
|
|
|
|
$hostgroups = Hostgroupsummary::on($db);
|
|
|
|
|
|
|
|
|
|
$limitControl = $this->createLimitControl();
|
|
|
|
|
$paginationControl = $this->createPaginationControl($hostgroups);
|
2019-12-11 07:54:11 -05:00
|
|
|
$sortControl = $this->createSortControl(
|
|
|
|
|
$hostgroups,
|
|
|
|
|
[
|
|
|
|
|
'display_name' => $this->translate('Name'),
|
|
|
|
|
'hosts_severity desc' => $this->translate('Severity'),
|
|
|
|
|
'hosts_total desc' => $this->translate('Total Hosts'),
|
|
|
|
|
'services_total desc' => $this->translate('Total Services')
|
|
|
|
|
]
|
|
|
|
|
);
|
2019-10-31 11:17:29 -04:00
|
|
|
$filterControl = $this->createFilterControl($hostgroups);
|
|
|
|
|
|
|
|
|
|
$this->filter($hostgroups);
|
|
|
|
|
|
|
|
|
|
yield $this->export($hostgroups);
|
|
|
|
|
|
|
|
|
|
$this->addControl($paginationControl);
|
2019-12-11 07:54:11 -05:00
|
|
|
$this->addControl($sortControl);
|
2019-10-31 11:17:29 -04:00
|
|
|
$this->addControl($limitControl);
|
|
|
|
|
$this->addControl($filterControl);
|
|
|
|
|
|
2019-12-03 05:26:23 -05:00
|
|
|
$this->addContent(
|
|
|
|
|
(new HostgroupList($hostgroups))->setBaseFilter($this->getFilter())
|
|
|
|
|
);
|
2019-12-11 02:59:30 -05:00
|
|
|
|
|
|
|
|
$this->setAutorefreshInterval(30);
|
2019-10-31 11:17:29 -04:00
|
|
|
}
|
|
|
|
|
}
|