Files
coolify/app/Livewire/Project/Application/Backup/Index.php
T
Andras Bacsai 0a567cb8e7 feat(backups): refresh backup views live on team channel events
- Refresh application, database and volume backup lists on BackupCreated
- Refresh backup execution, edit and service resource views on
  ServiceStatusChanged as well as ServiceChecked
- Hide the deployments counter when only the current page's application
  is deploying, since its heading already shows "Deploying…"
- Show storage section shortcuts in the service configuration sidebar
- Drive server sidebar Sentinel/Security active state from activeMenu
  and activeSubMenu instead of route matching
- Start the app sidebar expanded for new users
- Drop a column from the backup executions table grid and adjust the
  responsive breakpoints
- Update the related feature tests
2026-10-15 14:10:14 +02:00

66 lines
1.8 KiB
PHP

<?php
namespace App\Livewire\Project\Application\Backup;
use App\Models\Application;
use App\Models\ScheduledVolumeBackup;
use App\Traits\ListensToTeamChannel;
use Illuminate\Contracts\View\View;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Livewire\Component;
class Index extends Component
{
use AuthorizesRequests;
use ListensToTeamChannel;
public Application $application;
public array $parameters;
public string $search = '';
public function getListeners(): array
{
return [
'refreshVolumeBackups' => '$refresh',
...$this->teamChannelListeners(['BackupCreated' => '$refresh']),
];
}
public function mount(): void
{
$this->application = $this->findApplication();
$this->authorize('view', $this->application);
$this->parameters = get_route_parameters();
$this->search = request()->string('search')->toString();
}
public function render(): View
{
$backups = ScheduledVolumeBackup::query()
->with(['backupable', 'latestExecution', 's3', 's3Storages'])
->withCount('executions')
->forApplication($this->application)
->latest()
->get();
return view('livewire.project.application.backup.index', ['backups' => $backups]);
}
private function findApplication(): Application
{
$project = currentTeam()->projects()
->where('uuid', request()->route('project_uuid'))
->firstOrFail();
$environment = $project->environments()
->where('uuid', request()->route('environment_uuid'))
->firstOrFail();
return $environment->applications()
->with('destination.server')
->where('uuid', request()->route('application_uuid'))
->firstOrFail();
}
}