icingadb-web/application/controllers/HistoryController.php

52 lines
1.3 KiB
PHP
Raw Normal View History

2019-11-05 05:52:57 -05:00
<?php
namespace Icinga\Module\Icingadb\Controllers;
use Icinga\Module\Icingadb\Model\History;
use Icinga\Module\Icingadb\Web\Controller;
use Icinga\Module\Icingadb\Widget\ItemList\HistoryList;
class HistoryController extends Controller
{
public function indexAction()
{
$this->setTitle($this->translate('History'));
$db = $this->getDb();
$history = History::on($db)->with([
'host',
'host.state',
'service',
'service.state',
'service.host',
'service.host.state',
'comment',
'downtime',
'notification',
'state'
]);
$limitControl = $this->createLimitControl();
$paginationControl = $this->createPaginationControl($history);
2019-12-11 07:38:29 -05:00
$sortControl = $this->createSortControl(
$history,
[
'history.event_time desc' => $this->translate('Event Time')
]
);
2019-11-05 05:52:57 -05:00
$filterControl = $this->createFilterControl($history);
$this->filter($history);
yield $this->export($history);
$this->addControl($paginationControl);
2019-12-11 07:38:29 -05:00
$this->addControl($sortControl);
2019-11-05 05:52:57 -05:00
$this->addControl($limitControl);
$this->addControl($filterControl);
$this->addContent(new HistoryList($history));
}
}