icingadb-web/application/controllers/HostsController.php

42 lines
1.2 KiB
PHP
Raw Normal View History

2019-09-09 08:46:56 -04:00
<?php
2019-11-04 19:07:30 -05:00
namespace Icinga\Module\Icingadb\Controllers;
2019-09-09 08:46:56 -04:00
2019-11-04 19:07:30 -05:00
use Icinga\Module\Icingadb\Model\Host;
use Icinga\Module\Icingadb\Model\HoststateSummary;
2019-11-04 19:07:30 -05:00
use Icinga\Module\Icingadb\Web\Controller;
use Icinga\Module\Icingadb\Widget\HostList;
2019-09-09 08:46:56 -04:00
class HostsController extends Controller
{
public function indexAction()
{
$this->setTitle($this->translate('Hosts'));
$db = $this->getDb();
$hosts = Host::on($db)->with('state');
$summary = HoststateSummary::on($db)->with('state');
2019-09-09 08:46:56 -04:00
2019-10-08 18:09:18 -04:00
$limitControl = $this->createLimitControl();
2019-10-15 09:29:36 -04:00
$paginationControl = $this->createPaginationControl($hosts);
$viewModeSwitcher = $this->createViewModeSwitcher();
2019-10-18 02:44:23 -04:00
$filterControl = $this->createFilterControl($hosts);
2019-10-08 17:58:23 -04:00
2019-09-13 04:09:41 -04:00
$hostList = (new HostList($hosts))
2019-10-08 17:58:23 -04:00
->setViewMode($viewModeSwitcher->getViewMode());
2019-10-16 03:22:05 -04:00
$this->filter($hosts);
$this->filter($summary);
2019-10-16 03:22:05 -04:00
yield $this->export($hosts, $summary);
2019-10-15 09:29:36 -04:00
$this->addControl($paginationControl);
2019-10-08 17:58:23 -04:00
$this->addControl($viewModeSwitcher);
2019-10-08 18:09:18 -04:00
$this->addControl($limitControl);
2019-10-18 02:44:23 -04:00
$this->addControl($filterControl);
2019-09-09 08:46:56 -04:00
$this->addContent($hostList);
}
}