81 lines
2.6 KiB
PHP
81 lines
2.6 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\InfrastructureActionLogs;
|
|
|
|
use App\Filament\Clusters\RareAdmin\RareAdminCluster;
|
|
use App\Filament\Resources\InfrastructureActionLogs\Pages\ManageInfrastructureActionLogs;
|
|
use App\Models\InfrastructureActionLog;
|
|
use BackedEnum;
|
|
use Filament\Actions\ViewAction;
|
|
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 $cluster = RareAdminCluster::class;
|
|
|
|
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedRectangleStack;
|
|
|
|
protected static string|UnitEnum|null $navigationGroup = null;
|
|
|
|
protected static ?int $navigationSort = 90;
|
|
|
|
public static function getNavigationGroup(): UnitEnum|string|null
|
|
{
|
|
return __('admin.nav.infrastructure');
|
|
}
|
|
|
|
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([
|
|
ViewAction::make(),
|
|
])
|
|
->toolbarActions([
|
|
//
|
|
]);
|
|
}
|
|
|
|
public static function getPages(): array
|
|
{
|
|
return [
|
|
'index' => ManageInfrastructureActionLogs::route('/'),
|
|
];
|
|
}
|
|
}
|