@php
$iconPalettes = [
'wa-mint' => ['bg' => 'bg-wa-mint', 'fg' => 'text-wa-deep'],
'blue' => ['bg' => 'bg-[#D9E5F2]', 'fg' => 'text-[#13478A]'],
'purple' => ['bg' => 'bg-[#F3E9FF]', 'fg' => 'text-[#5B3D8A]'],
'green' => ['bg' => 'bg-[#E8F5E9]', 'fg' => 'text-wa-deep'],
'paused' => ['bg' => 'bg-paper-100', 'fg' => 'text-ink-700'],
];
@endphp
@forelse ($hooks as $hook)
@php
$events = $hook->events ?? [];
$shownTags = array_slice($events, 0, 2);
$extra = max(0, count($events) - count($shownTags));
$palette = $iconPalettes[$hook->icon_color ?? 'wa-mint'] ?? $iconPalettes['wa-mint'];
if ($hook->state_label === 'paused') {
$palette = $iconPalettes['paused'];
}
$rate = $hook->success_rate;
$rateBar =
$hook->state_label === 'failing' ? 'bg-accent-amber' : ($rate >= 95 ? 'bg-wa-deep' : 'bg-accent-amber');
$rateColor = $hook->state_label === 'failing' ? 'text-accent-amber' : 'text-ink-900';
$totalTries = $hook->success_count + $hook->failure_count;
// "—" not "/" for the no-data state — a slash looked like an
// accidental separator on the listing.
$lastFiredAgo = $hook->last_fired_at ? $hook->last_fired_at->diffForHumans() : 'never';
$lastFiredTime = $hook->last_fired_at ? $hook->last_fired_at->format('H:i') : '—';
@endphp
|
|
{{ $hook->webhook_url }}
{{ $hook->environment ?: 'Production' }}
/ {{ $hook->http_method ?: 'POST' }}{{ $hook->name ? ' / ' . $hook->name : '' }}
|
@foreach ($shownTags as $ev)
{{ $ev }}
@endforeach
@if ($extra > 0)
+{{ $extra }}
{{ __('more') }}
@endif
@if (empty($shownTags))
{{ __('no events') }}
@endif
|
{{ $lastFiredTime }}
{{ $lastFiredAgo }}
|
@if ($totalTries === 0)
— no fires yet
@else
{{ number_format($rate, 1) }}%
{{ number_format($hook->success_count) }} /
{{ number_format($totalTries) }}{{ $hook->retry_count ? ' / ' . number_format($hook->retry_count) . ' retries' : '' }}
@endif
|
@if ($hook->last_latency_ms)
{{ $hook->last_latency_ms < 1000 ? $hook->last_latency_ms . 'ms' : number_format($hook->last_latency_ms / 1000, 1) . 's' }}
{{ $hook->last_status_code ? 'HTTP ' . $hook->last_status_code : 'last' }}
@else
—
@endif
|
@php $tooltip = $hook->last_error ? mb_substr((string) $hook->last_error, 0, 240) : ''; @endphp
@if ($hook->state_label === 'active')
Active
@elseif ($hook->state_label === 'failing')
Failing
@if ($tooltip)
{{ $tooltip }}
@endif
@else
Paused
@endif
|
|
@empty
|
@include('user.partials.empty-state', [
'message' =>
'No webhook endpoints match the current filters. Try clearing filters or add an endpoint.',
'resetHref' => url('/webhooks'),
'actionHref' => url('/webhooks/create'),
'actionLabel' => 'Add endpoint',
])
|
@endforelse