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,50 +6,194 @@
@section('content') @section('content')
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<h2>Network Status</h2> <h2>System Status</h2>
</div> </div>
</div> </div>
<div class="row"> <div class="accordion accordion-flush" id="accordion_status">
<div class="col-12"> <!-- Totals -->
<p>Nodes with uncollected mail as at <strong class="highlight">{{ $date }}</strong>:</p> <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>
<table class="table monotable w-100" id="mailfiles"> <div id="collapse_totals" class="accordion-collapse collapse {{ (! $flash=session()->pull('accordion')) ? 'show' : '' }}" aria-labelledby="totals" data-bs-parent="#accordion_status">
<thead> <div class="accordion-body">
<tr> <p>This system has processed the following so far in the last 7 days:</p>
<th>Network</th>
<th>System</th>
<th>Address</th>
<th class="text-right">Echomails</th>
<th class="text-right">Netmails</th>
<th class="text-right">Files</th>
<th>Last Session</th>
<th>Poll Mode</th>
<th>Auto Hold</th>
</tr>
</thead>
<tbody> <div class="row">
@foreach($uncollected as $o) <!-- Netmail -->
<tr> <div class="col-3">
<td>{{ $o->zone->domain->name }}</td> <div class="card bg-success">
<td> <div class="card-header p-2">
<a href="{{ url('system/addedit',$o->system_id) }}">{{ $o->system->name }}</a> <span class="card-title w-100 text-dark" style="font-size: 125%;"><i class="bi bi-envelope-at"></i> Netmail
@if (($x=$o->parent()) && ($x->id !== $o->id)) <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())
<br><small>[via <a href="{{ url('system/addedit',$x->system_id) }}">{{ $x->ftn4d }}</a>]</small> ->join('addresses',['addresses.id'=>'netmails.fftn_id'])
@endif ->join('zones',['zones.id'=>'addresses.zone_id'])
</td> ->join('domains',['domains.id'=>'zones.domain_id'])
<td>{{ $o->ftn4d }}</td> ->orderBy('domains.name')
<td class="text-right">{{ number_format($o->uncollected_echomail ?? 0) }}</td> ->with('fftn.zone.domain')
<td class="text-right">{{ number_format($o->uncollected_netmail ?? 0) }}</td> ->get())
<td class="text-right">{{ number_format($o->uncollected_files ?? 0) }}</td> ->count()) }}
<td>{{ $o->system->last_session?->format('Y-m-d H:i') }}</td> </button>
<td>{{ is_null($o->system->pollmode) ? 'HOLD' : ($o->system->pollmode ? 'CRASH' : 'DAILY') }}</td> </span>
<td>{{ $o->system->autohold ? 'YES' : 'NO' }}</td> </div>
</tr>
@endforeach @if($x->count())
</tbody> <div class="card-body text-dark">
</table> <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>
<table class="table monotable w-100" id="mailfiles">
<thead>
<tr>
<th>Network</th>
<th>System</th>
<th>Address</th>
<th class="text-right">Echomails</th>
<th class="text-right">Netmails</th>
<th class="text-right">Files</th>
<th>Last Session</th>
<th>Poll Mode</th>
<th>Auto Hold</th>
</tr>
</thead>
<tbody>
@foreach($uncollected as $o)
<tr>
<td>{{ $o->zone->domain->name }}</td>
<td>
<a href="{{ url('system/addedit',$o->system_id) }}">{{ $o->system->name }}</a>
@if (($x=$o->parent()) && ($x->id !== $o->id))
<br><small>[via <a href="{{ url('system/addedit',$x->system_id) }}">{{ $x->ftn4d }}</a>]</small>
@endif
</td>
<td>{{ $o->ftn4d }}</td>
<td class="text-right">{{ number_format($o->uncollected_echomail ?? 0) }}</td>
<td class="text-right">{{ number_format($o->uncollected_netmail ?? 0) }}</td>
<td class="text-right">{{ number_format($o->uncollected_files ?? 0) }}</td>
<td>{{ $o->system->last_session?->format('Y-m-d H:i') }}</td>
<td>{{ is_null($o->system->pollmode) ? 'HOLD' : ($o->system->pollmode ? 'CRASH' : 'DAILY') }}</td>
<td>{{ $o->system->autohold ? 'YES' : 'NO' }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
</div> </div>
</div> </div>
@endsection @endsection