Search: re-add object names, allow for addresses

It's now possible do search for IP (and IPv6) addresses. Object names
are once again allowed

fixes #9591
fixes #10163
This commit is contained in:
Thomas Gelf 2015-10-01 18:48:36 +02:00
parent 209c084f51
commit 9ca81320ac
3 changed files with 10 additions and 4 deletions

View File

@ -235,7 +235,7 @@ class FilterEditor extends AbstractWidget
$filter = $this->mergeRootExpression($filter, trim($k), '=', ltrim($v));
} else {
if ($this->searchColumns === null && $this->query instanceof FilterColumns) {
$this->searchColumns = $this->query->getSearchColumns();
$this->searchColumns = $this->query->getSearchColumns($search);
}
if (! empty($this->searchColumns)) {

View File

@ -81,9 +81,15 @@ class HostStatus extends DataView
/**
* {@inheritdoc}
*/
public function getSearchColumns()
public function getSearchColumns($search = null)
{
return array('host_display_name');
if ($search !== null
&& (@inet_pton($search) !== false || preg_match('/^\d{1,3}\.\d{1,3}\./', $search))
) {
return array('host', 'host_address', 'host_address6');
} else {
return array('host', 'host_display_name');
}
}
/**

View File

@ -170,6 +170,6 @@ class ServiceStatus extends DataView
*/
public function getSearchColumns()
{
return array('host_display_name', 'service_display_name');
return array('service', 'service_display_name');
}
}