2019-10-23 06:30:00 -04:00
|
|
|
<?php
|
|
|
|
|
|
2019-11-04 19:07:30 -05:00
|
|
|
namespace Icinga\Module\Icingadb\Controllers;
|
2019-10-23 06:30:00 -04:00
|
|
|
|
2019-11-04 19:07:30 -05:00
|
|
|
use Icinga\Module\Icingadb\Model\NotificationHistory;
|
|
|
|
|
use Icinga\Module\Icingadb\Web\Controller;
|
|
|
|
|
use Icinga\Module\Icingadb\Widget\ItemList\NotificationList;
|
2019-10-23 06:30:00 -04:00
|
|
|
|
|
|
|
|
class NotificationsController extends Controller
|
|
|
|
|
{
|
|
|
|
|
public function indexAction()
|
|
|
|
|
{
|
|
|
|
|
$this->setTitle($this->translate('Notifications'));
|
|
|
|
|
|
|
|
|
|
$db = $this->getDb();
|
|
|
|
|
|
|
|
|
|
$notifications = NotificationHistory::on($db)->with([
|
|
|
|
|
'host',
|
|
|
|
|
'host.state',
|
|
|
|
|
'service',
|
|
|
|
|
'service.host',
|
|
|
|
|
'service.host.state',
|
|
|
|
|
'service.state'
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
$limitControl = $this->createLimitControl();
|
|
|
|
|
$paginationControl = $this->createPaginationControl($notifications);
|
|
|
|
|
$filterControl = $this->createFilterControl($notifications);
|
|
|
|
|
|
|
|
|
|
$this->filter($notifications);
|
|
|
|
|
|
|
|
|
|
yield $this->export($notifications);
|
|
|
|
|
|
|
|
|
|
$this->addControl($paginationControl);
|
|
|
|
|
$this->addControl($limitControl);
|
|
|
|
|
$this->addControl($filterControl);
|
|
|
|
|
|
2019-10-30 12:15:27 -04:00
|
|
|
$this->addContent(new NotificationList($notifications));
|
2019-12-11 02:59:30 -05:00
|
|
|
|
|
|
|
|
$this->setAutorefreshInterval(10);
|
2019-10-23 06:30:00 -04:00
|
|
|
}
|
|
|
|
|
}
|