mirror of
https://github.com/nextcloud/all-in-one.git
synced 2026-05-30 07:20:09 +00:00
feat: add Pull new images button while containers are running
Agent-Logs-Url: https://github.com/nextcloud/all-in-one/sessions/446ad3c6-142d-4e62-adb8-b43a7e548cda Co-authored-by: szaimen <42591237+szaimen@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
50643afd6a
commit
2121fec318
@@ -45,15 +45,15 @@ readonly class DockerController {
|
||||
$this->dockerActionManager->ConnectContainerToNetwork($container);
|
||||
}
|
||||
|
||||
private function PerformRecursiveImagePull(string $id) : void {
|
||||
private function PerformRecursiveImagePull(string $id, ?\Closure $addToStreamingResponseBody = null) : void {
|
||||
$container = $this->containerDefinitionFetcher->GetContainerById($id);
|
||||
|
||||
// Pull all dependencies first and then itself
|
||||
foreach($container->dependsOn as $dependency) {
|
||||
$this->PerformRecursiveImagePull($dependency);
|
||||
$this->PerformRecursiveImagePull($dependency, $addToStreamingResponseBody);
|
||||
}
|
||||
|
||||
$this->dockerActionManager->PullImage($container, true);
|
||||
$this->dockerActionManager->PullImage($container, true, $addToStreamingResponseBody);
|
||||
}
|
||||
|
||||
public function PullAllContainerImages(): void {
|
||||
@@ -63,6 +63,19 @@ readonly class DockerController {
|
||||
$this->PerformRecursiveImagePull($id);
|
||||
}
|
||||
|
||||
public function PullImages(Request $request, Response $response, array $args) : Response {
|
||||
// Get streaming response start and closure
|
||||
$nonbufResp = $this->startStreamingResponse($response);
|
||||
$addToStreamingResponseBody = $this->getAddToStreamingResponseBody($nonbufResp);
|
||||
|
||||
$id = self::TOP_CONTAINER;
|
||||
$this->PerformRecursiveImagePull($id, $addToStreamingResponseBody);
|
||||
|
||||
// End streaming response
|
||||
$this->finalizeStreamingResponse($nonbufResp);
|
||||
return $nonbufResp;
|
||||
}
|
||||
|
||||
public function GetLogs(Request $request, Response $response, array $args) : Response
|
||||
{
|
||||
$requestParams = $request->getQueryParams();
|
||||
|
||||
Reference in New Issue
Block a user