refs #2605. Added new status 'sent'
testing/ogcore-api/pipeline/head There was a failure building this commit Details

develop
Manuel Aranda Rosales 2025-08-06 16:41:58 +02:00
parent 1da10e85fd
commit e257aaeaef
3 changed files with 13 additions and 4 deletions

View File

@ -1,4 +1,9 @@
# Changelog
## [0.19.0] - 2025-08-06
### Added
- Se ha añadido un nuevo estado "enviado" para cuando se ejecuten acciones a equipos en estado Windows o Linux
---
## [0.18.1] - 2025-08-06
### Improved
- Se ha añadido el filtro "jobId" a la entidad Trace.

View File

@ -137,15 +137,17 @@ class RunScriptAction extends AbstractOgAgentController
$this->entityManager->flush();
if ($existingTrace) {
$this->updateExistingTrace($existingTrace, $jobId, $inputData);
$this->updateExistingTrace($existingTrace, $jobId, $inputData, $client);
} else {
$this->createService->__invoke($client, CommandTypes::RUN_SCRIPT, TraceStatus::IN_PROGRESS, $jobId, $inputData);
$status = ($this->isLinuxOrWindows($client) || $this->isLinuxOrWindowsSession($client)) ? TraceStatus::SENT : TraceStatus::IN_PROGRESS;
$this->createService->__invoke($client, CommandTypes::RUN_SCRIPT, $status, $jobId, $inputData);
}
}
private function updateExistingTrace(Trace $trace, string $jobId, array $inputData): void
private function updateExistingTrace(Trace $trace, string $jobId, array $inputData, Client $client): void
{
$trace->setStatus(TraceStatus::IN_PROGRESS);
$status = ($this->isLinuxOrWindows($client) || $this->isLinuxOrWindowsSession($client)) ? TraceStatus::SENT : TraceStatus::IN_PROGRESS;
$trace->setStatus($status);
$trace->setJobId($jobId);
$trace->setInput($inputData);
$this->entityManager->persist($trace);

View File

@ -9,6 +9,7 @@ final class TraceStatus
public const string SUCCESS = 'success';
public const string FAILED = 'failed';
public const string CANCELLED = 'cancelled';
public const string SENT = 'sent';
private const array STATUS = [
self::PENDING => 'Pendiente',
@ -16,6 +17,7 @@ final class TraceStatus
self::SUCCESS => 'Finalizado con éxito',
self::FAILED => 'Fallido',
self::CANCELLED => 'Cancelado',
self::SENT => 'Enviado',
];
public static function getStatus(): array