feat(server): confirm Docker image deletion with a typed reference modal

Replace the browser confirm on the Delete button with a two-step
confirmation modal. To delete, users now type the image reference.
The modal is shown only to users who can update the server. delete()
now accepts an optional password argument so it works with the modal's
submit action.
This commit is contained in:
Andras Bacsai
2026-09-28 14:21:17 +02:00
parent 2e2d1d321c
commit 0fec411b72
2 changed files with 12 additions and 7 deletions
+1 -1
View File
@@ -53,7 +53,7 @@ class DockerImages extends Component
}
}
public function delete(string $reference): void
public function delete(string $reference, string $password = ''): void
{
try {
$this->authorize('update', $this->server);
@@ -87,12 +87,17 @@
</div>
<div>
@if ($image['containers'] === [])
<x-forms.button canGate="update" :canResource="$server" isError
wire:click="delete('{{ $image['reference'] }}')"
wire:confirm="Delete {{ $image['reference'] }} from this server? It has to be pulled or built again to be used."><x-reicon
name="trash" class="size-3.5" />
Delete
</x-forms.button>
@can('update', $server)
<x-modal-confirmation title="Delete Docker Image?" buttonTitle="Delete"
submitAction="delete({{ $image['reference'] }})" :actions="[
'Delete ' . $image['reference'] . ' from this server.',
'It has to be pulled or built again before it can be used.',
]"
confirmationText="{{ $image['reference'] }}"
confirmationLabel="Confirm by entering the image reference"
shortConfirmationLabel="Image" step2ButtonText="Delete Image"
isErrorButton :confirmWithPassword="false" />
@endcan
@endif
</div>
</div>