icingadb-web/application/controllers/HostsController.php
2019-11-05 01:07:30 +01:00

38 lines
1 KiB
PHP

<?php
namespace Icinga\Module\Icingadb\Controllers;
use Icinga\Module\Icingadb\Model\Host;
use Icinga\Module\Icingadb\Web\Controller;
use Icinga\Module\Icingadb\Widget\HostList;
class HostsController extends Controller
{
public function indexAction()
{
$this->setTitle($this->translate('Hosts'));
$db = $this->getDb();
$hosts = Host::on($db)->with('state');
$limitControl = $this->createLimitControl();
$paginationControl = $this->createPaginationControl($hosts);
$viewModeSwitcher = $this->createViewModeSwitcher();
$filterControl = $this->createFilterControl($hosts);
$hostList = (new HostList($hosts))
->setViewMode($viewModeSwitcher->getViewMode());
$this->filter($hosts);
yield $this->export($hosts);
$this->addControl($paginationControl);
$this->addControl($viewModeSwitcher);
$this->addControl($limitControl);
$this->addControl($filterControl);
$this->addContent($hostList);
}
}