Add filter functionality to eventhistory view and fix default order direction
refs #5589
This commit is contained in:
parent
6167e6a4f8
commit
c89f3b6140
|
@ -67,7 +67,7 @@ icon = "img/icons/notification.png"
|
||||||
|
|
||||||
[History.Events]
|
[History.Events]
|
||||||
title = "All Events"
|
title = "All Events"
|
||||||
url = "monitoring/list/eventhistory"
|
url = "monitoring/list/eventhistory?raw_timestamp>=-2+days"
|
||||||
icon = "img/icons/history.png"
|
icon = "img/icons/history.png"
|
||||||
|
|
||||||
[System.Performance]
|
[System.Performance]
|
||||||
|
|
|
@ -362,7 +362,7 @@ class Monitoring_ListController extends MonitoringController
|
||||||
|
|
||||||
public function eventhistoryAction()
|
public function eventhistoryAction()
|
||||||
{
|
{
|
||||||
$query = EventHistoryView::fromRequest(
|
$dataview = EventHistoryView::fromRequest(
|
||||||
$this->getRequest(),
|
$this->getRequest(),
|
||||||
array(
|
array(
|
||||||
'host_name',
|
'host_name',
|
||||||
|
@ -378,12 +378,18 @@ class Monitoring_ListController extends MonitoringController
|
||||||
'host',
|
'host',
|
||||||
'service'
|
'service'
|
||||||
)
|
)
|
||||||
)->getQuery();
|
);
|
||||||
|
|
||||||
|
$this->setupFilterControl($dataview, 'eventhistory');
|
||||||
|
$this->setupSortControl(
|
||||||
|
array(
|
||||||
|
'raw_timestamp' => 'Occurence'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$query = $dataview->getQuery();
|
||||||
$this->handleFormatRequest($query);
|
$this->handleFormatRequest($query);
|
||||||
$this->view->history = $query->paginate();
|
$this->view->history = $query->paginate();
|
||||||
$this->setupSortControl(
|
|
||||||
array()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -10,6 +10,15 @@
|
||||||
<div data-icinga-component="app/mainDetailGrid" data-icinga-grid-selection-type="single">
|
<div data-icinga-component="app/mainDetailGrid" data-icinga-grid-selection-type="single">
|
||||||
|
|
||||||
<div class="container pull-left">
|
<div class="container pull-left">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-5">
|
||||||
|
<?= $this->filterBox->render($this); ?>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-7">
|
||||||
|
<?= $this->sortControl->render($this); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<?= $this->paginationControl($history, null, null, array('preserve' => $this->preserve)); ?>
|
<?= $this->paginationControl($history, null, null, array('preserve' => $this->preserve)); ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
namespace Icinga\Module\Monitoring\Backend\Ido\Query;
|
namespace Icinga\Module\Monitoring\Backend\Ido\Query;
|
||||||
|
|
||||||
use \Zend_Db_Select;
|
use \Zend_Db_Select;
|
||||||
use Icinga\Exception\ProgrammingError;
|
|
||||||
|
|
||||||
class EventHistoryQuery extends IdoQuery
|
class EventHistoryQuery extends IdoQuery
|
||||||
{
|
{
|
||||||
|
@ -37,17 +36,9 @@ class EventHistoryQuery extends IdoQuery
|
||||||
);
|
);
|
||||||
|
|
||||||
protected $useSubqueryCount = true;
|
protected $useSubqueryCount = true;
|
||||||
protected $maxCount = 1000;
|
|
||||||
|
|
||||||
protected function joinBaseTables()
|
protected function joinBaseTables()
|
||||||
{
|
{
|
||||||
|
|
||||||
// $start = date('Y-m-d H:i:s', time() - 3600 * 24 * 1);
|
|
||||||
$start = date('Y-m-d H:i:s', time() - 3600 * 24 * 2);
|
|
||||||
$end = date('Y-m-d H:i:s');
|
|
||||||
// TODO: $this->dbTime(...)
|
|
||||||
//$start = null;
|
|
||||||
//$end = null;
|
|
||||||
$columns = array(
|
$columns = array(
|
||||||
'raw_timestamp',
|
'raw_timestamp',
|
||||||
'timestamp',
|
'timestamp',
|
||||||
|
@ -68,16 +59,6 @@ class EventHistoryQuery extends IdoQuery
|
||||||
$this->createSubQuery('Notificationhistory', $columns)
|
$this->createSubQuery('Notificationhistory', $columns)
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($start) {
|
|
||||||
foreach ($this->subQueries as $query) {
|
|
||||||
$query->where('timestamp > ?', $start);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($end) {
|
|
||||||
foreach ($this->subQueries as $query) {
|
|
||||||
$query->where('timestamp < ? ', $end);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$sub = $this->db->select()->union($this->subQueries, Zend_Db_Select::SQL_UNION_ALL);
|
$sub = $this->db->select()->union($this->subQueries, Zend_Db_Select::SQL_UNION_ALL);
|
||||||
$this->baseQuery = $this->db->select()->from(
|
$this->baseQuery = $this->db->select()->from(
|
||||||
array('eho' => $this->prefix . 'objects'),
|
array('eho' => $this->prefix . 'objects'),
|
||||||
|
|
|
@ -55,7 +55,6 @@ class Contact extends DataView
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
'contact_alias' => array(
|
'contact_alias' => array(
|
||||||
'default_dir' => self::SORT_ASC,
|
|
||||||
'order' => self::SORT_DESC
|
'order' => self::SORT_DESC
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
|
@ -33,7 +33,6 @@ class Contactgroup extends DataView
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
'contactgroup_name' => array(
|
'contactgroup_name' => array(
|
||||||
'default_dir' => self::SORT_ASC,
|
|
||||||
'order' => self::SORT_DESC
|
'order' => self::SORT_DESC
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
|
@ -63,10 +63,10 @@ class EventHistory extends DataView
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
'raw_timestamp' => array(
|
'raw_timestamp' => array(
|
||||||
'default_dir' => self::SORT_DESC
|
'order' => self::SORT_DESC
|
||||||
),
|
),
|
||||||
'timestamp' => array(
|
'timestamp' => array(
|
||||||
'default_dir' => self::SORT_DESC
|
'order' => self::SORT_DESC
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue