clusev/resources/views/livewire/modals/fail2ban-bans.blade.php

71 lines
3.7 KiB
PHP

<div class="p-5 sm:p-6" wire:init="load">
<div class="flex items-start gap-3.5">
<span class="grid h-10 w-10 shrink-0 place-items-center rounded-md border border-offline/30 bg-offline/10 text-offline">
<x-icon name="shield" class="h-5 w-5" />
</span>
<div class="min-w-0 flex-1">
<h2 class="font-display text-base font-semibold text-ink">{{ __('servers.fail2ban_bans_title') }}</h2>
<p class="mt-1 text-sm leading-relaxed text-ink-2">{{ __('servers.fail2ban_bans_subtitle') }}</p>
</div>
</div>
@if ($error)
<div class="mt-4 flex items-center gap-2.5 rounded-md border border-offline/25 bg-offline/10 px-3.5 py-3">
<x-icon name="alert" class="h-4 w-4 shrink-0 text-offline" />
<p class="text-sm text-ink-2">{{ $error }}</p>
</div>
@endif
<div class="mt-4 max-h-96 divide-y divide-line overflow-y-auto rounded-md border border-line">
@if (! $loaded)
@for ($i = 0; $i < 4; $i++)
<div class="px-3.5 py-3">
<div class="flex items-center justify-between gap-2">
<x-skeleton class="h-3.5 w-28" />
<x-skeleton class="h-2.5 w-36" />
</div>
<div class="mt-2.5 flex items-center justify-between gap-2">
<x-skeleton class="h-2.5 w-44 max-w-full" />
<x-skeleton class="h-7 w-16 shrink-0" />
</div>
</div>
@endfor
@else
@forelse ($jails as $jail)
<div class="px-3.5 py-3">
<div class="flex flex-wrap items-center justify-between gap-2">
<p class="font-mono text-sm text-ink">{{ $jail['name'] }}</p>
<p class="font-mono text-[11px] text-ink-3">
<span @class(['text-offline' => ($jail['currentlyBanned'] ?? 0) > 0])>{{ __('servers.fail2ban_banned', ['count' => $jail['currentlyBanned'] ?? 0]) }}</span>
· {{ __('servers.fail2ban_failed', ['count' => $jail['currentlyFailed'] ?? 0]) }}
</p>
</div>
@if (count($jail['bannedIps'] ?? []))
<div class="mt-2 space-y-1">
@foreach ($jail['bannedIps'] as $ip)
<div class="flex items-center justify-between gap-2">
<span class="min-w-0 break-all font-mono text-[11px] text-ink-2">{{ $ip }}</span>
<x-btn variant="secondary" size="sm" class="shrink-0"
wire:click="unbanIp({{ \Illuminate\Support\Js::from($jail['name']) }}, {{ \Illuminate\Support\Js::from($ip) }})"
wire:target="unbanIp({{ \Illuminate\Support\Js::from($jail['name']) }}, {{ \Illuminate\Support\Js::from($ip) }})"
wire:loading.attr="disabled">{{ __('common.unlock') }}</x-btn>
</div>
@endforeach
</div>
@else
<p class="mt-1 font-mono text-[11px] text-ink-4">{{ __('servers.fail2ban_no_banned') }}</p>
@endif
</div>
@empty
<div class="px-3.5 py-6 text-center">
<p class="font-mono text-[11px] text-ink-3">{{ __('servers.fail2ban_no_banned') }}</p>
</div>
@endforelse
@endif
</div>
<div class="mt-6 flex items-center justify-end gap-2">
<x-btn variant="secondary" wire:click="$dispatch('closeModal')">{{ __('common.close') }}</x-btn>
</div>
</div>