From eddb00cbc171f914f754cb5b87c3037195272f62 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 20 Nov 2014 17:19:26 +0100 Subject: [PATCH] monitoring: Remove filter widgets in the event overview / history view They did not work. --- .../controllers/ListController.php | 42 +++++++++---------- .../views/scripts/list/eventhistory.phtml | 6 --- 2 files changed, 20 insertions(+), 28 deletions(-) diff --git a/modules/monitoring/application/controllers/ListController.php b/modules/monitoring/application/controllers/ListController.php index 4ce76f4ac..c5d7cc906 100644 --- a/modules/monitoring/application/controllers/ListController.php +++ b/modules/monitoring/application/controllers/ListController.php @@ -40,6 +40,24 @@ class Monitoring_ListController extends Controller $this->url = Url::fromRequest(); } + /** + * @deprecated DO NOT USE. THIS IS A HACK. This is removed once we fix the eventhistory action w/ filters. + */ + protected function applyFilter($query) + { + $params = clone $this->params; + $params->shift('format'); + $params->shift('limit'); + $params->shift('page'); + $params->shift('view'); + if ($sort = $params->shift('sort')) { + $query->order($sort, $params->shift('dir')); + } + $query->applyFilter(Filter::fromQuerystring((string) $params)); + $this->handleFormatRequest($query); + return $query; + } + protected function hasBetterUrl() { $request = $this->getRequest(); @@ -570,24 +588,6 @@ class Monitoring_ListController extends Controller } $this->addTitleTab('eventhistory', $this->translate('Event Overview')); - $form = new EventOverviewForm(); - $form->handleRequest($this->getRequest()); - $this->view->form = $form; - - if ($this->getRequest()->isPost() && !$this->getParam('modifyFilter')) { - // update filter string - $filters = $form->getFilter(); - $url = $this->_request->getUrl(); - $url->setQueryString($filters->toQueryString()); - if ($this->getParam('sort') !== null) { - $url->setParam('sort', $this->getParam('sort')); - } - if ($this->getParam('dir') !== null) { - $url->setParam('dir', $this->getParam('dir')); - } - return $this->redirectNow($url); - } - $query = $this->backend->select()->from('eventHistory', array( 'host_name', 'service_description', @@ -601,14 +601,12 @@ class Monitoring_ListController extends Controller 'host', 'service' )); - if ($this->getParam('state')) { - $query->applyFilter(Filter::expression('state', '=', $this->getParam('state'))); - } + + $this->applyFilter($query); $this->setupSortControl(array( 'timestamp' => 'Occurence' )); - $this->filterQuery($query); $this->view->history = $query->paginate(); } diff --git a/modules/monitoring/application/views/scripts/list/eventhistory.phtml b/modules/monitoring/application/views/scripts/list/eventhistory.phtml index 0b63a6703..1b3a29971 100644 --- a/modules/monitoring/application/views/scripts/list/eventhistory.phtml +++ b/modules/monitoring/application/views/scripts/list/eventhistory.phtml @@ -8,12 +8,6 @@ widget('limiter', array('url' => $this->url, 'max' => $this->history->count())); ?> paginationControl($history, null, null, array('preserve' => $this->preserve)); ?> -

- - -
- filterEditor ?> -