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
This commit is contained in:
Thomas Gelf 2014-09-04 15:12:49 +02:00
parent f694b16092
commit 6739034a14
1 changed files with 23 additions and 5 deletions

View File

@ -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;
}