From c034ce6cd4293bb8c695a4a226e17b267111ab63 Mon Sep 17 00:00:00 2001 From: Deon George Date: Fri, 25 Nov 2022 17:44:03 +0700 Subject: [PATCH] Added FTN list, System View --- app/Http/Controllers/HomeController.php | 2 +- app/Http/Controllers/SystemController.php | 8 ++ app/Models/Address.php | 5 + app/Models/Domain.php | 20 ++++ app/Models/System.php | 23 ++++ public/css/fixes.css | 5 +- public/oldschool/css/main.css | 44 ++++++++ resources/views/domain/addedit.blade.php | 18 +-- resources/views/domain/list.blade.php | 45 ++++++++ .../views/layouts/partials/sidebar.blade.php | 19 ++-- .../views/layouts/partials/topmenu.blade.php | 1 + resources/views/setup.blade.php | 2 +- resources/views/system/view.blade.php | 104 ++++++++++++++++++ routes/web.php | 3 + 14 files changed, 278 insertions(+), 21 deletions(-) create mode 100644 resources/views/domain/list.blade.php create mode 100644 resources/views/system/view.blade.php diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 0ca1440..543a598 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -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)) $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 diff --git a/app/Http/Controllers/SystemController.php b/app/Http/Controllers/SystemController.php index ee3102e..beb88b3 100644 --- a/app/Http/Controllers/SystemController.php +++ b/app/Http/Controllers/SystemController.php @@ -613,4 +613,12 @@ class SystemController extends Controller ->with('o',$o) ->with('errors',new ViewErrorBag); } + + public function view(System $o) + { + $o->load(['addresses.echomails.echoarea']); + + return view('system.view') + ->with('o',$o); + } } \ No newline at end of file diff --git a/app/Models/Address.php b/app/Models/Address.php index 76f63d7..918334e 100644 --- a/app/Models/Address.php +++ b/app/Models/Address.php @@ -176,6 +176,11 @@ class Address extends Model ->withPivot(['sent_at','export_at','packet']); } + public function echomail_from() + { + return $this->hasMany(Echomail::class,'fftn_id','id'); + } + /** * Files that this address has seen * diff --git a/app/Models/Domain.php b/app/Models/Domain.php index 1b3046d..fcb0e1f 100644 --- a/app/Models/Domain.php +++ b/app/Models/Domain.php @@ -129,4 +129,24 @@ class Domain extends Model ->orderBy('echoareas.name') ->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); + } } \ No newline at end of file diff --git a/app/Models/System.php b/app/Models/System.php index 1d21cee..da43890 100644 --- a/app/Models/System.php +++ b/app/Models/System.php @@ -83,6 +83,29 @@ class System extends Model 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 */ public function echoareas() diff --git a/public/css/fixes.css b/public/css/fixes.css index 544d054..0fc3e47 100644 --- a/public/css/fixes.css +++ b/public/css/fixes.css @@ -59,7 +59,6 @@ ol { margin-left: -1ch; } -.trashed { - text-decoration: line-through; - color: #3f6982; +.btn.btn-success a { + color: white; } \ No newline at end of file diff --git a/public/oldschool/css/main.css b/public/oldschool/css/main.css index d6c938e..81ce2cb 100644 --- a/public/oldschool/css/main.css +++ b/public/oldschool/css/main.css @@ -670,6 +670,45 @@ tbody { 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 { margin:1.5em auto 2.5em auto } @@ -778,4 +817,9 @@ a.link:focus:after { } .modal-body { color: #0c0c0c; +} + +.trashed { + text-decoration: line-through; + color: #3f6982; } \ No newline at end of file diff --git a/resources/views/domain/addedit.blade.php b/resources/views/domain/addedit.blade.php index ec4e3ea..37992ef 100644 --- a/resources/views/domain/addedit.blade.php +++ b/resources/views/domain/addedit.blade.php @@ -43,14 +43,18 @@
- @if ($o->nodelist_filename) - -
- - -
+ @if ($o->managed()) + @if ($o->nodelist_filename) + +
+ + +
+ @else + No Nodelist filearea + @endif @else - No Nodelist filearea + This domain is not configured here. @endif
diff --git a/resources/views/domain/list.blade.php b/resources/views/domain/list.blade.php new file mode 100644 index 0000000..0f8c08a --- /dev/null +++ b/resources/views/domain/list.blade.php @@ -0,0 +1,45 @@ +@extends('layouts.app') +@section('htmlheader_title') + Known FTN Networks +@endsection + +@section('content') +
+
+

List of known FTN Networks

+ +

Here is a list of known FTN Networks.

+
+ +
+ + + + + + + + + + + + + @foreach (\App\Models\Domain::public()->orderBy('name')->with(['zones.addresses.system'])->get() as $do) + + + + + + + + + @endforeach + +
DomainZonesActiveAvailable HereHead QuartersKnown Systems
{{ $do->name }}{{ $do->zones->pluck('zone_id')->sort()->join(', ') }}{{ $do->active ? 'YES' : 'NO' }}{{ $do->managed() ? 'YES' : 'NO' }} + @foreach (($x=$do->zones->pluck('addresses')->flatten())->where('role',\App\Models\Address::NODE_ZC) as $ao) + {{ $ao->system->sysop }}, {{ $ao->system->name }} + @endforeach + {{ $x->pluck('system')->unique('name')->count() }}
+
+
+@endsection \ No newline at end of file diff --git a/resources/views/layouts/partials/sidebar.blade.php b/resources/views/layouts/partials/sidebar.blade.php index c330db6..e74ea04 100644 --- a/resources/views/layouts/partials/sidebar.blade.php +++ b/resources/views/layouts/partials/sidebar.blade.php @@ -1,5 +1,15 @@