mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-16 09:42:29 -04:00
DeleteResourceJob no longer restores a service and rethrows when remote cleanup fails. The resource is always removed from Coolify, and the team gets a notification that Docker resources may remain on the server. No notification is sent when the server itself was already deleted. removeSubresourceContainer now returns false instead of throwing when the server is not functional. Deleting a service application or database then shows a warning that the container is removed on the next service start. StopService handles a missing destination server, environment, project, or team without throwing. The danger zone warning now shows for any resource whose server is unreachable, not only services.
70 lines
4.0 KiB
PHP
70 lines
4.0 KiB
PHP
<div>
|
|
@php
|
|
$resourceLabel = match ($resource?->type()) {
|
|
'application' => 'application',
|
|
'service' => 'service',
|
|
'service-application' => 'service application',
|
|
'service-database' => 'service database',
|
|
default => 'resource',
|
|
};
|
|
@endphp
|
|
@if ($resource && !data_get($resource, 'destination.server')?->isFunctional())
|
|
<x-callout type="warning" title="Server is not reachable" class="mb-4">
|
|
Coolify cannot stop or remove Docker resources on this server. Deleting removes this {{ $resourceLabel }}
|
|
from Coolify only. Its containers, volumes, networks, and configuration files remain on the server and can
|
|
start again when the server is back.
|
|
</x-callout>
|
|
@endif
|
|
<x-application.settings-section id="danger-zone-section" title="Danger zone"
|
|
helper="Destructive resource actions cannot be undone.">
|
|
<x-danger-zone title="Delete {{ $resourceLabel }}">
|
|
<p>
|
|
Permanently delete
|
|
<strong class="font-semibold text-black dark:text-fg">{{ $resourceName }}</strong>,
|
|
stop its containers, and remove the selected Docker resources and configuration.
|
|
</p>
|
|
<ul class="space-y-1 text-xs">
|
|
<li>• Active deployments will be stopped.</li>
|
|
<li>• Selected volumes and stored data may be permanently removed.</li>
|
|
<li>• This {{ $resourceLabel }} cannot be restored from Coolify after deletion.</li>
|
|
</ul>
|
|
<x-slot:action>
|
|
@if ($canDelete)
|
|
<x-modal-confirmation title="Delete {{ $resourceLabel }}?"
|
|
buttonTitle="Delete {{ $resourceLabel }}"
|
|
isErrorButton submitAction="delete" :checkboxes="$checkboxes"
|
|
:actions="['Permanently delete this resource and its selected Docker resources.']"
|
|
confirmationText="{{ $resourceName }}"
|
|
confirmationLabel="Enter the resource name to confirm permanent deletion"
|
|
shortConfirmationLabel="Resource name" />
|
|
@if ($resource instanceof \App\Models\Service)
|
|
<x-modal-confirmation title="Remove service from Coolify only?"
|
|
buttonTitle="Remove from Coolify only"
|
|
isErrorButton submitAction="deleteFromCoolifyOnly"
|
|
:actions="[
|
|
'Permanently remove this service from Coolify.',
|
|
'Leave all containers, volumes, networks, and configuration files on the server.',
|
|
]"
|
|
warningMessage="Coolify will no longer track or manage the Docker resources for this service. Use this only when normal cleanup cannot complete."
|
|
confirmationText="{{ $resourceName }}"
|
|
confirmationLabel="Enter the resource name to confirm metadata-only deletion"
|
|
shortConfirmationLabel="Resource name" />
|
|
@endif
|
|
@else
|
|
<x-forms.button isError disabled tooltip="You do not have permission to delete this resource.">
|
|
Delete {{ $resourceLabel }}
|
|
</x-forms.button>
|
|
@endif
|
|
</x-slot:action>
|
|
</x-danger-zone>
|
|
|
|
@if (!$canDelete)
|
|
<div class="mt-4">
|
|
<x-callout type="danger" title="Insufficient permissions">
|
|
Contact a team administrator if this resource must be deleted.
|
|
</x-callout>
|
|
</div>
|
|
@endif
|
|
</x-application.settings-section>
|
|
</div>
|