2019-10-09 11:25:39 -04:00
|
|
|
<?php
|
|
|
|
|
|
2019-11-04 19:07:30 -05:00
|
|
|
namespace Icinga\Module\Icingadb\Controllers;
|
2019-10-09 11:25:39 -04:00
|
|
|
|
2019-11-04 19:07:30 -05:00
|
|
|
use Icinga\Module\Icingadb\Model\Service;
|
|
|
|
|
use Icinga\Module\Icingadb\Web\Controller;
|
|
|
|
|
use Icinga\Module\Icingadb\Widget\ServiceList;
|
2019-10-09 11:25:39 -04:00
|
|
|
|
|
|
|
|
class ServicesController extends Controller
|
|
|
|
|
{
|
|
|
|
|
public function indexAction()
|
|
|
|
|
{
|
|
|
|
|
$this->setTitle($this->translate('Services'));
|
|
|
|
|
|
|
|
|
|
$db = $this->getDb();
|
|
|
|
|
|
|
|
|
|
$services = Service::on($db)->with([
|
|
|
|
|
'state',
|
2019-10-10 09:13:27 -04:00
|
|
|
'host',
|
|
|
|
|
'host.state'
|
2019-10-09 11:25:39 -04:00
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
$limitControl = $this->createLimitControl();
|
2019-10-15 09:29:36 -04:00
|
|
|
$paginationControl = $this->createPaginationControl($services);
|
|
|
|
|
$viewModeSwitcher = $this->createViewModeSwitcher();
|
2019-10-18 02:44:38 -04:00
|
|
|
$filterControl = $this->createFilterControl($services);
|
2019-10-09 11:25:39 -04:00
|
|
|
|
2019-10-16 03:22:05 -04:00
|
|
|
$this->filter($services);
|
|
|
|
|
|
2019-10-15 10:50:40 -04:00
|
|
|
yield $this->export($services);
|
|
|
|
|
|
2019-10-09 11:25:39 -04:00
|
|
|
$serviceList = (new ServiceList($services))
|
|
|
|
|
->setViewMode($viewModeSwitcher->getViewMode());
|
|
|
|
|
|
2019-10-15 09:29:36 -04:00
|
|
|
$this->addControl($paginationControl);
|
2019-10-09 11:25:39 -04:00
|
|
|
$this->addControl($viewModeSwitcher);
|
|
|
|
|
$this->addControl($limitControl);
|
2019-10-18 02:44:38 -04:00
|
|
|
$this->addControl($filterControl);
|
2019-10-09 11:25:39 -04:00
|
|
|
|
|
|
|
|
$this->addContent($serviceList);
|
|
|
|
|
}
|
|
|
|
|
}
|