Add join token analytics dashboard and align Filament views
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
tests / ui (push) Has been cancelled

This commit is contained in:
Codex Agent
2026-01-04 18:21:59 +01:00
parent 48b1cfde09
commit 15e19d4e8b
17 changed files with 1176 additions and 310 deletions

View File

@@ -1,20 +1,48 @@
<x-filament-panels::page>
<div class="space-y-6">
<x-filament::section heading="Compose Controls">
<div class="grid gap-4 md:grid-cols-2">
@foreach($composes as $compose)
<div class="rounded-2xl border border-slate-200/70 bg-white/80 p-4 shadow-sm dark:border-white/10 dark:bg-slate-900/60">
<div class="flex items-center justify-between">
<div>
<p class="text-sm font-semibold text-slate-700 dark:text-slate-200">{{ $compose['label'] }}</p>
<p class="text-xs text-slate-500 dark:text-slate-400">{{ $compose['compose_id'] }}</p>
</div>
<span class="rounded-full bg-slate-100 px-3 py-1 text-xs font-semibold text-slate-700 dark:bg-slate-800 dark:text-slate-100">
{{ ucfirst($compose['status'] ?? 'unknown') }}
</span>
</div>
@php
use Filament\Support\Enums\GridDirection;
use Filament\Support\Icons\Heroicon;
use Illuminate\View\ComponentAttributeBag;
<div class="mt-4 flex flex-wrap gap-2">
$composeStatusColors = [
'done' => 'success',
'deploying' => 'warning',
'pending' => 'warning',
'unreachable' => 'danger',
'error' => 'danger',
'failed' => 'danger',
];
$composeStatusIcons = [
'done' => Heroicon::CheckCircle,
'deploying' => Heroicon::ArrowPath,
'pending' => Heroicon::Clock,
'unreachable' => Heroicon::ExclamationTriangle,
'error' => Heroicon::XCircle,
'failed' => Heroicon::XCircle,
];
$stacked = (new ComponentAttributeBag())->grid(['default' => 1], GridDirection::Column);
$composeGrid = (new ComponentAttributeBag())->grid(['default' => 1, 'lg' => 2]);
$actionsGrid = (new ComponentAttributeBag())->grid(['default' => 1, 'sm' => 3]);
$logsGrid = (new ComponentAttributeBag())->grid(['default' => 1, 'lg' => 2]);
@endphp
<x-filament-panels::page>
<div {{ $stacked }}>
<x-filament::section heading="Compose Controls" :icon="Heroicon::RocketLaunch">
<div {{ $composeGrid }}>
@forelse($composes as $compose)
<x-filament::card :heading="$compose['label']" :description="$compose['compose_id']">
<x-slot name="afterHeader">
<x-filament::badge
:color="$composeStatusColors[$compose['status']] ?? 'gray'"
:icon="$composeStatusIcons[$compose['status']] ?? Heroicon::QuestionMarkCircle"
>
{{ ucfirst($compose['status'] ?? 'unknown') }}
</x-filament::badge>
</x-slot>
<div {{ $actionsGrid }}>
<x-filament::button size="sm" color="warning" wire:click="redeploy('{{ $compose['compose_id'] }}')">
Redeploy
</x-filament::button>
@@ -22,48 +50,79 @@
Stop
</x-filament::button>
@if($dokployWebUrl)
<x-filament::button tag="a" size="sm" color="gray" href="{{ rtrim($dokployWebUrl, '/') }}" target="_blank">
<x-filament::button
tag="a"
size="sm"
color="gray"
href="{{ rtrim($dokployWebUrl, '/') }}"
target="_blank"
:icon="Heroicon::ArrowTopRightOnSquare"
>
Open in Dokploy
</x-filament::button>
@endif
</div>
</div>
@endforeach
</x-filament::card>
@empty
<x-filament::empty-state heading="No compose stacks configured." :icon="Heroicon::QuestionMarkCircle" />
@endforelse
</div>
</x-filament::section>
<x-filament::section heading="Recent Actions">
<div class="overflow-x-auto">
<table class="min-w-full text-sm">
<thead>
<tr class="text-left text-xs uppercase tracking-wide text-slate-500">
<th class="px-3 py-2">When</th>
<th class="px-3 py-2">User</th>
<th class="px-3 py-2">Target</th>
<th class="px-3 py-2">Action</th>
<th class="px-3 py-2">Status</th>
</tr>
</thead>
<tbody class="divide-y divide-slate-100">
@forelse($recentLogs as $log)
<tr>
<td class="px-3 py-2 text-slate-700 dark:text-slate-200">{{ $log['created_at'] }}</td>
<td class="px-3 py-2 text-slate-600">{{ $log['user'] }}</td>
<td class="px-3 py-2 font-mono text-xs">{{ $log['service_id'] }}</td>
<td class="px-3 py-2">{{ ucfirst($log['action']) }}</td>
<td class="px-3 py-2">{{ $log['status_code'] ?? '—' }}</td>
</tr>
@empty
<tr>
<td colspan="5" class="px-3 py-4 text-center text-slate-500">No actions recorded yet.</td>
</tr>
@endforelse
</tbody>
</table>
</div>
<x-filament::link href="{{ route('filament.superadmin.resources.infrastructure-action-logs.index') }}" class="mt-3 inline-flex text-sm text-primary-600">
View full log
</x-filament::link>
<x-filament::section heading="Recent Actions" :icon="Heroicon::Clock">
@if(empty($recentLogs))
<x-filament::empty-state heading="No actions recorded yet." :icon="Heroicon::Clock" />
@else
<div {{ $logsGrid }}>
@foreach($recentLogs as $log)
@php
$statusCode = $log['status_code'] ?? null;
$statusColor = 'gray';
$statusIcon = Heroicon::QuestionMarkCircle;
if (is_numeric($statusCode)) {
if ($statusCode >= 500) {
$statusColor = 'danger';
$statusIcon = Heroicon::XCircle;
} elseif ($statusCode >= 400) {
$statusColor = 'danger';
$statusIcon = Heroicon::ExclamationTriangle;
} elseif ($statusCode >= 300) {
$statusColor = 'warning';
$statusIcon = Heroicon::ExclamationTriangle;
} elseif ($statusCode >= 200) {
$statusColor = 'success';
$statusIcon = Heroicon::CheckCircle;
}
}
@endphp
<x-filament::card :heading="$log['service_id']" :description="$log['created_at']">
<div {{ $stacked }}>
<x-filament::badge color="gray" :icon="Heroicon::User">
{{ $log['user'] }}
</x-filament::badge>
<x-filament::badge color="gray" :icon="Heroicon::CommandLine">
{{ ucfirst($log['action']) }}
</x-filament::badge>
<x-filament::badge :color="$statusColor" :icon="$statusIcon">
{{ $statusCode ?? '—' }}
</x-filament::badge>
</div>
</x-filament::card>
@endforeach
</div>
@endif
<x-filament::button
tag="a"
href="{{ route('filament.superadmin.resources.infrastructure-action-logs.index') }}"
color="gray"
size="sm"
:icon="Heroicon::ArrowTopRightOnSquare"
>
View full log
</x-filament::button>
</x-filament::section>
</div>
</x-filament-panels::page>