icingadb-web/application/controllers/HostsController.php

35 lines
893 B
PHP
Raw Normal View History

2019-09-09 08:46:56 -04:00
<?php
namespace Icinga\Module\Eagle\Controllers;
use Icinga\Module\Eagle\Model\Host;
use Icinga\Module\Eagle\Web\Controller;
use Icinga\Module\Eagle\Widget\HostList;
class HostsController extends Controller
{
public function indexAction()
{
$this->setTitle($this->translate('Hosts'));
$db = $this->getDb();
$hosts = Host::on($db)->with('state');
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-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());
yield $this->export($hosts);
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-09-09 08:46:56 -04:00
$this->addContent($hostList);
}
}