142 lines
6.1 KiB
PHP
142 lines
6.1 KiB
PHP
<x-filament-panels::page>
|
|
@if(count($this->getDomainOptions()) > 0)
|
|
{{-- Domain Selector --}}
|
|
<x-filament::section
|
|
icon="heroicon-o-globe-alt"
|
|
icon-color="primary"
|
|
>
|
|
<x-slot name="heading">
|
|
{{ __('Select Domain') }}
|
|
</x-slot>
|
|
<x-slot name="description">
|
|
{{ __('Choose the domain you want to view logs for.') }}
|
|
</x-slot>
|
|
|
|
<div class="max-w-md">
|
|
<x-filament::input.wrapper>
|
|
<x-filament::input.select wire:model.live="selectedDomain">
|
|
@foreach($this->getDomainOptions() as $value => $label)
|
|
<option value="{{ $value }}">{{ $label }}</option>
|
|
@endforeach
|
|
</x-filament::input.select>
|
|
</x-filament::input.wrapper>
|
|
</div>
|
|
</x-filament::section>
|
|
|
|
@if($selectedDomain)
|
|
{{-- Statistics Banner (shown when generated) --}}
|
|
@if($statsGenerated)
|
|
<x-filament::section
|
|
icon="heroicon-o-check-circle"
|
|
icon-color="success"
|
|
>
|
|
<x-slot name="heading">
|
|
{{ __('Statistics Report Ready') }}
|
|
</x-slot>
|
|
<x-slot name="description">
|
|
{{ __('Traffic analysis report has been generated for :domain', ['domain' => $selectedDomain]) }}
|
|
</x-slot>
|
|
|
|
<x-filament::button
|
|
:href="$statsUrl"
|
|
tag="a"
|
|
target="_blank"
|
|
icon="heroicon-o-arrow-top-right-on-square"
|
|
>
|
|
{{ __('View Report') }}
|
|
</x-filament::button>
|
|
</x-filament::section>
|
|
@endif
|
|
|
|
{{-- Log Viewer --}}
|
|
<x-filament::section
|
|
icon="heroicon-o-document-text"
|
|
>
|
|
<x-slot name="heading">
|
|
{{ __('Log Viewer') }}
|
|
</x-slot>
|
|
<x-slot name="description">
|
|
{{ __('Viewing :type for :domain', ['type' => $logType === 'access' ? __('access log') : __('error log'), 'domain' => $selectedDomain]) }}
|
|
@if(!empty($logInfo))
|
|
({{ $logInfo['file_size'] ?? '' }}, {{ __(':lines lines', ['lines' => $logInfo['lines'] ?? 100]) }})
|
|
@endif
|
|
</x-slot>
|
|
|
|
{{-- Log Type Buttons --}}
|
|
<div class="flex flex-wrap items-center gap-2 gap-y-2 mb-4">
|
|
<x-filament::button
|
|
wire:click="setLogType('access')"
|
|
:color="$logType === 'access' ? 'primary' : 'gray'"
|
|
:outlined="$logType !== 'access'"
|
|
size="sm"
|
|
icon="heroicon-o-arrow-right-circle"
|
|
>
|
|
{{ __('Access Log') }}
|
|
</x-filament::button>
|
|
|
|
<x-filament::button
|
|
wire:click="setLogType('error')"
|
|
:color="$logType === 'error' ? 'danger' : 'gray'"
|
|
:outlined="$logType !== 'error'"
|
|
size="sm"
|
|
icon="heroicon-o-exclamation-triangle"
|
|
>
|
|
{{ __('Error Log') }}
|
|
</x-filament::button>
|
|
</div>
|
|
|
|
{{-- Log Content --}}
|
|
@if($logContent)
|
|
<div class="fi-input-wrp rounded-lg shadow-sm ring-1 ring-gray-950/10 dark:ring-white/20 overflow-hidden">
|
|
<textarea
|
|
readonly
|
|
rows="25"
|
|
class="w-full border-0 bg-gray-50 dark:bg-gray-900 text-gray-700 dark:text-gray-300 resize-none focus:ring-0"
|
|
style="font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace; font-size: 12px; line-height: 1.5;"
|
|
>{{ $logContent }}</textarea>
|
|
</div>
|
|
@else
|
|
<x-filament::section compact>
|
|
<x-slot name="heading">
|
|
{{ __('No Log Entries') }}
|
|
</x-slot>
|
|
<x-slot name="description">
|
|
{{ $logType === 'access'
|
|
? __('No access log entries found. Logs will appear after visitors access your site.')
|
|
: __('No error log entries found. This is good - your site has no errors.') }}
|
|
</x-slot>
|
|
</x-filament::section>
|
|
@endif
|
|
</x-filament::section>
|
|
@endif
|
|
@else
|
|
{{-- No Domains Empty State --}}
|
|
<x-filament::section>
|
|
<div class="flex flex-col items-center justify-center py-12">
|
|
<div class="mb-4 rounded-full bg-gray-100 p-3 dark:bg-gray-500/20">
|
|
<x-filament::icon
|
|
icon="heroicon-o-globe-alt"
|
|
class="h-6 w-6 text-gray-500 dark:text-gray-400"
|
|
/>
|
|
</div>
|
|
<h3 class="text-base font-semibold text-gray-950 dark:text-white">
|
|
{{ __('No Domains Yet') }}
|
|
</h3>
|
|
<p class="mt-1 text-sm text-gray-500 dark:text-gray-400">
|
|
{{ __('Add a domain first to view logs and statistics.') }}
|
|
</p>
|
|
<div class="mt-6">
|
|
<x-filament::button
|
|
href="{{ route('filament.jabali.pages.domains') }}"
|
|
tag="a"
|
|
>
|
|
{{ __('Add Domain') }}
|
|
</x-filament::button>
|
|
</div>
|
|
</div>
|
|
</x-filament::section>
|
|
@endif
|
|
|
|
<x-filament-actions::modals />
|
|
</x-filament-panels::page>
|