From 8b63032955134028192dce6093cf3e873dba320c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 20 Mar 2026 15:24:24 +0000 Subject: [PATCH] Address review: add startStreamingResponse helper, stream prune output, restore button location Co-authored-by: szaimen <42591237+szaimen@users.noreply.github.com> --- php/src/Controller/DockerController.php | 34 ++++++++++++------------- php/src/Docker/DockerActionManager.php | 6 ++++- php/templates/containers.twig | 12 ++++----- 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/php/src/Controller/DockerController.php b/php/src/Controller/DockerController.php index c4625564..e326676a 100644 --- a/php/src/Controller/DockerController.php +++ b/php/src/Controller/DockerController.php @@ -202,16 +202,7 @@ readonly class DockerController { error_log('WARNING: Not pulling container images. Instead, using local ones.'); } - $nonbufResp = $response - ->withBody(new NonBufferedBody()) - ->withHeader('Content-Type', 'text/html; charset=utf-8') - ->withHeader('X-Accel-Buffering', 'no') - ->withHeader('Cache-Control', 'no-cache'); - - // Text written into this body is immediately sent to the client, without waiting for later content. - $streamingResponseBody = $nonbufResp->getBody(); - - $streamingResponseBody->write($this->getStreamingResponseHtmlStart()); + [$nonbufResp, $streamingResponseBody] = $this->startStreamingResponse($response); // Create a closure to pass around to the code, which should to the logging (because it e.g. decides // if it'll actually pull an image), but which should not need to know anything about the @@ -286,14 +277,7 @@ readonly class DockerController { } public function SystemPrune(Request $request, Response $response, array $args) : Response { - $nonbufResp = $response - ->withBody(new NonBufferedBody()) - ->withHeader('Content-Type', 'text/html; charset=utf-8') - ->withHeader('X-Accel-Buffering', 'no') - ->withHeader('Cache-Control', 'no-cache'); - - $streamingResponseBody = $nonbufResp->getBody(); - $streamingResponseBody->write($this->getStreamingResponseHtmlStart()); + [$nonbufResp, $streamingResponseBody] = $this->startStreamingResponse($response); $addToStreamingResponseBody = function (string $message) use ($streamingResponseBody) : void { $streamingResponseBody->write("