Added FTN list, System View

This commit is contained in:
Deon George 2022-11-25 17:44:03 +07:00
parent 102a972fcb
commit c034ce6cd4
14 changed files with 278 additions and 21 deletions

View File

@ -120,7 +120,7 @@ class HomeController extends Controller
if ($o->zone_id && ($o->region_id||$o->host_id) && is_numeric($o->node_id) && is_numeric($o->point_id)) if ($o->zone_id && ($o->region_id||$o->host_id) && is_numeric($o->node_id) && is_numeric($o->point_id))
$ftn = sprintf('%d:%d/%d.%d',$o->zone_id,$o->host_id ?: $o->region_id,$o->node_id,$o->point_id); $ftn = sprintf('%d:%d/%d.%d',$o->zone_id,$o->host_id ?: $o->region_id,$o->node_id,$o->point_id);
$result->push(['id'=>$o->system_id,'name'=>$o->name.($ftn ? ' '.$ftn : ''),'value'=>url('ftn/system/addedit',[$o->system_id]),'category'=>'Systems']); $result->push(['id'=>$o->system_id,'name'=>$o->name.($ftn ? ' '.$ftn : ''),'value'=>url('system/view',[$o->system_id]),'category'=>'Systems']);
} }
# Look for Messages # Look for Messages

View File

@ -613,4 +613,12 @@ class SystemController extends Controller
->with('o',$o) ->with('o',$o)
->with('errors',new ViewErrorBag); ->with('errors',new ViewErrorBag);
} }
public function view(System $o)
{
$o->load(['addresses.echomails.echoarea']);
return view('system.view')
->with('o',$o);
}
} }

View File

@ -176,6 +176,11 @@ class Address extends Model
->withPivot(['sent_at','export_at','packet']); ->withPivot(['sent_at','export_at','packet']);
} }
public function echomail_from()
{
return $this->hasMany(Echomail::class,'fftn_id','id');
}
/** /**
* Files that this address has seen * Files that this address has seen
* *

View File

@ -129,4 +129,24 @@ class Domain extends Model
->orderBy('echoareas.name') ->orderBy('echoareas.name')
->get(); ->get();
} }
/**
* Determine if this zone is managed by this host
*
* @return bool
*/
public function managed(): bool
{
static $so = NULL;
if (is_null($so))
$so = Setup::findOrFail(config('app.id'));
return $so
->system
->addresses
->where('zone.domain.active',TRUE)
->pluck('zone.domain_id')
->contains($this->id);
}
} }

View File

@ -83,6 +83,29 @@ class System extends Model
return $this->hasManyThrough(Zone::class,Address::class,'system_id','id','id','zone_id'); return $this->hasManyThrough(Zone::class,Address::class,'system_id','id','id','zone_id');
} }
/* ATTRIBUTES */
public function getAccessMethodAttribute(): string
{
switch ($this->method) {
case 23: return sprintf('telnet://%s:%s',$this->address,$this->port);
case 22: return sprintf('ssh://%s:%s',$this->address,$this->port);
case 513: return sprintf('rlogin://%s:%s',$this->address,$this->port);
default:
return $this->method ? sprintf('%s:%s',$this->address,$this->port) : 'No access method available.';
}
}
public function getAccessMailerAttribute(): string
{
switch ($this->mailer_type) {
case Setup::O_BINKP: return sprintf('binkp://%s:%s',$this->mailer_address,$this->mailer_port);
case Setup::O_EMSI: return sprintf('emsi://%s:%s',$this->mailer_address,$this->mailer_port);
default:
return $this->mailer_type ? sprintf('%s:%s',$this->address,$this->port) : 'No mailer available.';
}
}
/* METHODS */ /* METHODS */
public function echoareas() public function echoareas()

View File

@ -59,7 +59,6 @@ ol {
margin-left: -1ch; margin-left: -1ch;
} }
.trashed { .btn.btn-success a {
text-decoration: line-through; color: white;
color: #3f6982;
} }

View File

@ -670,6 +670,45 @@ tbody {
font-size: 85%; font-size: 85%;
} }
table.noborder {
margin-top:.5em;
margin-bottom:1.5em;
text-indent:0;
}
table.noborder thead {
color:#fff;
background-color:#000;
border-style: none;
}
table.noborder thead tr:first-child {
border: 0;
}
table.noborder thead tr {
border: 0;
}
table.noborder th {
border: 0;
}
table.noborder tbody {
border-style: none;
}
table.noborder td {
border: 0;
}
table.noborder tbody tr td:not(:last-child) {
border: 0;
}
table.noborder tfoot {
background-color:#000;
border: 0;
}
table.noborder tfoot tr td {
border-bottom: 0;
color: #eee;
font-size: 85%;
}
.titledbox { .titledbox {
margin:1.5em auto 2.5em auto margin:1.5em auto 2.5em auto
} }
@ -779,3 +818,8 @@ a.link:focus:after {
.modal-body { .modal-body {
color: #0c0c0c; color: #0c0c0c;
} }
.trashed {
text-decoration: line-through;
color: #3f6982;
}

View File

@ -43,14 +43,18 @@
</div> </div>
<div class="col-4"> <div class="col-4">
@if ($o->nodelist_filename) @if ($o->managed())
<label for="nodelist_filename" class="form-label">Nodelist Filearea</label> @if ($o->nodelist_filename)
<div class="input-group"> <label for="nodelist_filename" class="form-label">Nodelist Filearea</label>
<span class="input-group-text"><i class="bi bi bi-file-earmark-break-fill"></i></span> <div class="input-group">
<input type="text" class="form-control" id="nodelist_filename" placeholder="Nodelist" name="nodelist_filename" value="{{ $o->nodelist_filename }}" readonly> <span class="input-group-text"><i class="bi bi bi-file-earmark-break-fill"></i></span>
</div> <input type="text" class="form-control" id="nodelist_filename" placeholder="Nodelist" name="nodelist_filename" value="{{ $o->nodelist_filename }}" readonly>
</div>
@else
No Nodelist filearea
@endif
@else @else
No Nodelist filearea This domain is not configured here.
@endif @endif
</div> </div>
</div> </div>

View File

@ -0,0 +1,45 @@
@extends('layouts.app')
@section('htmlheader_title')
Known FTN Networks
@endsection
@section('content')
<div class="row pt-0">
<div class="col-12">
<h2>List of known FTN Networks</h2>
<p>Here is a list of known <strong class="highlight">FTN Networks</strong>.</p>
</div>
<div class="col-10 pt-2">
<table class="table monotable">
<thead>
<tr>
<th>Domain</th>
<th>Zones</th>
<th>Active</th>
<th>Available Here</th>
<th>Head Quarters</th>
<th>Known Systems</th>
</tr>
</thead>
<tbody>
@foreach (\App\Models\Domain::public()->orderBy('name')->with(['zones.addresses.system'])->get() as $do)
<tr>
<td>{{ $do->name }}</td>
<td>{{ $do->zones->pluck('zone_id')->sort()->join(', ') }}</td>
<td class="text-end">{{ $do->active ? 'YES' : 'NO' }}</td>
<td class="text-end">{{ $do->managed() ? 'YES' : 'NO' }}</td>
<td>
@foreach (($x=$do->zones->pluck('addresses')->flatten())->where('role',\App\Models\Address::NODE_ZC) as $ao)
{{ $ao->system->sysop }}, <a href="{{ url('system/view',$ao->system_id) }}">{{ $ao->system->name }}</a>
@endforeach
</td>
<td class="text-end">{{ $x->pluck('system')->unique('name')->count() }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
@endsection

View File

@ -1,5 +1,15 @@
<div id="sidebar-scroller"> <div id="sidebar-scroller">
FTN Networks FTN Networks
<dl>
<dt>Expore Networks</dt>
@foreach (\App\Models\Domain::select(['id','name'])
->when(((! $user) || (! $user->isAdmin())),function($query) { return $query->public()->active(); })
->orderBy('name')->get() as $o)
<dd><a href="{{ url('network',['id'=>$o->id]) }}" title="{{ $o->description }}">{{ $o->name }}</a></dd>
@endforeach
</dl>
@auth @auth
<dl> <dl>
<dt>Network Admin</dt> <dt>Network Admin</dt>
@ -24,15 +34,6 @@
@endcan @endcan
@endauth @endauth
<dl>
<dt>Expore Networks</dt>
@foreach (\App\Models\Domain::active()
->when((! $user),function($query) { return $query->public(); })
->orderBy('name')->get() as $o)
<dd><a href="{{ url('network',['id'=>$o->id]) }}" title="{{ $o->description }}">{{ $o->name }}</a></dd>
@endforeach
</dl>
<dl> <dl>
<dt>Debug</dt> <dt>Debug</dt>
<dd><a href="{{ url('pkt') }}">Verify Packet</a></dd> <dd><a href="{{ url('pkt') }}">Verify Packet</a></dd>

View File

@ -4,6 +4,7 @@
<ul id="navlist-desktop"> <ul id="navlist-desktop">
<li><a href="{{ url($user ? 'dashboard' : '/') }}" class="@if(preg_match('#^/#',request()->path()))thispage @endif"><span>Home</span></a></li> <li><a href="{{ url($user ? 'dashboard' : '/') }}" class="@if(preg_match('#^/#',request()->path()))thispage @endif"><span>Home</span></a></li>
<li><a href="{{ url('about') }}" class="@if(preg_match('#^about#',request()->path()))thispage @endif"><span>About</span></a></li> <li><a href="{{ url('about') }}" class="@if(preg_match('#^about#',request()->path()))thispage @endif"><span>About</span></a></li>
<li><a href="{{ url('domain/list') }}" class="@if(preg_match('#^list#',request()->path()))thispage @endif"><span>FTN List</span></a></li>
{{-- {{--
<li><a href="{{ url('help') }}" class="@if(preg_match('#^help#',request()->path()))thispage @endif disabled"><span>Help</span></a></li> <li><a href="{{ url('help') }}" class="@if(preg_match('#^help#',request()->path()))thispage @endif disabled"><span>Help</span></a></li>
--}} --}}

View File

@ -59,7 +59,7 @@ use App\Models\Setup;
<tr><th colspan="2">System Addresses</th></tr> <tr><th colspan="2">System Addresses</th></tr>
</thead> </thead>
<tbody> <tbody>
@foreach ($o->system->addresses->groupBy('zone_id') as $zones) @foreach ($o->system->addresses->sortBy('zone.domain.name')->groupBy('zone_id') as $zones)
<tr> <tr>
<th>{{ $zones->first()->zone->domain->name }}</th> <th>{{ $zones->first()->zone->domain->name }}</th>
<th class="text-end">{!! $zones->pluck('ftn')->join('<br>') !!}</th> <th class="text-end">{!! $zones->pluck('ftn')->join('<br>') !!}</th>

View File

@ -0,0 +1,104 @@
<!-- $o=System::class -->
@extends('layouts.app')
@section('htmlheader_title')
Systems
@endsection
@section('content')
<div class="row">
<div class="col-12">
<h2>{{ $o->name }}</h2>
<table class="table monotable">
<tbody>
<tr>
<th>System Name</th>
<td>{{ $o->name }} @can('update',$o)<span class="btn btn-success btn-sm float-end"><a href="{{ url('ftn/system/addedit',$o->id) }}">Edit</a></span>@endcan</td>
</tr>
<tr>
<th>Sysop</th>
<td>{{ $o->sysop }}</td>
</tr>
<tr>
<th>Location</th>
<td>{{ $o->location }}</td>
</tr>
<tr>
<th>Address</th>
<td>{{ $o->access_method }}</td>
</tr>
<tr>
<th>Mailer</th>
<td>{{ $o->access_mailer }}</td>
</tr>
@if($o->phone)
<tr>
<th>Phone</th>
<td>{{ $o->phone }}</td>
</tr>
@endif
@if($o->addresses->count())
<tr>
<th>FTN Addresses</th>
<td>
<table class="table noborder">
<thead>
<tr>
<th>Domain</th>
<th>Addresses</th>
</tr>
</thead>
<tbody>
@foreach($o->addresses->sortBy('zone.domain.name')->groupBy('zone.domain.name') as $name => $children)
<tr>
<td><a href="{{ url('network',[$children->first()->zone->domain_id]) }}">{{ $name }}</a></td>
<td>{{ $children->pluck('ftn3d')->join(', ') }}</td>
</tr>
@endforeach
</tbody>
</table>
</td>
</tr>
<tr>
<th>Echoarea Activity</th>
<td>
<table class="table noborder">
<thead>
<tr>
<th>Domain</th>
<th>Echoarea</th>
<th class="text-end">#</th>
<th class="text-end">Last</th>
</tr>
</thead>
<tbody>
@foreach($o->addresses->sortBy('zone.domain.name')->groupBy('zone.domain.name') as $net => $children)
@if($children->pluck('echomails')->flatten()->count())
@foreach($children->pluck('echomails')->flatten()->sortBy('echoarea.name')->groupBy('echoarea.name') as $name => $echomails)
<tr>
<td><a href="{{ url('network',[$children->first()->zone->domain_id]) }}">{{ $net }}</a></td>
<td><a href="{{ url('echoarea/view',[$x=$echomails->first()->echoarea_id]) }}">{{ $name }}</a></td>
<td class="text-end">{{ ($y=$children->pluck('echomail_from')->flatten()->where('echoarea_id',$x))->count() }}</td>
<td class="text-end">{{ $y->max('datetime') }}</td>
</tr>
@endforeach
@else
<tr>
<td><a href="{{ url('network',[$children->first()->zone->domain_id]) }}">{{ $net }}</a></td>
<td colspan="3">No Echoarea Activity</td>
</tr>
@endif
@endforeach
</tbody>
</table>
</td>
</tr>
@endif
</tbody>
</table>
</div>
</div>
@endsection

View File

@ -39,6 +39,9 @@ Route::get('admin/switch/stop',[UserSwitchController::class,'user_switch_stop'])
Route::get('/',[HomeController::class,'home']); Route::get('/',[HomeController::class,'home']);
Route::view('about','about'); Route::view('about','about');
Route::view('domain/list','domain.list');
Route::get('system/view/{o}',[SystemController::class,'view'])
->where('o','[0-9]+');
Route::middleware(['auth','verified','activeuser'])->group(function () { Route::middleware(['auth','verified','activeuser'])->group(function () {
Route::get('dashboard',[UserController::class,'dashboard']); Route::get('dashboard',[UserController::class,'dashboard']);