Able to add scheduled backups through the UI

This commit is contained in:
Andras Bacsai
2023-08-09 17:57:27 +02:00
parent 04622a9e3b
commit d2a4dbf283
24 changed files with 367 additions and 20571 deletions

View File

@@ -22,7 +22,7 @@
Stop
</button>
@else
<button wire:click='start' onclick="logs.showModal()"
<button wire:click='start' onclick="startDatabase.showModal()"
class="flex items-center gap-2 cursor-pointer hover:text-white text-neutral-400">
<svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 text-warning" viewBox="0 0 24 24" stroke-width="1.5"
stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">

View File

@@ -1,16 +1,16 @@
@php use App\Actions\CoolifyTask\RunRemoteProcess; @endphp
<div>
@if ($this->activity)
@if ($header)
@if (isset($header))
<div class="flex gap-2 pb-2">
<h3>Logs</h3>
<h2>{{$header}}</h2>
@if ($isPollingActive)
<x-loading/>
@endif
</div>
@endif
<div
class="scrollbar flex flex-col-reverse w-full overflow-y-auto border border-solid rounded border-coolgray-300 max-h-[32rem] p-4 text-xs text-white">
class="scrollbar flex flex-col-reverse w-full overflow-y-auto border border-solid rounded border-coolgray-300 max-h-[32rem] p-4 text-xs text-white">
<pre class="font-mono whitespace-pre-wrap"
@if ($isPollingActive) wire:poll.2000ms="polling" @endif>{{ RunRemoteProcess::decodeOutput($this->activity) }}</pre>

View File

@@ -0,0 +1,13 @@
<dialog id="createScheduledBackup" class="modal">
<form method="dialog" class="flex flex-col gap-2 rounded modal-box" wire:submit.prevent='submit'>
<x-forms.input placeholder="1 * * * *" id="frequency" label="Frequency" required/>
<x-forms.checkbox id="keep_locally" label="Keep Backups Locally"/>
<x-forms.checkbox id="save_s3" label="Save to preconfigured S3"/>
<x-forms.button onclick="createScheduledBackup.close()" type="submit">
Save
</x-forms.button>
</form>
<form method="dialog" class="modal-backdrop">
<button>close</button>
</form>
</dialog>

View File

@@ -0,0 +1,11 @@
<div class="flex flex-wrap gap-2">
@forelse($database->scheduledBackups as $backup)
<div class="box flex flex-col">
<div>Frequency: {{$backup->frequency}}</div>
<div>Keep locally: {{$backup->keep_locally}}</div>
<div>Sync to S3: {{$backup->save_s3}}</div>
</div>
@empty
<div>No scheduled backups configured.</div>
@endforelse
</div>

View File

@@ -14,6 +14,6 @@
</x-forms.button>
</form>
<div class="container w-full pt-10 mx-auto">
<livewire:activity-monitor :header="true"/>
<livewire:activity-monitor header="Logs"/>
</div>
</div>

View File

@@ -62,7 +62,7 @@
@endif
</div>
<div class="container w-full py-4 mx-auto">
<livewire:activity-monitor :header="true"/>
<livewire:activity-monitor header="Logs"/>
</div>
@isset($uptime)
<h3 class="pb-3">Server Info</h3>

View File

@@ -21,7 +21,7 @@
</div>
@endif
<div class="container w-full pb-4 mx-auto">
<livewire:activity-monitor :header="true"/>
<livewire:activity-monitor header="Logs"/>
</div>
<x-forms.input placeholder="https://coolify.io" id="redirect_url" label="Default Redirect 404"
helper="All urls that has no service available will be redirected to this domain.<span class='text-helper'>You can set to your main marketing page or your social media link.</span>"/>

View File

@@ -1,18 +1,23 @@
<x-layout>
<h1>Backups</h1>
<livewire:project.database.heading :database="$database"/>
<x-modal modalId="startDatabase">
<x-slot:modalBody>
<livewire:activity-monitor header="Startup Logs"/>
</x-slot:modalBody>
<x-slot:modalSubmit>
<x-forms.button onclick="startDatabase.close()" type="submit">
Close
</x-forms.button>
</x-slot:modalSubmit>
</x-modal>
<livewire:project.database.create-scheduled-backup :database="$database"/>
<div class="pt-6">
<h2 class="pb-4">Scheduled Backups</h2>
<div class="flex flex-wrap gap-2">
@forelse($database->scheduledBackups as $backup)
<div class="box flex flex-col">
<div>Frequency: {{$backup->frequency}}</div>
<div>Keep locally: {{$backup->keep_locally}}</div>
<div>Sync to S3: {{$backup->save_s3}}</div>
</div>
@empty
<div>No scheduled backups configured.</div>
@endforelse
<div class="flex gap-2 ">
<h2 class="pb-4">Scheduled Backups</h2>
<x-forms.button onclick="createScheduledBackup.showModal()">+ Add</x-forms.button>
</div>
<livewire:project.database.scheduled-backups :database="$database"/>
</div>
</x-layout>

View File

@@ -1,12 +1,12 @@
<x-layout>
<h1>Configuration</h1>
<livewire:project.database.heading :database="$database"/>
<x-modal modalId="logs">
<x-modal modalId="startDatabase">
<x-slot:modalBody>
<livewire:activity-monitor :header="true"/>
<livewire:activity-monitor header="Startup Logs"/>
</x-slot:modalBody>
<x-slot:modalSubmit>
<x-forms.button onclick="logs.close()" type="submit">
<x-forms.button onclick="startDatabase.close()" type="submit">
Close
</x-forms.button>
</x-slot:modalSubmit>