mirror of
https://github.com/tiennm99/coolify.git
synced 2026-08-21 10:26:49 +00:00
Add polymorphic volume backup scheduling for persistent volumes and directories, expose schedule management via API, and reorganize backup configuration and execution views.
61 lines
2.0 KiB
PHP
61 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace App\Livewire\Project\Database\Backup;
|
|
|
|
use App\Models\ScheduledDatabaseBackup;
|
|
use Livewire\Component;
|
|
|
|
class Execution extends Component
|
|
{
|
|
public $database;
|
|
|
|
public ?ScheduledDatabaseBackup $backup;
|
|
|
|
public $executions;
|
|
|
|
public $s3s;
|
|
|
|
public array $parameters = [];
|
|
|
|
public string $section = 'general';
|
|
|
|
public function mount()
|
|
{
|
|
$backup_uuid = request()->route('backup_uuid');
|
|
$project = currentTeam()->load(['projects'])->projects->where('uuid', request()->route('project_uuid'))->first();
|
|
if (! $project) {
|
|
return redirect()->route('dashboard');
|
|
}
|
|
$environment = $project->load(['environments'])->environments->where('uuid', request()->route('environment_uuid'))->first()->load(['applications']);
|
|
if (! $environment) {
|
|
return redirect()->route('dashboard');
|
|
}
|
|
$database = $environment->databases()->where('uuid', request()->route('database_uuid'))->first();
|
|
if (! $database) {
|
|
return redirect()->route('dashboard');
|
|
}
|
|
$backup = $database->scheduledBackups->where('uuid', $backup_uuid)->first();
|
|
if (! $backup) {
|
|
return redirect()->route('dashboard');
|
|
}
|
|
$executions = collect($backup->executions)->sortByDesc('created_at');
|
|
$this->database = $database;
|
|
$this->backup = $backup;
|
|
$this->executions = $executions;
|
|
$this->s3s = currentTeam()->s3s;
|
|
$this->parameters = get_route_parameters();
|
|
$this->section = match (request()->route()?->getName()) {
|
|
'project.database.backup.s3' => 's3',
|
|
'project.database.backup.retention' => 'retention',
|
|
'project.database.backup.executions' => 'executions',
|
|
'project.database.backup.danger' => 'danger',
|
|
default => 'general',
|
|
};
|
|
}
|
|
|
|
public function render()
|
|
{
|
|
return view('livewire.project.database.backup.execution');
|
|
}
|
|
}
|