mirror of
https://github.com/Icinga/icingadb-web.git
synced 2026-02-20 00:10:09 -05:00
47 lines
1.3 KiB
PHP
47 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace Icinga\Module\Icingadb\Controllers;
|
|
|
|
use Icinga\Module\Icingadb\Model\Service;
|
|
use Icinga\Module\Icingadb\Model\ServicestateSummary;
|
|
use Icinga\Module\Icingadb\Web\Controller;
|
|
use Icinga\Module\Icingadb\Widget\ServiceList;
|
|
|
|
class ServicesController extends Controller
|
|
{
|
|
public function indexAction()
|
|
{
|
|
$this->setTitle($this->translate('Services'));
|
|
|
|
$db = $this->getDb();
|
|
|
|
$services = Service::on($db)->with([
|
|
'state',
|
|
'host',
|
|
'host.state'
|
|
]);
|
|
$summary = ServicestateSummary::on($db)->with('state');
|
|
|
|
$limitControl = $this->createLimitControl();
|
|
$paginationControl = $this->createPaginationControl($services);
|
|
$viewModeSwitcher = $this->createViewModeSwitcher();
|
|
$filterControl = $this->createFilterControl($services);
|
|
|
|
$this->filter($services);
|
|
$this->filter($summary);
|
|
|
|
yield $this->export($services, $summary);
|
|
|
|
$serviceList = (new ServiceList($services))
|
|
->setViewMode($viewModeSwitcher->getViewMode());
|
|
|
|
$this->addControl($paginationControl);
|
|
$this->addControl($limitControl);
|
|
$this->addControl($viewModeSwitcher);
|
|
$this->addControl($filterControl);
|
|
|
|
$this->addContent($serviceList);
|
|
|
|
$this->setAutorefreshInterval(10);
|
|
}
|
|
}
|