From 6739034a14bd782e207be8b15bf1b2e365a92ce1 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Thu, 4 Sep 2014 15:12:49 +0200 Subject: [PATCH] monitoring/list: handle q param and search for *q* Handle the generic search parameter q, search defaults to *searchString* instead of searchString* right now. refs #6680 refs #6495 --- .../controllers/ListController.php | 28 +++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/modules/monitoring/application/controllers/ListController.php b/modules/monitoring/application/controllers/ListController.php index b71d78acf..047b4ab35 100644 --- a/modules/monitoring/application/controllers/ListController.php +++ b/modules/monitoring/application/controllers/ListController.php @@ -50,13 +50,31 @@ class Monitoring_ListController extends Controller } $q = $this->getRequest()->getPost('q'); + if ($q) { + list($k, $v) = preg_split('/=/', $q); + $url->addParams(array($k => $v)); + return $url; + } + } else { $q = $url->shift('q'); - } - if ($q) { - list($k, $v) = preg_split('/=/', $q); - $url->addParams(array($k => $v)); - return $url; + if ($q) { + $action = $this->_request->getActionName(); + switch($action) { + case 'services': + $this->params->remove('q')->set('service_description', '*' . $q . '*'); + break; + case 'hosts': + $this->params->remove('q')->set('host_name', '*' . $q . '*'); + break; + case 'hostgroups': + $this->params->remove('q')->set('hostgroups', '*' . $q . '*'); + break; + case 'servicegroups': + $this->params->remove('q')->set('servicegroup', '*' . $q . '*'); + break; + } + } } return false; }