Fix editing of multi-selected services with same name

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.
This commit is contained in:
raviks789 2023-09-12 10:44:22 +02:00 committed by Thomas Gelf
parent 7426e65067
commit 63a3e6a1ec

View File

@ -13,6 +13,7 @@ use Icinga\Module\Director\Forms\IcingaMultiEditForm;
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;
@ -409,7 +410,12 @@ abstract class ObjectsController extends ActionController
$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'");
}