Consistency and SQL Query optimisations - focused around the UI

This commit is contained in:
2024-11-04 09:05:27 +11:00
parent f03533b62a
commit 3aeeed1686
21 changed files with 362 additions and 332 deletions

View File

@@ -28,9 +28,7 @@ $user->load(['systems.akas.zone.domain.echoareas','systems.akas.echoareas']);
@foreach($user
->addresses()
->diff(our_address())
->filter(fn($item)=>($item->point_id === 0))
->filter(function($item) { return $item->zone->domain->active && $item->zone->domain->public && $item->zone->domain->isManaged(); })
->sortBy('zone.domain.name')
->filter(fn($item)=>($item->point_id === 0) && ($item->zone->domain->isManaged()))
->groupBy('zone.domain.name') as $list)
<!-- {{ $x=$list->first()->domain->name }} -->
<div class="accordion-item">

View File

@@ -1,5 +1,5 @@
<!-- $o=Domain::class -->
@use(Illuminate\Mail\Markdown)
<!-- $o=Domain::class -->
@extends('layouts.app')
@section('htmlheader_title')
@@ -137,12 +137,13 @@
<div id="collapse_systems" class="accordion-collapse collapse" aria-labelledby="systems" data-bs-parent="#accordion_homepage">
<div class="accordion-body">
<p>The following systems are members of this network.</p>
<table class="table monotable" id="system">
<table class="table monotable w-100" id="system">
<thead>
<tr>
<th>System</th>
<th>Sysop</th>
<th>Location</th>
<th>Region</th>
<th>Address</th>
<th>Last Echomail</th>
</tr>
@@ -155,6 +156,7 @@
<td><a href="{{ url('system/addedit',[$ao->system_id]) }}">{{ $ao->system->full_name($ao) }}</a> @auth<span class="float-end"><small>@if($ao->is_hosted)<sup>{{ $ao->is_default ? '**' : '*' }}</sup>@elseif($ao->system->setup)<sup class="success">+</sup>@endif[{{ $ao->system_id }}]</small></span>@endauth</td>
<td>{{ $ao->system->sysop }}</td>
<td>{{ $ao->system->location }}</td>
<td>{{ $ao->region_id }}</td>
<td>{{ $ao->ftn4d }}</td>
<td>{{ $ao->echomail_from->count() ? $ao->echomail_from->first()->datetime->format('Y-m-d H:i') : '-' }}</td>
</tr>
@@ -279,6 +281,18 @@
searching: true,
ordering: true,
order: [],
rowGroup: {
dataSrc: [3],
startRender: function(rows,group) {
return 'Region '+group;
}
},
columnDefs: [
{
targets: [3],
visible: false,
},
],
conditionalPaging: {
style: 'fade',
speed: 500 // optional

View File

@@ -20,7 +20,7 @@
@endif
@if($o->zcs->count())
<p>This system is the ZC for the following zones: <strong class="highlight">{!! $o->zcs->sortBy('zone_id')->map(function($item) { return sprintf('%d@%s',$item->zone_id,$item->domain->name); })->join('</strong>, <strong class="highlight">') !!} </strong></p>
<p>This system is the ZC for the following zones: <strong class="highlight">{!! $o->zcs->map(fn($item)=>sprintf('%d@%s',$item->zone_id,$item->domain->name))->join('</strong>, <strong class="highlight">') !!} </strong></p>
@endif
@include('widgets.error')
@@ -123,7 +123,7 @@
</thead>
<tbody>
@foreach ($o->addresses->sortBy(function($item) { return sprintf('%04x%04x%04x%04x%04x',$item->zone->zone_id,$item->region_id,$item->host_id,$item->node_id,$item->point_id); }) as $oo)
@foreach ($o->addresses as $oo)
<tr>
<td @if($oo->trashed()) class="trashed" @elseif (! $oo->active) class="inactive" @endif>{{ $oo->ftn }}<span class="float-end"><data value="{{ $oo->id }}:{{ $oo->validated ? 1 : 0 }}" class="validated"><i title="@if($oo->validated)Mail flowing @else Mail held @endif" @class(['bi','bi-activity'=>$oo->validated,'bi-radioactive'=>(! $oo->validated)])></i></data></span></td>
<td>{{ $oo->active ? 'YES' : 'NO' }}</td>
@@ -156,7 +156,6 @@
</tbody>
</table>
@endif
</div>
</div>
@@ -321,7 +320,7 @@
</thead>
<tbody>
@foreach ($o->addresses->sortBy('zone.zone_id') as $ao)
@foreach ($o->aka_common() as $ao)
<tr>
<td>{{ $ao->ftn }}</td>
<td>{{ $ao->netmailWaiting()->count() }}</td>
@@ -343,7 +342,7 @@
</thead>
<tbody>
@foreach ($o->addresses->sortBy('zone.zone_id') as $ao)
@foreach ($o->aka_common() as $ao)
<tr>
<td>{{ $ao->ftn }}</td>
<td>{{ $ao->echomailWaiting()->count() }}</td>
@@ -365,7 +364,7 @@
</thead>
<tbody>
@foreach ($o->addresses->sortBy('zone.zone_id') as $ao)
@foreach ($o->aka_common() as $ao)
<tr>
<td>{{ $ao->ftn }}</td>
<td>{{ $ao->filesWaiting()->count() }}</td>

View File

@@ -1,91 +1,84 @@
@if(($x=\App\Models\Zone::active()
->whereIn('id',$o->sessions->pluck('pivot.zone_id'))
->orderBy('zone_id')
->with(['domain'])
->get())->count())
<form class="needs-validation" method="post" action="{{ url('system/echoarea',$o->id) }}" novalidate>
@csrf
<form class="needs-validation" method="post" action="{{ url('system/echoarea',$o->id) }}" novalidate>
@csrf
<div class="row pt-0">
<div class="col-12">
<div class="greyframe titledbox shadow0xb0">
<div class="row">
<!-- Select Domain -->
<div class="col-3">
<label for="echoarea_domain_id" class="form-label">Network</label>
<div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-hash"></i></span>
<select class="form-select @error('domain_id') is-invalid @enderror" id="echoarea_domain_id" name="domain_id" required>
<option></option>
@foreach($x as $zo)
<option value="{{ $zo->domain_id }}" @if(old('domain_id') == $zo->domain_id)selected @endif>{{ $zo->zone_id }} <small>({{ $zo->domain->name }})</small></option>
@endforeach
</select>
<span class="invalid-feedback" role="alert">
@error('domain_id')
{{ $message }}
@enderror
</span>
</div>
</div>
<!-- Select Address -->
<div class="col-3">
<div class="d-none" id="echoarea_address-select">
<label for="echoarea_address_id" class="form-label">Address</label>
<div class="input-group">
<span class="input-group-text"><i class="bi bi-hash"></i></span>
<select class="form-select" id="echoarea_address_id" name="address_id" required>
<option></option>
</select>
</div>
</div>
</div>
<!-- Summary of Addresses -->
<div class="offset-3 col-3" id="echoarea-summary">
<table class="table monotable">
<thead>
<tr>
<th>Network</th>
<th class="text-end">Areas</th>
</tr>
</thead>
<tbody>
@foreach ($o->echoareas()->with(['domain'])->get()->groupBy('domain_id') as $oo)
<tr>
<td>{{ $oo->first()->domain->name }}</td>
<td class="text-end">{{ $oo->count() }}</td>
</tr>
<div class="row pt-0">
<div class="col-12">
<div class="greyframe titledbox shadow0xb0">
<div class="row">
<!-- Select Domain -->
<div class="col-3">
<label for="echoarea_domain_id" class="form-label">Network</label>
<div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-hash"></i></span>
<select class="form-select @error('domain_id') is-invalid @enderror" id="echoarea_domain_id" name="domain_id" required>
<option></option>
@foreach($o->sessions as $zo)
<option value="{{ $zo->domain_id }}" @if(old('domain_id') == $zo->domain_id)selected @endif>{{ $zo->zone_id }} <small>({{ $zo->domain->name }})</small></option>
@endforeach
</tbody>
</table>
</div>
</div>
@if($errors->count())
<div class="row">
<span class="btn btn-sm btn-danger" role="alert" style="text-align: left;">
There were errors with the submission.
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</select>
<span class="invalid-feedback" role="alert">
@error('domain_id')
{{ $message }}
@enderror
</span>
</div>
@endif
<div class="row">
<div class="col-12 d-none" id="echoarea-select"></div>
</div>
<!-- Select Address -->
<div class="col-3">
<div class="d-none" id="echoarea_address-select">
<label for="echoarea_address_id" class="form-label">Address</label>
<div class="input-group">
<span class="input-group-text"><i class="bi bi-hash"></i></span>
<select class="form-select" id="echoarea_address_id" name="address_id" required>
<option></option>
</select>
</div>
</div>
</div>
<!-- Summary of Addresses -->
<div class="offset-3 col-3" id="echoarea-summary">
<table class="table monotable">
<thead>
<tr>
<th>Network</th>
<th class="text-end">Areas</th>
</tr>
</thead>
<tbody>
@foreach ($o->echoareas()->with(['domain'])->get()->groupBy('domain_id') as $oo)
<tr>
<td>{{ $oo->first()->domain->name }}</td>
<td class="text-end">{{ $oo->count() }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
@if($errors->count())
<div class="row">
<span class="btn btn-sm btn-danger" role="alert" style="text-align: left;">
There were errors with the submission.
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</span>
</div>
@endif
<div class="row">
<div class="col-12 d-none" id="echoarea-select"></div>
</div>
</div>
</div>
</form>
@endif
</div>
</form>
@section('page-scripts')
<script type="text/javascript" src="{{ asset('plugin/checkboxes/jquery.checkboxes-1.2.2.min.js') }}"></script>

View File

@@ -1,78 +1,71 @@
@if(($x=\App\Models\Zone::active()
->whereIn('id',$o->sessions->pluck('pivot.zone_id'))
->orderBy('zone_id')
->with(['domain'])
->get())->count())
<form class="needs-validation" method="post" action="{{ url('system/filearea',$o->id) }}" novalidate>
@csrf
<form class="needs-validation" method="post" action="{{ url('system/filearea',$o->id) }}" novalidate>
@csrf
<div class="row pt-0">
<div class="col-12">
<div class="greyframe titledbox shadow0xb0">
<div class="row">
<!-- Select Domain -->
<div class="col-3">
<label for="domain_id" class="form-label">Network</label>
<div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-hash"></i></span>
<select class="form-select @error('domain_id') is-invalid @enderror" id="filearea_domain_id" name="domain_id" required>
<option></option>
@foreach($x as $zo)
<option value="{{ $zo->domain_id }}" @if(old('domain_id') == $zo->domain_id)selected @endif>{{ $zo->zone_id }} <small>({{ $zo->domain->name }})</small></option>
@endforeach
</select>
<span class="invalid-feedback" role="alert">
@error('domain_id')
{{ $message }}
@enderror
</span>
</div>
</div>
<!-- Select Address -->
<div class="col-3">
<div class="d-none" id="filearea_address-select">
<label for="filearea_address_id" class="form-label">Address</label>
<div class="input-group">
<span class="input-group-text"><i class="bi bi-hash"></i></span>
<select class="form-select" id="filearea_address_id" name="address_id" required>
<option></option>
</select>
</div>
</div>
</div>
<!-- Summary of Addresses -->
<div class="offset-3 col-3" id="filearea-summary">
<table class="table monotable">
<thead>
<tr>
<th>Network</th>
<th class="text-end">Areas</th>
</tr>
</thead>
<tbody>
@foreach ($o->fileareas()->with(['domain'])->get()->groupBy('domain_id') as $oo)
<tr>
<td>{{ $oo->first()->domain->name }}</td>
<td class="text-end">{{ $oo->count() }}</td>
</tr>
<div class="row pt-0">
<div class="col-12">
<div class="greyframe titledbox shadow0xb0">
<div class="row">
<!-- Select Domain -->
<div class="col-3">
<label for="domain_id" class="form-label">Network</label>
<div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-hash"></i></span>
<select class="form-select @error('domain_id') is-invalid @enderror" id="filearea_domain_id" name="domain_id" required>
<option></option>
@foreach($o->sessions as $zo)
<option value="{{ $zo->domain_id }}" @if(old('domain_id') == $zo->domain_id)selected @endif>{{ $zo->zone_id }} <small>({{ $zo->domain->name }})</small></option>
@endforeach
</tbody>
</table>
</select>
<span class="invalid-feedback" role="alert">
@error('domain_id')
{{ $message }}
@enderror
</span>
</div>
</div>
<div class="row">
<div class="col-12 d-none" id="filearea-select"></div>
<!-- Select Address -->
<div class="col-3">
<div class="d-none" id="filearea_address-select">
<label for="filearea_address_id" class="form-label">Address</label>
<div class="input-group">
<span class="input-group-text"><i class="bi bi-hash"></i></span>
<select class="form-select" id="filearea_address_id" name="address_id" required>
<option></option>
</select>
</div>
</div>
</div>
<!-- Summary of Addresses -->
<div class="offset-3 col-3" id="filearea-summary">
<table class="table monotable">
<thead>
<tr>
<th>Network</th>
<th class="text-end">Areas</th>
</tr>
</thead>
<tbody>
@foreach ($o->fileareas()->with(['domain'])->get()->groupBy('domain_id') as $oo)
<tr>
<td>{{ $oo->first()->domain->name }}</td>
<td class="text-end">{{ $oo->count() }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
<div class="row">
<div class="col-12 d-none" id="filearea-select"></div>
</div>
</div>
</div>
</form>
@endif
</div>
</form>
@section('page-scripts')
<script type="text/javascript" src="{{ asset('plugin/checkboxes/jquery.checkboxes-1.2.2.min.js') }}"></script>

View File

@@ -6,7 +6,7 @@
<div class="row pt-0">
<div class="col-12">
<div class="greyframe titledbox shadow0xb0">
<h2 class="cap">@can($action,$o) @if($o->exists) Update @else Add @endif @endif System</h2>
<h2 class="cap">@can($action,$o) @if($o->exists) Update @else Add @endif @endcan System</h2>
@include('system.widget.system')
</div>

View File

@@ -1,15 +1,9 @@
@php
use App\Models\{Address,Zone};
@endphp
@use(App\Models\Address)
<!-- $o=System::class -->
<div class="row">
<!-- Zone mail sent to -->
<!-- Zone mail sent to, because we dont have session details for these addresses -->
<div class="col-6">
@if(! $o->setup && ($x=Zone::active()
->whereIn('id',$o->zones->pluck('id'))
->whereNotIn('id',$o->sessions->pluck('id'))
->get())->count())
@if($o->aka_unknown()->count())
<h4>This host's mail is sent to:</h4>
<table class="table monotable">
<thead>
@@ -20,19 +14,17 @@
</thead>
<tbody>
@foreach($x as $zo)
@foreach ($o->match($zo,Address::NODE_ALL) as $oo)
<tr>
<td>{{ $oo->ftn }}</td>
<td>
@if ($x=$oo->uplink())
{{ $x->ftn4d }}
@else
None
@endif
</td>
</tr>
@endforeach
@foreach($o->aka_unknown() as $ao)
<tr>
<td>{{ $ao->ftn }}</td>
<td>
@if ($xx=$ao->uplink())
{{ $xx->ftn4d }}
@else
None
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
@@ -41,28 +33,62 @@
<!-- Systems this host collects for -->
<div class="col-6">
@if($o->sessions->count())
<h4>This host collects mail for the following systems:</h4>
<div class="row">
<div class="col-12">
@if($o->sessions->count())
<h4>This host collects mail for the following systems:</h4>
<table class="table monotable">
<thead>
<tr>
<th>AKA</th>
<th>For Systems(s)</th>
</tr>
</thead>
<tbody>
@foreach ($o->sessions->sortBy('zone_id') as $zo)
@foreach ($o->match($zo,Address::NODE_ALL) as $oo)
<table class="table monotable">
<thead>
<tr>
<td>{{ $oo->ftn }}</td>
<td>{!! (($x=$oo->downlinks()) && $x->count()) ? $x->pluck('ftn')->join('<br>') : 'None' !!}</td>
<th>AKA</th>
<th>Incl Systems(s)</th>
</tr>
@endforeach
@endforeach
</tbody>
</table>
</thead>
<tbody>
@foreach ($o->sessions->sortBy('zone_id') as $zo)
@if($zo->pivot->default)
<tr>
<td>{!! $o->akas->filter(fn($item)=>$item->zone->domain_id === $zo->domain_id)->pluck('ftn')->join('<br>') !!}</td>
<td>All <small>(not otherwise routed)</small></td>
</tr>
@else
@foreach ($o->match($zo,Address::NODE_ALL) as $oo)
<tr>
<td>{{ $oo->ftn }}</td>
<td>{!! (($x=$oo->downlinks()) && $x->count()) ? $x->pluck('ftn')->join('<br>') : 'None' !!}</td>
</tr>
@endforeach
@endif
@endforeach
</tbody>
</table>
@endif
</div>
</div>
@if($o->aka_uncommon()->count())
<div class="row">
<div class="rol-12">
<h4>This host's mail not known here:</h4>
<table class="table monotable">
<thead>
<tr>
<th>AKA</th>
</tr>
</thead>
<tbody>
@foreach($o->aka_uncommon() as $ao)
<tr>
<td>{{ $ao->ftn }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
@endif
</div>
</div>

View File

@@ -1,8 +1,6 @@
@php
use App\Classes\FTN\Packet;
use App\Models\{Mailer,User};
@endphp
@use(App\Classes\FTN\Packet)
@use(App\Models\Mailer)
@use(App\Models\User)
<!-- $o=System::class -->
<div class="row">
<div class="col-xl-9 col-12">
@@ -20,7 +18,7 @@ use App\Models\{Mailer,User};
<select style="width: 80%;" class="form-select @error('users') is-invalid @enderror" id="users" name="users[]">
<option value="">&nbsp;</option>
@foreach (User::orderBy('name')->active()->get() as $uo)
<option value="{{ $uo->id }}" @if(in_array($uo->id,old('users',$o->users->pluck('id')->toArray())))selected @endif>{{ $uo->name }} <small>({{ $uo->email }})</small></option>
<option value="{{ $uo->id }}" @selected(in_array($uo->id,old('users',$o->users->pluck('id')->toArray())))>{{ $uo->name }} <small>({{ $uo->email }})</small></option>
@endforeach
</select>
@@ -325,8 +323,6 @@ use App\Models\{Mailer,User};
</div>
</div>
@endcan
</div>
@if(! is_null($o->pollmode))
@@ -438,9 +434,6 @@ use App\Models\{Mailer,User};
@else
<input type="hidden" name="system_id" value="{{ $o->id }}">
<span><small><strong>NOTE:</strong> You'll be able to update these details after registration is completed.</small></span>
{{--
<button type="submit" class="btn btn-success float-end" name="submit" value="register">Register</button>
--}}
@endcan
@else
<button type="submit" class="btn btn-success float-end" name="submit" value="create">Register</button>

View File

@@ -29,7 +29,7 @@ use App\Models\System;
@foreach (System::select(['systems.id','systems.name'])
->active()
->where('id','<>',$setup->system_id)
->whereRaw('id NOT IN (SELECT system_id FROM system_user)')
->whereRaw('id NOT IN (SELECT system_id FROM "system_user")')
->cursor() as $oo)
<option value="{{ $oo->id }}" @if(old('id')===$oo->id)selected @endif>{{ $oo->name }}</option>
@endforeach