fix(ui): Instance Backup settings
- Only show and enable instance backup settings when the server is functional
This commit is contained in:
@@ -15,6 +15,8 @@ class SettingsBackup extends Component
|
|||||||
{
|
{
|
||||||
public InstanceSettings $settings;
|
public InstanceSettings $settings;
|
||||||
|
|
||||||
|
public Server $server;
|
||||||
|
|
||||||
public ?StandalonePostgresql $database = null;
|
public ?StandalonePostgresql $database = null;
|
||||||
|
|
||||||
public ScheduledDatabaseBackup|null|array $backup = [];
|
public ScheduledDatabaseBackup|null|array $backup = [];
|
||||||
@@ -46,6 +48,7 @@ class SettingsBackup extends Component
|
|||||||
return redirect()->route('dashboard');
|
return redirect()->route('dashboard');
|
||||||
} else {
|
} else {
|
||||||
$settings = instanceSettings();
|
$settings = instanceSettings();
|
||||||
|
$this->server = Server::findOrFail(0);
|
||||||
$this->database = StandalonePostgresql::whereName('coolify-db')->first();
|
$this->database = StandalonePostgresql::whereName('coolify-db')->first();
|
||||||
$s3s = S3Storage::whereTeamId(0)->get() ?? [];
|
$s3s = S3Storage::whereTeamId(0)->get() ?? [];
|
||||||
if ($this->database) {
|
if ($this->database) {
|
||||||
@@ -60,6 +63,10 @@ class SettingsBackup extends Component
|
|||||||
$this->database->save();
|
$this->database->save();
|
||||||
}
|
}
|
||||||
$this->backup = $this->database->scheduledBackups->first();
|
$this->backup = $this->database->scheduledBackups->first();
|
||||||
|
if ($this->backup && ! $this->server->isFunctional()) {
|
||||||
|
$this->backup->enabled = false;
|
||||||
|
$this->backup->save();
|
||||||
|
}
|
||||||
$this->executions = $this->backup->executions;
|
$this->executions = $this->backup->executions;
|
||||||
}
|
}
|
||||||
$this->settings = $settings;
|
$this->settings = $settings;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<div class="flex flex-col">
|
<div class="flex flex-col">
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-2">
|
||||||
<h2>Backup</h2>
|
<h2>Backup</h2>
|
||||||
@if (isset($database))
|
@if (isset($database) && $server->isFunctional())
|
||||||
<x-forms.button type="submit" wire:click="submit">
|
<x-forms.button type="submit" wire:click="submit">
|
||||||
Save
|
Save
|
||||||
</x-forms.button>
|
</x-forms.button>
|
||||||
@@ -14,26 +14,39 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="pb-4">Backup configuration for Coolify instance.</div>
|
<div class="pb-4">Backup configuration for Coolify instance.</div>
|
||||||
<div>
|
<div>
|
||||||
@if (isset($database) && isset($backup))
|
@if ($server->isFunctional())
|
||||||
<div class="flex flex-col gap-3 pb-4">
|
@if (isset($database) && isset($backup))
|
||||||
<div class="flex gap-2">
|
<div class="flex flex-col gap-3 pb-4">
|
||||||
<x-forms.input label="UUID" readonly id="uuid" />
|
<div class="flex gap-2">
|
||||||
<x-forms.input label="Name" readonly id="name" />
|
<x-forms.input label="UUID" readonly id="uuid" />
|
||||||
<x-forms.input label="Description" id="description" />
|
<x-forms.input label="Name" readonly id="name" />
|
||||||
|
<x-forms.input label="Description" id="description" />
|
||||||
|
</div>
|
||||||
|
<div class="flex gap-2">
|
||||||
|
<x-forms.input label="User" readonly id="postgres_user" />
|
||||||
|
<x-forms.input type="password" label="Password" readonly id="postgres_password" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex gap-2">
|
<livewire:project.database.backup-edit :backup="$backup" :s3s="$s3s" :status="data_get($database, 'status')" />
|
||||||
<x-forms.input label="User" readonly id="postgres_user" />
|
<div class="py-4">
|
||||||
<x-forms.input type="password" label="Password" readonly id="postgres_password" />
|
<livewire:project.database.backup-executions :backup="$backup" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
@else
|
||||||
<livewire:project.database.backup-edit :backup="$backup" :s3s="$s3s" :status="data_get($database, 'status')" />
|
To configure automatic backup for your Coolify instance, you first need to add a database resource
|
||||||
<div class="py-4">
|
into Coolify.
|
||||||
<livewire:project.database.backup-executions :backup="$backup" />
|
<x-forms.button class="mt-2" wire:click="addCoolifyDatabase">Configure Backup</x-forms.button>
|
||||||
</div>
|
@endif
|
||||||
@else
|
@else
|
||||||
To configure automatic backup for your Coolify instance, you first need to add a database resource
|
<div class="p-6 bg-red-500/10 rounded-lg border border-red-500/20">
|
||||||
into Coolify.
|
<div class="text-red-500 font-medium mb-4">
|
||||||
<x-forms.button class="mt-2" wire:click="addCoolifyDatabase">Configure Backup</x-forms.button>
|
Instance Backup is currently disabled because the localhost server is not properly validated.
|
||||||
|
Please validate your server to enable Instance Backup.
|
||||||
|
</div>
|
||||||
|
<a href="{{ route('server.show', [$server->uuid]) }}"
|
||||||
|
class="text-black hover:text-gray-700 dark:text-white dark:hover:text-gray-200 underline">
|
||||||
|
Go to Server Settings to Validate
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user