@php $field = 'h-9 w-full rounded-md border border-line bg-inset px-3 text-sm text-ink focus:border-accent/40 focus:outline-none'; $label = 'mb-1 block font-mono text-[11px] uppercase tracking-wider text-ink-3'; $scopeName = function ($rule) use ($groupNames, $serverNames) { return match ($rule->scope_type) { 'group' => $groupNames[$rule->scope_id] ?? __('alerts.scope_group'), 'server' => $serverNames[$rule->scope_id] ?? __('alerts.scope_server'), default => __('alerts.scope_all'), }; }; @endphp {{-- Poll so firing/resolved incidents appear live, matching the dashboard, without a manual refresh. --}}
{{-- Header --}}

{{ __('alerts.eyebrow') }}

{{ __('alerts.title') }}

{{ __('alerts.subtitle') }}

{{-- No delivery channel reaches anyone → alerts would fire silently. Warn prominently. --}} @unless ($channelsReach)

{{ __('alerts.no_channel_title') }}

{{ __('alerts.no_channel_hint') }}

@endunless {{-- Active incidents --}} @if ($incidents->isEmpty())

{{ __('alerts.no_incidents_title') }}

{{ __('alerts.no_incidents') }}

@else
@foreach ($incidents as $incident)

{{ $incident->rule?->name ?? '—' }}

{{ $incident->server?->name ?? '—' }} · {{ __('alerts.incident_value', ['value' => $incident->value]) }}

{{ __('alerts.incident_since', ['time' => $incident->started_at?->diffForHumans() ?? '—']) }}
@endforeach
@endif
{{-- New rule --}}
@error('name')

{{ $message }}

@enderror
@if ($metric !== 'offline')
@error('threshold')

{{ $message }}

@enderror
@endif
@if ($scopeType === 'group')
@elseif ($scopeType === 'server')
@endif
{{ __('alerts.create') }}
{{-- Rules --}} @if ($rules->isEmpty())

{{ __('alerts.no_rules_title') }}

{{ __('alerts.no_rules') }}

@else
@foreach ($rules as $rule)

{{ $rule->name }}

@if ($rule->metric === 'offline') {{ __('alerts.rule_summary_offline', ['scope' => $scopeName($rule)]) }} @else {{ __('alerts.rule_summary', ['scope' => $scopeName($rule), 'metric' => __('alerts.metric_'.$rule->metric), 'comparator' => __('alerts.comparator_'.$rule->comparator), 'threshold' => $rule->threshold]) }} @endif

{{ __('common.delete') }}
@endforeach
@endif
{{-- Channels --}}

{{ __('alerts.email_hint') }}

@error('webhooks')

{{ $message }}

@enderror

{{ __('alerts.webhooks_hint') }}

{{-- Gotify push (self-hostable) — a real push when a service goes down, no e-mail needed. --}}
@error('gotifyUrl')

{{ $message }}

@enderror
@if ($gotifyTokenSet) {{ __('common.remove') }} @endif

{{ __('alerts.gotify_hint') }}

{{ __('alerts.save') }}