Files
fotospiel-app/app/Filament/Resources/InfrastructureActionLogs/InfrastructureActionLogResource.php

72 lines
2.4 KiB
PHP

<?php
namespace App\Filament\Resources\InfrastructureActionLogs;
use App\Filament\Resources\InfrastructureActionLogs\Pages\ManageInfrastructureActionLogs;
use App\Models\InfrastructureActionLog;
use BackedEnum;
use Filament\Resources\Resource;
use Filament\Support\Icons\Heroicon;
use Filament\Tables;
use Filament\Tables\Table;
use UnitEnum;
class InfrastructureActionLogResource extends Resource
{
protected static ?string $model = InfrastructureActionLog::class;
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedRectangleStack;
protected static string|UnitEnum|null $navigationGroup = 'Platform';
protected static ?int $navigationSort = 90;
public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('created_at')
->label('Timestamp')
->sortable()
->dateTime(),
Tables\Columns\TextColumn::make('user.name')
->label('User')
->sortable()
->searchable(),
Tables\Columns\TextColumn::make('service_id')
->label('Target')
->searchable()
->copyable()
->limit(30),
Tables\Columns\BadgeColumn::make('action')
->label('Action')
->colors([
'warning' => fn ($state) => in_array($state, ['compose.redeploy', 'redeploy'], true),
'success' => fn ($state) => in_array($state, ['compose.deploy', 'deploy'], true),
'danger' => fn ($state) => in_array($state, ['compose.stop', 'stop'], true),
'gray' => fn ($state) => $state === 'logs',
])
->sortable(),
Tables\Columns\TextColumn::make('status_code')
->label('HTTP')
->sortable(),
])
->filters([
//
])
->recordActions([
Tables\Actions\ViewAction::make(),
])
->toolbarActions([
//
]);
}
public static function getPages(): array
{
return [
'index' => ManageInfrastructureActionLogs::route('/'),
];
}
}