Compare commits

..

No commits in common. "51cc5fac2cad3e12f0ec7f5b6db105b59b0a48b7" and "531c56630f2b98be37b990c7cac9afde2ac2fd69" have entirely different histories.

10 changed files with 8 additions and 101 deletions

View File

@ -45,52 +45,6 @@ services:
arguments: [ { 'enabled': ~, 'readOnly': ~ } ]
tags: [ 'api_platform.filter' ]
api_platform.filter.command_task.order:
parent: 'api_platform.doctrine.orm.order_filter'
arguments:
$properties: { 'id': ~, 'name': ~ }
$orderParameterName: 'order'
tags: [ 'api_platform.filter' ]
api_platform.filter.command_task.search:
parent: 'api_platform.doctrine.orm.search_filter'
arguments: [ { 'id': 'exact', 'name': 'partial' } ]
tags: [ 'api_platform.filter' ]
api_platform.filter.command_task_schedule.order:
parent: 'api_platform.doctrine.orm.order_filter'
arguments:
$properties: { 'id': ~, 'name': ~ }
$orderParameterName: 'order'
tags: [ 'api_platform.filter' ]
api_platform.filter.command_task_schedule.search:
parent: 'api_platform.doctrine.orm.search_filter'
arguments: [ { 'id': 'exact', 'name': 'partial', 'commandTask.id': 'exact' } ]
tags: [ 'api_platform.filter' ]
api_platform.filter.command_task_schedule.boolean:
parent: 'api_platform.doctrine.orm.boolean_filter'
arguments: [ { 'enabled': ~} ]
tags: [ 'api_platform.filter' ]
api_platform.filter.command_task_script.order:
parent: 'api_platform.doctrine.orm.order_filter'
arguments:
$properties: { 'id': ~, 'name': ~ }
$orderParameterName: 'order'
tags: [ 'api_platform.filter' ]
api_platform.filter.command_task_script.search:
parent: 'api_platform.doctrine.orm.search_filter'
arguments: [ { 'id': 'exact', 'name': 'partial', 'commandTask.id': 'exact' } ]
tags: [ 'api_platform.filter' ]
api_platform.filter.command_task_script.boolean:
parent: 'api_platform.doctrine.orm.boolean_filter'
arguments: [ { 'enabled': ~ } ]
tags: [ 'api_platform.filter' ]
api_platform.filter.hardware.order:
parent: 'api_platform.doctrine.orm.order_filter'
arguments:

View File

@ -165,7 +165,6 @@ final class ClientInput
$ogLive = $this->ogLive?->getEntity() ?? $client->getOrganizationalUnit()?->getNetworkSettings()?->getOgLive();
$hardwareProfile = $this->hardwareProfile?->getEntity() ?? $client->getOrganizationalUnit()?->getNetworkSettings()?->getHardwareProfile();
$repository = $this->repository?->getEntity() ?? $client->getOrganizationalUnit()?->getNetworkSettings()?->getRepository();
$template = $this->template?->getEntity() ?? $client->getOrganizationalUnit()?->getNetworkSettings()?->getPxeTemplate();
$client->setName($this->name);
$client->setSerialNumber($this->serialNumber);
@ -178,7 +177,7 @@ final class ClientInput
$client->setOgLive($ogLive);
$client->setHardwareProfile($hardwareProfile);
$client->setRepository($repository);
$client->setTemplate($template);
$client->setTemplate($this->template?->getEntity());
$client->setPosition($this->position);
$client->setStatus($this->status);
$client->setMaintenance($this->maintenance);

View File

@ -7,7 +7,6 @@ use App\Dto\Output\HardwareProfileOutput;
use App\Dto\Output\ImageRepositoryOutput;
use App\Dto\Output\MenuOutput;
use App\Dto\Output\OgLiveOutput;
use App\Dto\Output\PxeTemplateOutput;
use App\Entity\HardwareProfile;
use App\Entity\Menu;
use App\Entity\NetworkSettings;
@ -81,9 +80,6 @@ class NetworkSettingsInput
#[Groups(['organizational-unit:write'])]
public ?ImageRepositoryOutput $repository = null;
#[Groups(['organizational-unit:write'])]
public ?PxeTemplateOutput $pxeTemplate = null;
#[Groups(['organizational-unit:write'])]
public ?string $ogshare = null;
@ -124,10 +120,6 @@ class NetworkSettingsInput
if ($networkSettings->getRepository()) {
$this->repository = new ImageRepositoryOutput($networkSettings->getRepository());
}
if ($networkSettings->getPxeTemplate()) {
$this->pxeTemplate = new PxeTemplateOutput($networkSettings->getPxeTemplate());
}
}
public function createOrUpdateEntity(?NetworkSettings $networkSettings = null): NetworkSettings
@ -168,10 +160,6 @@ class NetworkSettingsInput
$networkSettings->setRepository($this->repository->getEntity());
}
if ($this->pxeTemplate) {
$networkSettings->setPxeTemplate($this->pxeTemplate->getEntity());
}
return $networkSettings;
}
}

View File

@ -57,7 +57,7 @@ final class ClientOutput extends AbstractOutput
#[Groups(['client:read', 'organizational-unit:read', 'pxe-template:read', 'trace:read', 'subnet:read'])]
#[ApiProperty(readableLink: true )]
public ?PxeTemplateOutput $pxeTemplate = null;
public ?PxeTemplateOutput $template = null;
#[Groups(['client:read', 'organizational-unit:read', 'pxe-template:read', 'trace:read', 'subnet:read'])]
#[ApiProperty(readableLink: true )]
@ -106,6 +106,7 @@ final class ClientOutput extends AbstractOutput
$this->menu = $client->getMenu() ? new MenuOutput($client->getMenu()) : null;
$this->position = $client->getPosition();
$this->template = $client->getTemplate() ? new PxeTemplateOutput($client->getTemplate()) : null;
$repository = $client->getRepository()
?? $client->getOrganizationalUnit()?->getNetworkSettings()?->getRepository();
@ -117,11 +118,6 @@ final class ClientOutput extends AbstractOutput
$this->ogLive = $ogLive ? new OgLiveOutput($ogLive) : null;
$template = $client->getTemplate()
?? $client->getOrganizationalUnit()?->getNetworkSettings()?->getPxeTemplate();
$this->pxeTemplate = $template ? new PxeTemplateOutput($template) : null;
$this->hardwareProfile = $client->getHardwareProfile() ? new HardwareProfileOutput($client->getHardwareProfile()) : null;
$this->subnet = $client->getSubnet()?->getIpAddress();
$this->status = $client->getStatus();

View File

@ -63,9 +63,6 @@ final class NetworkSettingsOutput extends AbstractOutput
#[Groups(['network-settings:read', "organizational-unit:read", "client:read"])]
public ?ImageRepositoryOutput $repository = null;
#[Groups(['network-settings:read', "organizational-unit:read", "client:read"])]
public ?PxeTemplateOutput $pxeTemplate = null;
#[Groups(['network-settings:read', "organizational-unit:read", "client:read"])]
public ?string $ogshare = null;
@ -111,10 +108,6 @@ final class NetworkSettingsOutput extends AbstractOutput
$this->repository = new ImageRepositoryOutput($networkSettings->getRepository());
}
if ($networkSettings->getPxeTemplate()) {
$this->pxeTemplate = new PxeTemplateOutput($networkSettings->getPxeTemplate());
}
$this->createdAt = $networkSettings->getCreatedAt();
$this->createdBy = $networkSettings->getCreatedBy();
}

View File

@ -11,7 +11,7 @@ use Symfony\Component\Serializer\Annotation\Groups;
#[Get(shortName: 'OrganizationalUnit')]
final class OrganizationalUnitOutput extends AbstractOutput
{
#[Groups(['organizational-unit:read', "client:read", "user:read", 'organizational-unit:read:collection:short', 'software-profile:read', 'command-task:read'])]
#[Groups(['organizational-unit:read', "client:read", "user:read", 'organizational-unit:read:collection:short', 'software-profile:read'])]
public string $name;
#[Groups(['organizational-unit:read'])]

View File

@ -76,9 +76,6 @@ class NetworkSettings extends AbstractEntity
#[ORM\Column(length: 255, nullable: true)]
private ?string $ogShare = null;
#[ORM\ManyToOne]
private ?PxeTemplate $pxeTemplate = null;
public function __construct()
{
parent::__construct();
@ -340,16 +337,4 @@ class NetworkSettings extends AbstractEntity
return $this;
}
public function getPxeTemplate(): ?PxeTemplate
{
return $this->pxeTemplate;
}
public function setPxeTemplate(?PxeTemplate $pxeTemplate): static
{
$this->pxeTemplate = $pxeTemplate;
return $this;
}
}

View File

@ -49,14 +49,10 @@ final readonly class ClientSubscriber implements EventSubscriberInterface
/** @var Client $client */
$client = $clientOutput->getEntity();
$template = !$client->getTemplate() ?
$client->getTemplate() :
$client->getOrganizationalUnit()?->getNetworkSettings()?->getPxeTemplate();
if ($template === null) {
if ($client->getTemplate() === null) {
return;
}
$this->postAction->__invoke($client, $template);
$this->postAction->__invoke($client, $client->getTemplate());
}
}

View File

@ -82,7 +82,6 @@ final readonly class OrganizationalUnitSubscriber implements EventSubscriberInte
$client->setOgLive($networkSettings->getOgLive());
$client->setMenu($networkSettings->getMenu());
$client->setRepository($networkSettings->getRepository());
$client->setTemplate($networkSettings->getPxeTemplate());
$this->entityManager->persist($client);
}
@ -117,7 +116,6 @@ final readonly class OrganizationalUnitSubscriber implements EventSubscriberInte
$newNetworkSettings->setMenu($organizationalUnitEntity->getNetworkSettings()->getMenu());
$newNetworkSettings->setRepository($organizationalUnitEntity->getNetworkSettings()->getRepository());
$newNetworkSettings->setOgLive($organizationalUnitEntity->getNetworkSettings()->getOgLive());
$newNetworkSettings->setPxeTemplate($organizationalUnitEntity->getNetworkSettings()->getPxeTemplate());
$newNetworkSettings->setNetiface($organizationalUnitEntity->getNetworkSettings()->getNetiface());
return $newNetworkSettings;

View File

@ -21,9 +21,8 @@ readonly class CreateTraceService
foreach ($commandTask->getClients() as $client) {
$trace = new Trace();
$trace->setClient($client);
$trace->setCommand($command->getName());
$trace->setCommand($command);
$trace->setStatus(TraceStatus::PENDING);
$trace->setInput($commandTask->getParameters());
$trace->setExecutedAt($commandTask->getDatetime());
$this->entityManager->persist($trace);
}
@ -34,8 +33,7 @@ readonly class CreateTraceService
foreach ($commandTask->getClients() as $client) {
$trace = new Trace();
$trace->setClient($client);
$trace->setCommand($command->getName());
$trace->setInput($commandTask->getParameters());
$trace->setCommand($command);
$trace->setStatus(TraceStatus::PENDING);
$trace->setExecutedAt($commandTask->getDatetime());
$this->entityManager->persist($trace);