mirror of
https://github.com/tiennm99/coolify.git
synced 2026-10-14 08:18:08 +00:00
feat(service): unify database and storage backups on one page
List service database schedules with volume backups, add a database picker when creating scheduled DB backups from the service page, and cover the unified table and create flow in tests.
This commit is contained in:
1 parent
12b14665b5
commit
c0b75d04a6
8 files changed
+288
-51
No files matched your search
@@ -2,8 +2,10 @@
|
||||
|
||||
namespace App\Livewire\Project\Service\VolumeBackup;
|
||||
|
||||
use App\Models\ScheduledDatabaseBackup;
|
||||
use App\Models\ScheduledVolumeBackup;
|
||||
use App\Models\Service;
|
||||
use App\Models\ServiceDatabase;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
use Livewire\Component;
|
||||
@@ -30,6 +32,18 @@ class Index extends Component
|
||||
|
||||
public function render(): View
|
||||
{
|
||||
$databaseTargets = $this->service->databases->filter(
|
||||
fn (ServiceDatabase $database): bool => $database->isBackupSolutionAvailable(),
|
||||
);
|
||||
|
||||
$databaseBackups = ScheduledDatabaseBackup::query()
|
||||
->with(['database', 'latest_log', 's3'])
|
||||
->withCount('executions')
|
||||
->where('database_type', (new ServiceDatabase)->getMorphClass())
|
||||
->whereHasMorph('database', [ServiceDatabase::class], fn ($query) => $query->where('service_id', $this->service->id))
|
||||
->latest()
|
||||
->get();
|
||||
|
||||
$backups = ScheduledVolumeBackup::query()
|
||||
->with(['backupable.resource', 'latestExecution', 's3'])
|
||||
->withCount('executions')
|
||||
@@ -37,7 +51,11 @@ class Index extends Component
|
||||
->latest()
|
||||
->get();
|
||||
|
||||
return view('livewire.project.service.volume-backup.index', ['backups' => $backups]);
|
||||
return view('livewire.project.service.volume-backup.index', [
|
||||
'backups' => $backups,
|
||||
'databaseBackups' => $databaseBackups,
|
||||
'databaseTargets' => $databaseTargets,
|
||||
]);
|
||||
}
|
||||
|
||||
private function findService(): Service
|
||||
|
||||
Reference in new issue
Block a user