55 lines
1.7 KiB
PHP
55 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\BackupSetResource\Pages;
|
|
|
|
use App\Filament\Resources\BackupSetResource;
|
|
use App\Support\BackupHealth\TenantBackupHealthAssessment;
|
|
use App\Support\Filament\CanonicalAdminTenantFilterState;
|
|
use Filament\Resources\Pages\ListRecords;
|
|
|
|
class ListBackupSets extends ListRecords
|
|
{
|
|
protected static string $resource = BackupSetResource::class;
|
|
|
|
public function mount(): void
|
|
{
|
|
app(CanonicalAdminTenantFilterState::class)->sync(
|
|
$this->getTableFiltersSessionKey(),
|
|
request: request(),
|
|
tenantFilterName: null,
|
|
);
|
|
|
|
parent::mount();
|
|
}
|
|
|
|
private function tableHasRecords(): bool
|
|
{
|
|
return $this->getTableRecords()->count() > 0;
|
|
}
|
|
|
|
protected function getHeaderActions(): array
|
|
{
|
|
return [
|
|
BackupSetResource::makeCreateAction()
|
|
->visible(fn (): bool => $this->tableHasRecords()),
|
|
];
|
|
}
|
|
|
|
protected function getTableEmptyStateActions(): array
|
|
{
|
|
return [
|
|
BackupSetResource::makeCreateAction(),
|
|
];
|
|
}
|
|
|
|
public function getSubheading(): ?string
|
|
{
|
|
return match (request()->string('backup_health_reason')->toString()) {
|
|
TenantBackupHealthAssessment::REASON_NO_BACKUP_BASIS => 'No usable completed backup basis is currently available for this tenant.',
|
|
TenantBackupHealthAssessment::REASON_LATEST_BACKUP_STALE => 'The latest backup detail is no longer available, so this view stays on the backup-set list.',
|
|
TenantBackupHealthAssessment::REASON_LATEST_BACKUP_DEGRADED => 'The latest backup detail is no longer available, so this view stays on the backup-set list.',
|
|
default => null,
|
|
};
|
|
}
|
|
}
|