mirror of
https://github.com/Icinga/icingadb-web.git
synced 2026-06-08 16:22:05 -04:00
ObjectSuggestions: Implement method shouldShowRelationFor()
This commit is contained in:
parent
10577631b3
commit
87b66b11f0
1 changed files with 23 additions and 0 deletions
|
|
@ -91,6 +91,29 @@ class ObjectSuggestions extends Suggestions
|
|||
return $this->model;
|
||||
}
|
||||
|
||||
protected function shouldShowRelationFor(string $column): bool
|
||||
{
|
||||
if (strpos($column, '.vars.') !== false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$tableName = $this->getModel()->getTableName();
|
||||
$columnPath = explode('.', $column);
|
||||
|
||||
switch (count($columnPath)) {
|
||||
case 3:
|
||||
if ($columnPath[1] !== 'state' || ! in_array($tableName, ['host', 'service'])) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// For host/service state relation columns apply the same rules
|
||||
case 2:
|
||||
return $columnPath[0] !== $tableName;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
protected function createQuickSearchFilter($searchTerm)
|
||||
{
|
||||
$model = $this->getModel();
|
||||
|
|
|
|||
Loading…
Reference in a new issue