Added number of netmails/echomails/files processed on status page

This commit is contained in:
Deon George 2023-11-26 16:50:47 +11:00
parent 1ac3583479
commit 4a0e6e67fc

View File

@ -6,10 +6,150 @@
@section('content')
<div class="row">
<div class="col-12">
<h2>Network Status</h2>
<h2>System Status</h2>
</div>
</div>
<div class="accordion accordion-flush" id="accordion_status">
<!-- Totals -->
<div class="accordion-item">
<h3 class="accordion-header" id="totals" data-bs-toggle="collapse" data-bs-target="#collapse_totals" aria-expanded="false" aria-controls="collapse_totals">Totals</h3>
<div id="collapse_totals" class="accordion-collapse collapse {{ (! $flash=session()->pull('accordion')) ? 'show' : '' }}" aria-labelledby="totals" data-bs-parent="#accordion_status">
<div class="accordion-body">
<p>This system has processed the following so far in the last 7 days:</p>
<div class="row">
<!-- Netmail -->
<div class="col-3">
<div class="card bg-success">
<div class="card-header p-2">
<span class="card-title w-100 text-dark" style="font-size: 125%;"><i class="bi bi-envelope-at"></i> Netmail
<button type="button" class="btn float-end me-0" style="background-color: darkgreen; color: white;">{{ number_format(($x=\App\Models\Netmail::where('netmails.created_at','>=',\Carbon\Carbon::now()->subWeek()->startOfDay())
->join('addresses',['addresses.id'=>'netmails.fftn_id'])
->join('zones',['zones.id'=>'addresses.zone_id'])
->join('domains',['domains.id'=>'zones.domain_id'])
->orderBy('domains.name')
->with('fftn.zone.domain')
->get())
->count()) }}
</button>
</span>
</div>
@if($x->count())
<div class="card-body text-dark">
<p class="card-text">Networks:</p>
<ul class="p-0 m-0">
@foreach($x->groupBy('fftn.zone_id') as $oo)
<li class="m-0">{{ $oo->first()->fftn->zone->domain->name }}: {{ number_format($oo->count()) }}</li>
@endforeach
</ul>
</div>
@endif
</div>
</div>
<!-- Echomail -->
<div class="col-3">
<div class="card bg-primary">
<div class="card-header p-2">
<span class="card-title w-100 text-dark" style="font-size: 125%;"><i class="bi bi-envelope"></i> Echomail
<button type="button" class="btn float-end me-0" style="background-color: darkblue; color: white;">{{ number_format(($x=\App\Models\Echomail::where('echomails.created_at','>=',\Carbon\Carbon::now()->subWeek()->startOfDay())
->join('addresses',['addresses.id'=>'echomails.fftn_id'])
->join('zones',['zones.id'=>'addresses.zone_id'])
->join('domains',['domains.id'=>'zones.domain_id'])
->orderBy('domains.name')
->orderBy('zones.zone_id')
->with('fftn.zone.domain')
->get())
->count()) }}
</button>
</span>
</div>
@if($x->count())
<div class="card-body text-dark">
<p class="card-text">Networks:</p>
<ul class="p-0 m-0">
@foreach($x->groupBy('fftn.zone_id') as $oo)
<li class="m-0">{{ sprintf('Z%d (%s)',$oo->first()->fftn->zone->zone_id,$oo->first()->fftn->zone->domain->name) }}: {{ number_format($oo->count()) }}</li>
@endforeach
</ul>
</div>
@endif
</div>
</div>
<!-- File -->
<div class="col-3">
<div class="card bg-danger">
<div class="card-header p-2">
<span class="card-title w-100 text-dark" style="font-size: 125%;"><i class="bi bi-folder"></i> Files
<button type="button" class="btn float-end me-0" style="background-color: darkred; color: white;">{{ number_format(($x=\App\Models\File::where('files.created_at','>=',\Carbon\Carbon::now()->subWeek()->startOfDay())
->join('addresses',['addresses.id'=>'files.fftn_id'])
->join('zones',['zones.id'=>'addresses.zone_id'])
->join('domains',['domains.id'=>'zones.domain_id'])
->orderBy('domains.name')
->with('fftn.zone.domain')
->get())
->count()) }}
</button>
</span>
</div>
@if($x->count())
<div class="card-body text-dark">
<p class="card-text">Networks:</p>
<ul class="p-0 m-0">
@foreach($x->groupBy('fftn.zone_id') as $oo)
<li class="m-0">{{ sprintf('Z%d (%s)',$oo->first()->fftn->zone->zone_id,$oo->first()->fftn->zone->domain->name) }}: {{ number_format($oo->count()) }}</li>
@endforeach
</ul>
</div>
@endif
</div>
</div>
<!-- DNS -->
<div class="col-3">
<div class="row">
<div class="col-12">
<div class="card bg-light">
<div class="card-header p-2">
<span class="card-title w-100 text-dark" style="font-size: 125%;"><i class="bi bi-pc-display"></i> Systems
<button type="button" class="btn float-end me-0" style="background-color: black; color: white;">
{{ number_format(\App\Models\System::where('last_session','>=',\Carbon\Carbon::now()->subWeek()->startOfDay())->count()) }}
</button>
</span>
</div>
</div>
</div>
</div>
<div class="row pt-3">
<div class="col-12">
<div class="card bg-secondary">
<div class="card-header p-2">
<span class="card-title w-100 text-dark" style="font-size: 125%;"><i class="bi bi-globe"></i> DNS Queries
<button type="button" class="btn float-end me-0" style="background-color: black; color: white;">N/A</button>
</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Uncollected Mail -->
<div class="accordion-item">
<h3 class="accordion-header" id="uncollected" data-bs-toggle="collapse" data-bs-target="#collapse_uncollected" aria-expanded="true" aria-controls="collapse_uncollected">Uncollected Mail</h3>
<div id="collapse_uncollected" class="accordion-collapse collapse {{ ($flash==='uncollected') ? 'show' : '' }}" aria-labelledby="uncollected" data-bs-parent="#accordion_status">
<div class="accordion-body">
<div class="row">
<div class="col-12">
<p>Nodes with uncollected mail as at <strong class="highlight">{{ $date }}</strong>:</p>
@ -52,6 +192,10 @@
</table>
</div>
</div>
</div>
</div>
</div>
</div>
@endsection
@section('page-css')