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))
$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

View File

@@ -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);
}
}

View File

@@ -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
*

View File

@@ -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);
}
}

View File

@@ -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()