Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

Merge branch 'next' into fix-#2546-deletion-issues

Andras Bacsai5ec45d547a0d
diff --cc app/Livewire/Project/Database/BackupExecutions.php
index b6827895fd,5d56ea53df..e163976526
--- a/app/Livewire/Project/Database/BackupExecutions.php
+++ b/app/Livewire/Project/Database/BackupExecutions.php
@@@ -11,17 -8,13 +11,16 @@@ use Livewire\Attributes\On
class BackupExecutions extends Component
{
public ?ScheduledDatabaseBackup $backup = null;
-
+ public $database;
public $executions = [];
-
public $setDeletableBackup;
+ public $delete_backup_s3 = true;
+ public $delete_backup_sftp = true;
+
public function getListeners()
{
- $userId = auth()->user()->id;
+ $userId = Auth::id();
return [
"echo-private:team.{$userId},BackupCreated" => 'refreshBackupExecutions',
@@@ -79,17 -57,53 +78,63 @@@
public function refreshBackupExecutions(): void
{
if ($this->backup) {
- $this->executions = $this->backup->executions()->get()->sortBy('created_at');
+ $this->executions = $this->backup->executions()->get();
+ }
+ }
+
+ public function mount(ScheduledDatabaseBackup $backup)
+ {
+ $this->backup = $backup;
+ $this->database = $backup->database;
+ $this->refreshBackupExecutions();
+ }
+
+ public function server()
+ {
+ if ($this->database) {
+ $server = null;
+
+ if ($this->database instanceof \App\Models\ServiceDatabase) {
+ $server = $this->database->service->destination->server;
+ } elseif ($this->database->destination && $this->database->destination->server) {
+ $server = $this->database->destination->server;
+ }
+ if ($server) {
+ return $server;
+ }
+ }
+ return null;
+ }
+
+ public function getServerTimezone()
+ {
+ $server = $this->server();
+ if (!$server) {
+ return 'UTC';
+ }
+ $serverTimezone = $server->settings->server_timezone;
+ return $serverTimezone;
+ }
+
+ public function formatDateInServerTimezone($date)
+ {
+ $serverTimezone = $this->getServerTimezone();
+ $dateObj = new \DateTime($date);
+ try {
+ $dateObj->setTimezone(new \DateTimeZone($serverTimezone));
+ } catch (\Exception $e) {
+ $dateObj->setTimezone(new \DateTimeZone('UTC'));
}
+ return $dateObj->format('Y-m-d H:i:s T');
}
+
+ public function render()
+ {
+ return view('livewire.project.database.backup-executions', [
+ 'checkboxes' => [
+ ['id' => 'delete_backup_s3', 'label' => 'Delete the selected backup permanently form S3 Storage'],
+ ['id' => 'delete_backup_sftp', 'label' => 'Delete the selected backup permanently form SFTP Storage'],
+ ]
+ ]);
+ }
}
diff --cc app/Livewire/Project/Service/Navbar.php
index 66d3079ec1,e6bb6d9bf8..51f38d2db3
--- a/app/Livewire/Project/Service/Navbar.php
+++ b/app/Livewire/Project/Service/Navbar.php
@@@ -20,7 -20,7 +20,8 @@@ class Navbar extends Componen
public $isDeploymentProgress = false;
+ public $docker_cleanup = true;
+ public $title = 'Configuration';
public function mount()
{
diff --cc app/Models/Service.php
index 64796283c6,d8def66631..80464db7d4
--- a/app/Models/Service.php
+++ b/app/Models/Service.php
@@@ -7,11 -7,10 +7,12 @@@ use Illuminate\Database\Eloquent\Factor
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Collection;
+use Illuminate\Support\Facades\Process;
+use Illuminate\Process\InvokedProcess;
+ use Illuminate\Support\Facades\Storage;
use OpenApi\Attributes as OA;
use Spatie\Url\Url;
- use Symfony\Component\Yaml\Yaml;
+ use Visus\Cuid2\Cuid2;
#[OA\Schema(
description: 'Service model',
diff --cc resources/views/livewire/project/database/backup-executions.blade.php
index d7f74664f5,54c3e2edea..bb2ec8eb9b
--- a/resources/views/livewire/project/database/backup-executions.blade.php
+++ b/resources/views/livewire/project/database/backup-executions.blade.php
@@@ -17,42 -19,42 +19,50 @@@
<x-loading />
</div>
@endif
- <div>Database: {{ data_get($execution, 'database_name', 'N/A') }}</div>
- <div>Status: {{ data_get($execution, 'status') }}</div>
- <div>Started At: {{ data_get($execution, 'created_at') }}</div>
+ <div class="text-gray-700 dark:text-gray-300 font-semibold mb-1">Status:
+ {{ data_get($execution, 'status') }}</div>
+ <div class="text-gray-600 dark:text-gray-400 text-sm">
+ Started At: {{ $this->formatDateInServerTimezone(data_get($execution, 'created_at')) }}
+ </div>
+ <div class="text-gray-600 dark:text-gray-400 text-sm">
+ Database: {{ data_get($execution, 'database_name', 'N/A') }}
+ </div>
+ <div class="text-gray-600 dark:text-gray-400 text-sm">
+ Size: {{ data_get($execution, 'size') }} B /
+ {{ round((int) data_get($execution, 'size') / 1024, 2) }} kB /
+ {{ round((int) data_get($execution, 'size') / 1024 / 1024, 3) }} MB
+ </div>
+ <div class="text-gray-600 dark:text-gray-400 text-sm">
+ Location: {{ data_get($execution, 'filename', 'N/A') }}
+ </div>
@if (data_get($execution, 'message'))
- <div>Message: {{ data_get($execution, 'message') }}</div>
+ <div class="mt-2 p-2 bg-gray-100 dark:bg-coolgray-200 rounded">
+ <pre class="whitespace-pre-wrap text-sm">{{ data_get($execution, 'message') }}</pre>
+ </div>
@endif
- <div>Size: {{ data_get($execution, 'size') }} B /
- {{ round((int) data_get($execution, 'size') / 1024, 2) }}
- kB / {{ round((int) data_get($execution, 'size') / 1024 / 1024, 3) }} MB
- </div>
- <div>Location: {{ data_get($execution, 'filename', 'N/A') }}</div>
- <div class="flex gap-2">
- <div class="flex-1"></div>
+ <div class="flex gap-2 mt-4">
@if (data_get($execution, 'status') === 'success')
- <x-forms.button class=" dark:hover:bg-coolgray-400"
+ <x-forms.button class="dark:hover:bg-coolgray-400"
x-on:click="download_file('{{ data_get($execution, 'id') }}')">Download</x-forms.button>
@endif
- <x-modal-confirmation isErrorButton action="deleteBackup({{ data_get($execution, 'id') }})">
- <x-slot:button-title>
- Delete
- </x-slot:button-title>
- This will delete this backup. It is not reversible.<br>Please think again.
- </x-modal-confirmation>
+ <x-modal-confirmation
+ title="Confirm Backup Deletion?"
+ buttonTitle="Delete"
+ isErrorButton
+ submitAction="deleteBackup({{ data_get($execution, 'id') }})"
+ {{-- :checkboxes="$checkboxes" --}}
+ :actions="[
+ 'This backup will be permanently deleted from local storage.'
+ ]"
+ confirmationText="{{ data_get($execution, 'filename') }}"
+ confirmationLabel="Please confirm the execution of the actions by entering the Backup Filename below"
+ shortConfirmationLabel="Backup Filename"
+ step3ButtonText="Permanently Delete Backup"
+ />
</div>
- </form>
-
+ </div>
@empty
- <div>No executions found.</div>
+ <div class="p-4 bg-gray-100 dark:bg-coolgray-100 rounded">No executions found.</div>
@endforelse
</div>
<script>
diff --cc resources/views/livewire/project/database/heading.blade.php
index b8156a0bfc,b3892142ec..acc26774a4
--- a/resources/views/livewire/project/database/heading.blade.php
+++ b/resources/views/livewire/project/database/heading.blade.php
@@@ -7,97 -7,88 +7,102 @@@
</x-slot:content>
</x-slide-over>
<div class="navbar-main">
- <nav class="flex items-center flex-shrink-0 gap-6 overflow-x-scroll sm:overflow-x-hidden scrollbar min-h-10 whitespace-nowrap">
- <a class="{{ request()->routeIs('project.database.configuration') ? 'dark:text-white' : '' }}" href="{{ route('project.database.configuration', $parameters) }}">
+ <nav
+ class="flex overflow-x-scroll flex-shrink-0 gap-6 items-center whitespace-nowrap sm:overflow-x-hidden scrollbar min-h-10">
+ <a class="{{ request()->routeIs('project.database.configuration') ? 'dark:text-white' : '' }}"
+ href="{{ route('project.database.configuration', $parameters) }}">
<button>Configuration</button>
</a>
- <a class="{{ request()->routeIs('project.database.command') ? 'dark:text-white' : '' }}" href="{{ route('project.database.command', $parameters) }}">
- <button>Execute Command</button>
- </a>
- <a class="{{ request()->routeIs('project.database.logs') ? 'dark:text-white' : '' }}" href="{{ route('project.database.logs', $parameters) }}">
+
+ <a class="{{ request()->routeIs('project.database.logs') ? 'dark:text-white' : '' }}"
+ href="{{ route('project.database.logs', $parameters) }}">
<button>Logs</button>
</a>
+ <a class="{{ request()->routeIs('project.database.command') ? 'dark:text-white' : '' }}"
+ href="{{ route('project.database.command', $parameters) }}">
+ <button>Terminal</button>
+ </a>
@if (
- $database->getMorphClass() === 'App\Models\StandalonePostgresql' ||
- $database->getMorphClass() === 'App\Models\StandaloneMongodb' ||
- $database->getMorphClass() === 'App\Models\StandaloneMysql' ||
- $database->getMorphClass() === 'App\Models\StandaloneMariadb')
- <a class="{{ request()->routeIs('project.database.backup.index') ? 'dark:text-white' : '' }}"
- href="{{ route('project.database.backup.index', $parameters) }}">
- <button>Backups</button>
- </a>
+ $database->getMorphClass() === 'App\Models\StandalonePostgresql' ||
+ $database->getMorphClass() === 'App\Models\StandaloneMongodb' ||
+ $database->getMorphClass() === 'App\Models\StandaloneMysql' ||
+ $database->getMorphClass() === 'App\Models\StandaloneMariadb')
+ <a class="{{ request()->routeIs('project.database.backup.index') ? 'dark:text-white' : '' }}" href="{{ route('project.database.backup.index', $parameters) }}">
+ <button>Backups</button>
+ </a>
@endif
</nav>
- <div class="flex flex-wrap items-center gap-2">
+ <div class="flex flex-wrap gap-2 items-center">
@if (!str($database->status)->startsWith('exited'))
- <x-modal-confirmation @click="$wire.dispatch('restartEvent')">
- <x-slot:button-title>
- <svg class="w-5 h-5 dark:text-warning" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
- <g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"
- stroke-width="2">
- <path d="M19.933 13.041a8 8 0 1 1-9.925-8.788c3.899-1 7.935 1.007 9.425 4.747" />
- <path d="M20 4v5h-5" />
- </g>
- </svg>
- Restart
- </x-slot:button-title>
- This database will be restarted. <br>Please think again.
- </x-modal-confirmation>
- <x-modal-confirmation @click="$wire.dispatch('stopEvent')">
- <x-slot:button-title>
- <svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 text-error" viewBox="0 0 24 24"
- stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round"
- stroke-linejoin="round">
- <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
- <path d="M6 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z">
- </path>
- <path d="M14 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z">
- </path>
- </svg>
- Stop
- </x-slot:button-title>
- This database will be stopped. <br>Please think again.
- </x-modal-confirmation>
- @else
- <button @click="$wire.dispatch('startEvent')" class="gap-2 button">
- <svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 dark:text-warning" viewBox="0 0 24 24"
- stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round"
- stroke-linejoin="round">
- <path stroke="none" d="M0 0h24v24H0z" fill="none" />
- <path d="M7 4v16l13 -8z" />
+ <x-modal-confirmation
+ title="Confirm Database Restart?"
+ buttonTitle="Restart"
+ submitAction="restart"
+ :actions="['This database will be unavailable during the restart.', 'If the database is currently in use data could be lost.']"
+ :confirmWithText="false"
+ :confirmWithPassword="false"
+ step2ButtonText="Restart Database"
+ :dispatchEvent="true"
+ dispatchEventType="restartEvent"
+ >
+ <x-slot:button-title>
+ <svg class="w-5 h-5 dark:text-warning" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
+ <g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2">
+ <path d="M19.933 13.041a8 8 0 1 1-9.925-8.788c3.899-1 7.935 1.007 9.425 4.747" />
+ <path d="M20 4v5h-5" />
+ </g>
</svg>
- Start
- </button>
+ Restart
+ </x-slot:button-title>
+ </x-modal-confirmation>
+ <x-modal-confirmation
+ title="Confirm Database Stopping?"
+ buttonTitle="Stop"
+ submitAction="stop"
+ :checkboxes="$checkboxes"
+ :actions="['This database will be stopped.', 'If the database is currently in use data could be lost.', 'All non-persistent data of this database (containers, networks, unused images) will be deleted (don\'t worry, no data is lost and you can start the database again).']"
+ :confirmWithText="false"
+ :confirmWithPassword="false"
+ step1ButtonText="Continue Stopping Database"
+ step2ButtonText="Stop Database"
+ :dispatchEvent="true"
+ dispatchEventType="stopEvent"
+ >
+ <x-slot:button-title>
+ <svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 text-error" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
+ <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
+ <path d="M6 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z">
+ </path>
+ <path d="M14 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z">
+ </path>
+ </svg>
+ Stop
+ </x-slot:button-title>
+ </x-modal-confirmation>
+ @else
+ <button @click="$wire.dispatch('startEvent')" class="gap-2 button">
+ <svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 dark:text-warning" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
+ <path stroke="none" d="M0 0h24v24H0z" fill="none" />
+ <path d="M7 4v16l13 -8z" />
+ </svg>
+ Start
+ </button>
@endif
@script
- <script>
- $wire.$on('startEvent', () => {
- window.dispatchEvent(new CustomEvent('startdatabase'));
- $wire.$call('start');
- });
- $wire.$on('stopEvent', () => {
- $wire.$dispatch('info', 'Stopping database.');
- $wire.$call('stop');
- });
- $wire.$on('restartEvent', () => {
- $wire.$dispatch('info', 'Restarting database.');
- $wire.$call('restart');
- });
- </script>
+ <script>
+ $wire.$on('startEvent', () => {
+ window.dispatchEvent(new CustomEvent('startdatabase'));
+ $wire.$call('start');
+ });
+ $wire.$on('stopEvent', () => {
+ $wire.$dispatch('info', 'Stopping database.');
+ $wire.$call('stop');
+ });
+ $wire.$on('restartEvent', () => {
+ $wire.$dispatch('info', 'Restarting database.');
+ $wire.$call('restart');
+ });
+ </script>
@endscript
</div>
</div>
diff --cc resources/views/livewire/project/service/file-storage.blade.php
index ccb50deb44,539e378854..ccef45ecab
--- a/resources/views/livewire/project/service/file-storage.blade.php
+++ b/resources/views/livewire/project/service/file-storage.blade.php
@@@ -13,61 -15,51 +15,89 @@@
<form wire:submit='submit' class="flex flex-col gap-2">
<div class="flex gap-2">
@if ($fileStorage->is_directory)
- <x-modal-confirmation action="convertToFile" buttonTitle="Convert to file">
- <div>This will delete all files in this directory. It is not reversible. <strong
- class="text-error">Please think
- again.</strong><br><br></div>
- </x-modal-confirmation>
+ <x-modal-confirmation
+ title="Confirm Directory Conversion to File?"
+ buttonTitle="Convert to file"
+ submitAction="convertToFile"
+ :actions="['All files in this directory will be permanently deleted and an empty file will be created in its place.']"
+ confirmationText="{{ $fs_path }}"
+ confirmationLabel="Please confirm the execution of the actions by entering the Filepath below"
+ shortConfirmationLabel="Filepath"
+ :confirmWithPassword="false"
+ step2ButtonText="Convert to file"
+ />
+ @else
+ <x-modal-confirmation
+ title="Confirm File Conversion to Directory?"
+ buttonTitle="Convert to directory"
+ submitAction="convertToDirectory"
+ :actions="['The selected file will be permanently deleted and an empty directory will be created in its place.']"
+ confirmationText="{{ $fs_path }}"
+ confirmationLabel="Please confirm the execution of the actions by entering the Filepath below"
+ shortConfirmationLabel="Filepath"
+ :confirmWithPassword="false"
+ step2ButtonText="Convert to directory"
+ />
+ @endif
+ @if ($fileStorage->is_directory)
+ <x-modal-confirmation
+ title="Confirm Directory Deletion?"
+ buttonTitle="Delete Directory"
+ isErrorButton
+ submitAction="delete"
+ :checkboxes="$directoryDeletionCheckboxes"
+ :actions="['The selected directory and all its contents will be permanently deleted from the container.']"
+ confirmationText="{{ $fs_path }}"
+ confirmationLabel="Please confirm the execution of the actions by entering the Filepath below"
+ shortConfirmationLabel="Filepath"
+ step3ButtonText="Permanently Delete Directory"
+ />
@else
- <x-modal-confirmation action="convertToDirectory" buttonTitle="Convert to directory">
- <div>This will delete the file and make a directory instead. It is not reversible.
- <strong class="text-error">Please think
- again.</strong><br><br>
- </div>
- </x-modal-confirmation>
+ <x-modal-confirmation
+ title="Confirm File Deletion?"
+ buttonTitle="Delete File"
+ isErrorButton
+ submitAction="delete"
+ :checkboxes="$fileDeletionCheckboxes"
+ :actions="['The selected file will be permanently deleted from the container.']"
+ confirmationText="{{ $fs_path }}"
+ confirmationLabel="Please confirm the execution of the actions by entering the Filepath below"
+ shortConfirmationLabel="Filepath"
+ step3ButtonText="Permanently Delete File"
+ />
@endif
+
+ @if (!$fileStorage->is_based_on_git)
+ <x-modal-confirmation isErrorButton buttonTitle="Delete">
+ <div class="px-2">This storage will be deleted. It is not reversible. <strong
+ class="text-error">Please
+ think
+ again.</strong><br><br></div>
+ <h4>Actions</h4>
+ @if ($fileStorage->is_directory)
+ <x-forms.checkbox id="permanently_delete"
+ label="Permanently delete directory from the server?"></x-forms.checkbox>
+ @else
+ <x-forms.checkbox id="permanently_delete"
+ label="Permanently delete file from the server?"></x-forms.checkbox>
+ @endif
+ </x-modal-confirmation>
+ @endif
</div>
@if (!$fileStorage->is_directory)
- <x-forms.textarea label="Content" rows="20" id="fileStorage.content"></x-forms.textarea>
- <x-forms.button class="w-full" type="submit">Save</x-forms.button>
+ @if (data_get($resource, 'settings.is_preserve_repository_enabled'))
+ <div class="w-96">
+ <x-forms.checkbox instantSave label="Is this based on the Git repository?"
+ id="fileStorage.is_based_on_git"></x-forms.checkbox>
+ </div>
+ @endif
+ <x-forms.textarea
+ label="{{ $fileStorage->is_based_on_git ? 'Content (refreshed after a successful deployment)' : 'Content' }}"
+ rows="20" id="fileStorage.content"
+ readonly="{{ $fileStorage->is_based_on_git }}"></x-forms.textarea>
+ @if (!$fileStorage->is_based_on_git)
+ <x-forms.button class="w-full" type="submit">Save</x-forms.button>
+ @endif
@endif
</form>
diff --cc resources/views/livewire/project/service/navbar.blade.php
index d2ba2e3855,8193fba578..da41618ef1
--- a/resources/views/livewire/project/service/navbar.blade.php
+++ b/resources/views/livewire/project/service/navbar.blade.php
@@@ -6,131 -6,116 +6,139 @@@
<livewire:activity-monitor header="Logs" showWaiting fullHeight />
</x-slot:content>
</x-slide-over>
- <h1>Configuration</h1>
+ <h1>{{ $title }}</h1>
<x-resources.breadcrumbs :resource="$service" :parameters="$parameters" />
<div class="navbar-main" x-data>
- <nav class="flex items-center flex-shrink-0 gap-6 scrollbar min-h-10 whitespace-nowrap">
- <a class="{{ request()->routeIs('project.service.configuration') ? 'dark:text-white' : '' }}" href="{{ route('project.service.configuration', $parameters) }}">
+ <nav class="flex flex-shrink-0 gap-6 items-center whitespace-nowrap scrollbar min-h-10">
+ <a class="{{ request()->routeIs('project.service.configuration') ? 'dark:text-white' : '' }}"
+ href="{{ route('project.service.configuration', $parameters) }}">
<button>Configuration</button>
</a>
+ <a class="{{ request()->routeIs('project.service.command') ? 'dark:text-white' : '' }}"
+ href="{{ route('project.service.command', $parameters) }}">
+ <button>Terminal</button>
+ </a>
<x-services.links :service="$service" />
</nav>
- <div class="flex flex-wrap items-center order-first gap-2 sm:order-last">
+ <div class="flex flex-wrap order-first gap-2 items-center sm:order-last">
@if (str($service->status())->contains('running'))
- <button @click="$wire.dispatch('restartEvent')" class="gap-2 button">
- <svg class="w-5 h-5 dark:text-warning" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
- <g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"
- stroke-width="2">
- <path d="M19.933 13.041a8 8 0 1 1-9.925-8.788c3.899-1 7.935 1.007 9.425 4.747" />
- <path d="M20 4v5h-5" />
- </g>
+ <button @click="$wire.dispatch('restartEvent')" class="gap-2 button">
+ <svg class="w-5 h-5 dark:text-warning" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
+ <g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2">
+ <path d="M19.933 13.041a8 8 0 1 1-9.925-8.788c3.899-1 7.935 1.007 9.425 4.747" />
+ <path d="M20 4v5h-5" />
+ </g>
+ </svg>
+ Pull Latest Images & Restart
+ </button>
+ <x-modal-confirmation
+ title="Confirm Service Stopping?"
+ buttonTitle="Stop"
+ submitAction="stop"
+ :checkboxes="$checkboxes"
+ :actions="['This service will be stopped.', 'If the service is currently in use data could be lost.', 'All non-persistent data of this service (containers, networks, unused images) will be deleted (don\'t worry, no data is lost and you can start the service again).']"
+ :confirmWithText="false"
+ :confirmWithPassword="false"
+ step1ButtonText="Continue Stopping Service"
+ step2ButtonText="Stop Service"
+ :dispatchEvent="true"
+ dispatchEventType="stopEvent"
+ >
+ <x-slot:button-title>
+ <svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 text-error" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
+ <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
+ <path d="M6 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z">
+ </path>
+ <path d="M14 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z">
+ </path>
</svg>
- Pull Latest Images & Restart
- </button>
- <x-modal-confirmation @click="$wire.dispatch('stopEvent')">
- <x-slot:button-title>
- <svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 text-error" viewBox="0 0 24 24"
- stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round"
- stroke-linejoin="round">
- <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
- <path d="M6 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z">
- </path>
- <path d="M14 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z">
- </path>
- </svg>
- Stop
- </x-slot:button-title>
- This service will be stopped. <br>Please think again.
- </x-modal-confirmation>
+ Stop
+ </x-slot:button-title>
+ </x-modal-confirmation>
@elseif (str($service->status())->contains('degraded'))
- <button @click="$wire.dispatch('startEvent')" class="gap-2 button">
- <svg class="w-5 h-5 dark:text-warning" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
- <g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"
- stroke-width="2">
- <path d="M19.933 13.041a8 8 0 1 1-9.925-8.788c3.899-1 7.935 1.007 9.425 4.747" />
- <path d="M20 4v5h-5" />
- </g>
+ <button @click="$wire.dispatch('startEvent')" class="gap-2 button">
+ <svg class="w-5 h-5 dark:text-warning" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
+ <g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2">
+ <path d="M19.933 13.041a8 8 0 1 1-9.925-8.788c3.899-1 7.935 1.007 9.425 4.747" />
+ <path d="M20 4v5h-5" />
+ </g>
+ </svg>
+ Restart Degraded Services
+ </button>
+ <x-modal-confirmation
+ title="Confirm Service Stopping?"
+ buttonTitle="Stop"
+ submitAction="stop"
+ :checkboxes="$checkboxes"
+ :actions="['This service will be stopped.', 'If the service is currently in use data could be lost.', 'All non-persistent data of this service (containers, networks, unused images) will be deleted (don\'t worry, no data is lost and you can start the service again).']"
+ :confirmWithText="false"
+ :confirmWithPassword="false"
+ step1ButtonText="Continue Stopping Service"
+ step2ButtonText="Stop Service"
+ :dispatchEvent="true"
+ dispatchEventType="stopEvent"
+ >
+ <x-slot:button-title>
+ <svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 text-error" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
+ <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
+ <path d="M6 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z">
+ </path>
+ <path d="M14 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z">
+ </path>
</svg>
- Restart Degraded Services
- </button>
- <x-modal-confirmation @click="$wire.dispatch('stopEvent')">
- <x-slot:button-title>
- <svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 text-error" viewBox="0 0 24 24"
- stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round"
- stroke-linejoin="round">
- <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
- <path d="M6 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z">
- </path>
- <path d="M14 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z">
- </path>
- </svg>
- Stop
- </x-slot:button-title>
- This service will be stopped. <br>Please think again.
- </x-modal-confirmation>
+ Stop
+ </x-slot:button-title>
+ </x-modal-confirmation>
@elseif (str($service->status())->contains('exited'))
- <button wire:click='stop(true)' class="gap-2 button">
- <svg class="w-5 h-5 " viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
- <path fill="red" d="M26 20h-6v-2h6zm4 8h-6v-2h6zm-2-4h-6v-2h6z" />
- <path fill="red" d="M17.003 20a4.895 4.895 0 0 0-2.404-4.173L22 3l-1.73-1l-7.577 13.126a5.699 5.699 0 0 0-5.243 1.503C3.706 20.24 3.996 28.682 4.01 29.04a1 1 0 0 0 1 .96h14.991a1 1 0 0 0 .6-1.8c-3.54-2.656-3.598-8.146-3.598-8.2Zm-5.073-3.003A3.11 3.11 0 0 1 15.004 20c0 .038.002.208.017.469l-5.9-2.624a3.8 3.8 0 0 1 2.809-.848ZM15.45 28A5.2 5.2 0 0 1 14 25h-2a6.5 6.5 0 0 0 .968 3h-2.223A16.617 16.617 0 0 1 10 24H8a17.342 17.342 0 0 0 .665 4H6c.031-1.836.29-5.892 1.803-8.553l7.533 3.35A13.025 13.025 0 0 0 17.596 28Z" />
- </svg>
- Force Cleanup Containers
- </button>
- <button @click="$wire.dispatch('startEvent')" class="gap-2 button">
- <svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 dark:text-warning" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
- <path stroke="none" d="M0 0h24v24H0z" fill="none" />
- <path d="M7 4v16l13 -8z" />
- </svg>
- Deploy
- </button>
+ <button wire:click='stop(true)' class="gap-2 button">
+ <svg class="w-5 h-5" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
+ <path fill="red" d="M26 20h-6v-2h6zm4 8h-6v-2h6zm-2-4h-6v-2h6z" />
+ <path fill="red"
+ d="M17.003 20a4.895 4.895 0 0 0-2.404-4.173L22 3l-1.73-1l-7.577 13.126a5.699 5.699 0 0 0-5.243 1.503C3.706 20.24 3.996 28.682 4.01 29.04a1 1 0 0 0 1 .96h14.991a1 1 0 0 0 .6-1.8c-3.54-2.656-3.598-8.146-3.598-8.2Zm-5.073-3.003A3.11 3.11 0 0 1 15.004 20c0 .038.002.208.017.469l-5.9-2.624a3.8 3.8 0 0 1 2.809-.848ZM15.45 28A5.2 5.2 0 0 1 14 25h-2a6.5 6.5 0 0 0 .968 3h-2.223A16.617 16.617 0 0 1 10 24H8a17.342 17.342 0 0 0 .665 4H6c.031-1.836.29-5.892 1.803-8.553l7.533 3.35A13.025 13.025 0 0 0 17.596 28Z" />
+ </svg>
+ Force Cleanup Containers
+ </button>
+ <button @click="$wire.dispatch('startEvent')" class="gap-2 button">
+ <svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 dark:text-warning" viewBox="0 0 24 24"
+ stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round"
+ stroke-linejoin="round">
+ <path stroke="none" d="M0 0h24v24H0z" fill="none" />
+ <path d="M7 4v16l13 -8z" />
+ </svg>
+ Deploy
+ </button>
@else
- <x-modal-confirmation @click="$wire.dispatch('stopEvent')">
- <x-slot:button-title>
- <svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 text-error" viewBox="0 0 24 24"
- stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round"
- stroke-linejoin="round">
- <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
- <path d="M6 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z">
- </path>
- <path d="M14 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z">
- </path>
- </svg>
- Stop
- </x-slot:button-title>
- This service will be stopped. <br>Please think again.
- </x-modal-confirmation>
- <button @click="$wire.dispatch('startEvent')" class="gap-2 button">
- <svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 dark:text-warning" viewBox="0 0 24 24"
- stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round"
- stroke-linejoin="round">
- <path stroke="none" d="M0 0h24v24H0z" fill="none" />
- <path d="M7 4v16l13 -8z" />
+ <x-modal-confirmation
+ title="Confirm Service Stopping?"
+ buttonTitle="Stop"
+ submitAction="stop"
+ :checkboxes="$checkboxes"
+ :actions="['This service will be stopped.', 'If the service is currently in use data could be lost.', 'All non-persistent data of this service (containers, networks, unused images) will be deleted (don\'t worry, no data is lost and you can start the service again).']"
+ :confirmWithText="false"
+ :confirmWithPassword="false"
+ step1ButtonText="Continue Stopping Service"
+ step2ButtonText="Stop Service"
+ :dispatchEvent="true"
+ dispatchEventType="stopEvent"
+ >
+ <x-slot:button-title>
+ <svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 text-error" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
+ <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
+ <path d="M6 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z">
+ </path>
+ <path d="M14 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z">
+ </path>
</svg>
- Deploy
- </button>
+ Stop
+ </x-slot:button-title>
+ </x-modal-confirmation>
+ <button @click="$wire.dispatch('startEvent')" class="gap-2 button">
+ <svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 dark:text-warning" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
+ <path stroke="none" d="M0 0h24v24H0z" fill="none" />
+ <path d="M7 4v16l13 -8z" />
+ </svg>
+ Deploy
+ </button>
@endif
</div>
</div>
diff --cc resources/views/livewire/project/shared/scheduled-task/show.blade.php
index b4845fb25a,51a9966101..760cf81dbb
--- a/resources/views/livewire/project/shared/scheduled-task/show.blade.php
+++ b/resources/views/livewire/project/shared/scheduled-task/show.blade.php
@@@ -1,56 -1,47 +1,53 @@@
<div>
<x-slot:title>
{{ data_get_str($resource, 'name')->limit(10) }} > Scheduled Tasks | Coolify
- </x-slot>
- @if ($type === 'application')
+ </x-slot>
+ @if ($type === 'application')
<h1>Scheduled Task</h1>
<livewire:project.application.heading :application="$resource" />
- @elseif ($type === 'service')
+ @elseif ($type === 'service')
<livewire:project.service.navbar :service="$resource" :parameters="$parameters" />
- @endif
+ @endif
- <form wire:submit="submit" class="w-full">
- <div class="flex flex-col gap-2 pb-2">
- <div class="flex items-end gap-2 pt-4">
- <h2>Scheduled Task</h2>
- <x-forms.button type="submit">
- Save
- </x-forms.button>
- <x-modal-confirmation isErrorButton buttonTitle="Delete Scheduled Task">
- You will delete scheduled task <span class="font-bold dark:text-warning">{{ $task->name }}</span>.
- </x-modal-confirmation>
- </div>
- <div class="w-48">
- <x-forms.checkbox instantSave id="task.enabled" label="Enabled" />
- </div>
+ <form wire:submit="submit" class="w-full">
+ <div class="flex flex-col gap-2 pb-2">
+ <div class="flex items-end gap-2 pt-4">
+ <h2>Scheduled Task</h2>
+ <x-forms.button type="submit">
+ Save
+ </x-forms.button>
+ <x-modal-confirmation
+ title="Confirm Scheduled Task Deletion?"
+ isErrorButton
+ buttonTitle="Delete"
+ submitAction="delete({{ $task->id }})"
+ :actions="['The selected scheduled task will be permanently deleted.']"
+ confirmationText="{{ $task->name }}"
+ confirmationLabel="Please confirm the execution of the actions by entering the Scheduled Task Name below"
+ shortConfirmationLabel="Scheduled Task Name"
+ :confirmWithPassword="false"
+ step2ButtonText="Permanently Delete Scheduled Task"
+ />
++
</div>
- <div class="w-48">
- <x-forms.checkbox instantSave id="task.enabled" label="Enabled" />
- </div>
- </div>
- <div class="flex w-full gap-2">
- <x-forms.input placeholder="Name" id="task.name" label="Name" required />
- <x-forms.input placeholder="php artisan schedule:run" id="task.command" label="Command" required />
- <x-forms.input placeholder="0 0 * * * or daily" id="task.frequency" label="Frequency" required />
- @if ($type === 'application')
+ <div class="flex w-full gap-2">
+ <x-forms.input placeholder="Name" id="task.name" label="Name" required />
+ <x-forms.input placeholder="php artisan schedule:run" id="task.command" label="Command" required />
+ <x-forms.input placeholder="0 0 * * * or daily" id="task.frequency" label="Frequency" required />
+ @if ($type === 'application')
<x-forms.input placeholder="php"
- helper="You can leave it empty if your resource only have one container." id="task.container"
+ helper="You can leave this empty if your resource only has one container." id="task.container"
label="Container name" />
- @elseif ($type === 'service')
+ @elseif ($type === 'service')
<x-forms.input placeholder="php"
- helper="You can leave it empty if your resource only have one service in your stack. Otherwise use the stack name, without the random generated id. So if you have a mysql service in your stack, use mysql."
+ helper="You can leave this empty if your resource only has one service in your stack. Otherwise use the stack name, without the random generated ID. So if you have a mysql service in your stack, use mysql."
id="task.container" label="Service name" />
- @endif
- </div>
- </form>
+ @endif
+ </div>
+ </form>
- <div class="pt-4">
- <h3 class="py-4">Recent executions <span class="text-xs text-neutral-500">(click to check output)</span></h3>
- <livewire:project.shared.scheduled-task.executions key="{{ $task->id }}" selectedKey="" :executions="$task->executions->take(-20)" />
- </div>
+ <div class="pt-4">
+ <h3 class="py-4">Recent executions <span class="text-xs text-neutral-500">(click to check output)</span></h3>
+ <livewire:project.shared.scheduled-task.executions :task="$task" key="{{ $task->id }}" selectedKey="" :executions="$task->executions->take(20)" />
+ </div>
</div>