mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-29 08:44:10 +02:00
Trim off leading whitespaces from filter values when searching
Because whitespaces may be used when searching for entities using the query string format "column = value" we have to trim off leading whitespaces from filter values. This loses the possibility for search for entities with leading whitespaces of course. refs #8777
This commit is contained in:
parent
6e6aabedf2
commit
a185107927
@ -201,13 +201,13 @@ class FilterEditor extends AbstractWidget
|
|||||||
if ($searchCol === null) {
|
if ($searchCol === null) {
|
||||||
throw new Exception('Cannot search here');
|
throw new Exception('Cannot search here');
|
||||||
}
|
}
|
||||||
|
$search = ltrim($search);
|
||||||
$filter = $this->mergeRootExpression($filter, $searchCol, '=', "*$search*");
|
$filter = $this->mergeRootExpression($filter, $searchCol, '=', "*$search*");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
list($k, $v) = preg_split('/=/', $search);
|
list($k, $v) = preg_split('/=/', $search);
|
||||||
$filter = $this->mergeRootExpression($filter, $k, '=', $v);
|
$filter = $this->mergeRootExpression($filter, trim($k), '=', ltrim($v));
|
||||||
}
|
}
|
||||||
|
|
||||||
$url = $this->url()->setQueryString(
|
$url = $this->url()->setQueryString(
|
||||||
$filter->toQueryString()
|
$filter->toQueryString()
|
||||||
)->addParams($preserve);
|
)->addParams($preserve);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user