records(fn () => $this->files) ->columns([ TextColumn::make('name') ->label(__('File Name')) ->icon('heroicon-o-document') ->searchable() ->limit(40), TextColumn::make('size') ->label(__('Size')) ->formatStateUsing(fn ($state): string => $state ? number_format($state / 1024, 1) . ' KB' : '-'), TextColumn::make('date') ->label(__('Quarantined')) ->date('M d, Y H:i'), ]) ->actions([ Action::make('delete') ->label(__('Delete')) ->icon('heroicon-o-trash') ->color('danger') ->requiresConfirmation() ->modalHeading(__('Delete Quarantined File')) ->modalDescription(__('Are you sure you want to permanently delete this file? This action cannot be undone.')) ->action(function (array $record): void { try { $agent = new AgentClient(); $result = $agent->send('clamav.delete_quarantined', [ 'filename' => $record['name'], ]); if ($result['success'] ?? false) { Notification::make() ->title(__('File Deleted')) ->success() ->send(); $this->dispatch('refresh-security-data'); } else { throw new \Exception($result['error'] ?? __('Failed to delete file')); } } catch (\Exception $e) { Notification::make() ->title(__('Error')) ->body($e->getMessage()) ->danger() ->send(); } }), ]) ->striped() ->emptyStateHeading(__('No quarantined files')) ->emptyStateDescription(__('No files are currently in quarantine.')) ->emptyStateIcon('heroicon-o-archive-box'); } public function render() { return $this->getTable()->render(); } }