From c29af77466caac3f5c34018d77cd1b0e9ec64143 Mon Sep 17 00:00:00 2001 From: jmbardallo Date: Thu, 30 Jul 2026 11:10:42 +0200 Subject: [PATCH] Feat(mercure): broadcast output and finishedAt in trace events for real-time logs --- CHANGELOG.md | 3 +++ src/EventListener/TraceStatusProgressNotifier.php | 3 +++ 2 files changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 48cf3a5..2bbcc00 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## [1.9.2] - 2026-07-23 +### Added +- Mercure (`TraceStatusProgressNotifier`): Publish `output` and `finishedAt` fields in Mercure traces event for real-time log updates without page reload. + ### Fixed - Menú del navegador (`main.html.twig`): Modificada la acción por defecto para el arranque de sistemas operativos. Se ha cambiado de `command+output:` a `command:` para evitar que se abra la ventana emergente de salida de comandos, ofreciendo una experiencia de arranque más limpia. - Webhook (`StatusController` y `RunScriptAction`): Solucionado el problema de condición de carrera que creaba trazas duplicadas al ejecutar scripts. Ahora se establece el estado a `IN_PROGRESS` de forma síncrona en `RunScriptAction` al enviar el script a clientes Windows/Linux, prescindiendo del problemático webhook asíncrono `START_SCRIPT`. diff --git a/src/EventListener/TraceStatusProgressNotifier.php b/src/EventListener/TraceStatusProgressNotifier.php index efdb677..8c97011 100644 --- a/src/EventListener/TraceStatusProgressNotifier.php +++ b/src/EventListener/TraceStatusProgressNotifier.php @@ -47,6 +47,7 @@ class TraceStatusProgressNotifier 'status' => $trace->getStatus(), 'progress' => $trace->getProgress(), 'finishedAt' => $trace->getFinishedAt()?->format(\DateTimeInterface::ATOM), + 'output' => $trace->getOutput() ]) ); $this->hub->publish($update); @@ -55,6 +56,8 @@ class TraceStatusProgressNotifier 'client' => $trace->getUuid(), 'status' => $trace->getStatus(), 'progress' => $trace->getProgress(), + 'finishedAt' => $trace->getFinishedAt()?->format(\DateTimeInterface::ATOM), + 'output' => $trace->getOutput() ? substr($trace->getOutput(), 0, 200) . '...' : null, ]); } } \ No newline at end of file