mirror of
https://github.com/Icinga/icingaweb2-module-businessprocess.git
synced 2026-05-28 04:34:08 -04:00
EditNodeForm: Fix handling of manually changed service node name
Previously, a manually changed service node name was always treated as a host node, causing validation to fail with "Host not found" when the input contained a service name, e.g. <serviceName on hostName>. Replace unnecessary `getNode()` calls with explicit `createHost()` or `createService()` call.
This commit is contained in:
parent
c552b1db7b
commit
5b0d7a40a3
1 changed files with 6 additions and 1 deletions
|
|
@ -126,7 +126,12 @@ class EditNodeForm extends CompatForm
|
|||
$node = $this->bp->getNode($nodeName);
|
||||
} elseif ($userInput && (! $nodeLabel || $userInput !== $nodeLabel)) {
|
||||
// User didn't choose a suggestion or changed it manually
|
||||
$node = $this->bp->getNode(BpConfig::joinNodeName($userInput, 'Hoststatus'));
|
||||
if ($this->node instanceof ServiceNode) {
|
||||
[$service, $host] = explode(' on ', $userInput, 2);
|
||||
$node = $this->bp->createService($host, $service);
|
||||
} else {
|
||||
$node = $this->bp->createHost($userInput);
|
||||
}
|
||||
} else {
|
||||
// If the search and user input are both empty, it can only be the initial value
|
||||
$node = $this->node;
|
||||
|
|
|
|||
Loading…
Reference in a new issue