2.x - databases

This commit is contained in:
Saeed Vaziry
2024-09-29 00:30:04 +02:00
parent 32993025de
commit e4fed24498
62 changed files with 802 additions and 237 deletions

View File

@ -4,15 +4,13 @@
use App\Models\Server;
use App\Models\ServerLog;
use App\Web\Components\Page;
use App\Web\Pages\Servers\Logs\Widgets\LogsList;
use App\Web\Traits\PageHasServer;
use App\Web\Traits\PageHasWidgets;
use Filament\Pages\Page;
class Index extends Page
{
use PageHasServer;
use PageHasWidgets;
protected static ?string $slug = 'servers/{server}/logs';

View File

@ -23,16 +23,18 @@ protected function getTableQuery(): Builder
return ServerLog::query()->where('server_id', $this->server->id);
}
protected static ?string $heading = 'Logs';
protected static ?string $heading = '';
protected function getTableColumns(): array
{
return [
TextColumn::make('name')
->label('Event')
->searchable()
->sortable(),
TextColumn::make('created_at_by_timezone')
TextColumn::make('created_at')
->label('Created At')
->formatStateUsing(fn ($record) => $record->created_at_by_timezone)
->sortable(),
];
}
@ -68,7 +70,8 @@ public function getTable(): Table
])
->actions([
Action::make('view')
->label('View')
->hiddenLabel()
->tooltip('View')
->icon('heroicon-o-eye')
->authorize(fn ($record) => auth()->user()->can('view', $record))
->modalHeading('View Log')
@ -81,7 +84,8 @@ public function getTable(): Table
->modalSubmitAction(false)
->modalCancelActionLabel('Close'),
Action::make('download')
->label('Download')
->hiddenLabel()
->tooltip('Download')
->color('secondary')
->icon('heroicon-o-archive-box-arrow-down')
->authorize(fn ($record) => auth()->user()->can('view', $record))