mirror of
https://github.com/tiennm99/coolify.git
synced 2026-10-14 20:17:05 +00:00
feat(volume-backups): add service backup UI and polish layouts
Add dedicated service volume-backup Livewire pages and routes, wire shared storage backups for services, and pass S3 trusted hosts into MinIO resolve options. Also refine breadcrumbs, sticky sidebars, destination/GitHub layouts, resource filters, and login recovery link.
This commit is contained in:
1 parent
0312cc8ffb
commit
5842d77b81
69 files changed
+1607
-501
No files matched your search
@@ -67,6 +67,43 @@ class ScheduledVolumeBackup extends BaseModel
|
||||
});
|
||||
}
|
||||
|
||||
public function scopeForService(Builder $query, Service $service): Builder
|
||||
{
|
||||
$resources = $service->applications()->get()->concat($service->databases()->get());
|
||||
if ($resources->isEmpty()) {
|
||||
return $query->whereRaw('1 = 0');
|
||||
}
|
||||
$resourceIdsByType = $resources->groupBy(fn (Model $resource): string => $resource->getMorphClass());
|
||||
|
||||
$volumeIds = LocalPersistentVolume::query()
|
||||
->where(function (Builder $query) use ($resourceIdsByType): void {
|
||||
foreach ($resourceIdsByType as $type => $resources) {
|
||||
$query->orWhere(fn (Builder $query) => $query
|
||||
->where('resource_type', $type)
|
||||
->whereIn('resource_id', $resources->pluck('id')));
|
||||
}
|
||||
})->pluck('id');
|
||||
$directoryIds = LocalFileVolume::query()
|
||||
->where('is_directory', true)
|
||||
->where('is_host_file', false)
|
||||
->where(function (Builder $query) use ($resourceIdsByType): void {
|
||||
foreach ($resourceIdsByType as $type => $resources) {
|
||||
$query->orWhere(fn (Builder $query) => $query
|
||||
->where('resource_type', $type)
|
||||
->whereIn('resource_id', $resources->pluck('id')));
|
||||
}
|
||||
})->pluck('id');
|
||||
|
||||
return $query->where(function (Builder $query) use ($volumeIds, $directoryIds): void {
|
||||
$query->where(fn (Builder $query) => $query
|
||||
->where('backupable_type', (new LocalPersistentVolume)->getMorphClass())
|
||||
->whereIn('backupable_id', $volumeIds))
|
||||
->orWhere(fn (Builder $query) => $query
|
||||
->where('backupable_type', (new LocalFileVolume)->getMorphClass())
|
||||
->whereIn('backupable_id', $directoryIds));
|
||||
});
|
||||
}
|
||||
|
||||
public function backupable(): MorphTo
|
||||
{
|
||||
return $this->morphTo();
|
||||
|
||||
Reference in new issue
Block a user