Skip to content

Commit

Permalink
Fix editing of multi-selected services with same name
Browse files Browse the repository at this point in the history
Since the object names function as keys for the multi-selected objects array, this becomes a problem when
multiple services as the same name. Hence for the services the array keys must be a combination of service name
and the host name to which the service is related.
  • Loading branch information
raviks789 authored and Thomas-Gelf committed Sep 21, 2023
1 parent 7426e65 commit 63a3e6a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion library/Director/Web/Controller/ObjectsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Icinga\Module\Director\Objects\IcingaCommand;
use Icinga\Module\Director\Objects\IcingaHost;
use Icinga\Module\Director\Objects\IcingaObject;
use Icinga\Module\Director\Objects\IcingaService;
use Icinga\Module\Director\RestApi\IcingaObjectsHandler;
use Icinga\Module\Director\Web\ActionBar\ObjectsActionBar;
use Icinga\Module\Director\Web\ActionBar\TemplateActionBar;
Expand Down Expand Up @@ -409,7 +410,12 @@ protected function loadMultiObjectsFromParams()
$objects[$name] = $class::load($name, $db);
} elseif ($col === 'uuid') {
$object = $store->load($table, Uuid::fromString($ex->getExpression()));
$objects[$object->getObjectName()] = $object;
if ($object instanceof IcingaService) {
$host = $object->getRelated('host');
$objects[$host->getObjectName() . ': ' . $object->getObjectName()] = $object;
} else {
$objects[$object->getObjectName()] = $object;
}
} else {
throw new InvalidArgumentException("'$col' is no a valid key component for '$type'");
}
Expand Down

0 comments on commit 63a3e6a

Please sign in to comment.