diff --git a/application/controllers/RedundancygroupController.php b/application/controllers/RedundancygroupController.php index 5c409d8d4..eed56589f 100644 --- a/application/controllers/RedundancygroupController.php +++ b/application/controllers/RedundancygroupController.php @@ -230,6 +230,7 @@ public function completeAction(): void $suggestions = (new ObjectSuggestions()) ->setModel(DependencyNode::class) ->setBaseFilter(Filter::equal("$column.redundancy_group.id", $this->groupId)) + ->onlyWithCustomVarSources(['host', 'service', 'hostgroup', 'servicegroup']) ->forRequest($this->getServerRequest()); $this->getDocument()->add($suggestions); diff --git a/library/Icingadb/Model/Hostgroup.php b/library/Icingadb/Model/Hostgroup.php index 1ff6f0fba..a5477f5d7 100644 --- a/library/Icingadb/Model/Hostgroup.php +++ b/library/Icingadb/Model/Hostgroup.php @@ -71,7 +71,9 @@ public function getDefaultSort() public function createBehaviors(Behaviors $behaviors) { $behaviors->add(new ReRoute([ - 'servicegroup' => 'service.servicegroup' + 'servicegroup' => 'service.servicegroup', + 'parent' => 'host.from.to', + 'child' => 'host.to.from' ])); $behaviors->add(new Binary([ diff --git a/library/Icingadb/Model/Servicegroup.php b/library/Icingadb/Model/Servicegroup.php index 2e4b847b5..852114939 100644 --- a/library/Icingadb/Model/Servicegroup.php +++ b/library/Icingadb/Model/Servicegroup.php @@ -72,7 +72,9 @@ public function createBehaviors(Behaviors $behaviors) { $behaviors->add(new ReRoute([ 'host' => 'service.host', - 'hostgroup' => 'service.hostgroup' + 'hostgroup' => 'service.hostgroup', + 'parent' => 'service.from.to', + 'child' => 'service.to.from' ])); $behaviors->add(new Binary([ diff --git a/library/Icingadb/Web/Control/SearchBar/ObjectSuggestions.php b/library/Icingadb/Web/Control/SearchBar/ObjectSuggestions.php index 7630e0162..3c4382fc5 100644 --- a/library/Icingadb/Web/Control/SearchBar/ObjectSuggestions.php +++ b/library/Icingadb/Web/Control/SearchBar/ObjectSuggestions.php @@ -419,4 +419,18 @@ protected static function collectRelations(Resolver $resolver, Model $subject, a } } } + + /** + * Reduce {@see $customVarSources} to only given relations to fetch variables from + * + * @param string[] $relations + * + * @return $this + */ + public function onlyWithCustomVarSources(array $relations): self + { + $this->customVarSources = array_intersect_key($this->customVarSources, array_flip($relations)); + + return $this; + } }