monitoring: Fix that searching for specific columns is no longer possible if default search columns are set
This commit is contained in:
parent
124173f3c8
commit
31400ea16a
|
@ -216,25 +216,22 @@ class FilterEditor extends AbstractWidget
|
|||
$filter = $this->getFilter();
|
||||
|
||||
if ($search !== null) {
|
||||
if (empty($this->searchColumns)) {
|
||||
if (strpos($search, '=') === false) {
|
||||
Notification::error(mt('monitoring', 'Cannot search here'));
|
||||
return $this;
|
||||
} else {
|
||||
list($k, $v) = preg_split('/=/', $search);
|
||||
$filter = $this->mergeRootExpression($filter, trim($k), '=', ltrim($v));
|
||||
}
|
||||
} else {
|
||||
if (false === $this->resetSearchColumns($filter)) {
|
||||
if (strpos($search, '=') !== false) {
|
||||
list($k, $v) = preg_split('/=/', $search);
|
||||
$filter = $this->mergeRootExpression($filter, trim($k), '=', ltrim($v));
|
||||
} elseif (! empty($this->searchColumns)) {
|
||||
if (! $this->resetSearchColumns($filter)) {
|
||||
$filter = Filter::matchAll();
|
||||
}
|
||||
|
||||
$filters = array();
|
||||
$search = ltrim($search);
|
||||
foreach ($this->searchColumns as $searchColumn) {
|
||||
$filters[] = Filter::expression($searchColumn, '=', "*$search*");
|
||||
}
|
||||
$filter->andFilter(new FilterOr($filters));
|
||||
} else {
|
||||
Notification::error(mt('monitoring', 'Cannot search here'));
|
||||
return $this;
|
||||
}
|
||||
|
||||
$url = $this->url()->setQueryString(
|
||||
|
|
Loading…
Reference in New Issue