Show ZC/RC name instead of system name, tweak FTN sort order
This commit is contained in:
parent
25f853cea4
commit
e207e0a1d8
@ -12,6 +12,17 @@ class Address extends Model
|
|||||||
{
|
{
|
||||||
use ScopeActive;
|
use ScopeActive;
|
||||||
|
|
||||||
|
/* SCOPES */
|
||||||
|
|
||||||
|
public function scopeFTNOrder($query)
|
||||||
|
{
|
||||||
|
return $query
|
||||||
|
->orderBy('region_id')
|
||||||
|
->orderByRaw('host_id NULLS FIRST')
|
||||||
|
->orderBy('node_id')
|
||||||
|
->orderBy('point_id');
|
||||||
|
}
|
||||||
|
|
||||||
/* RELATIONS */
|
/* RELATIONS */
|
||||||
|
|
||||||
public function system()
|
public function system()
|
||||||
@ -101,6 +112,12 @@ class Address extends Model
|
|||||||
return ($o && $o->system->active) ? $o : NULL;
|
return ($o && $o->system->active) ? $o : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the address session details/passwords
|
||||||
|
*
|
||||||
|
* @param string $type
|
||||||
|
* @return string|null
|
||||||
|
*/
|
||||||
public function session(string $type): ?string
|
public function session(string $type): ?string
|
||||||
{
|
{
|
||||||
static $session = NULL;
|
static $session = NULL;
|
||||||
|
@ -5,6 +5,7 @@ namespace App\Models;
|
|||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
use App\Http\Controllers\DomainController;
|
||||||
use App\Traits\ScopeActive;
|
use App\Traits\ScopeActive;
|
||||||
|
|
||||||
class System extends Model
|
class System extends Model
|
||||||
@ -21,4 +22,29 @@ class System extends Model
|
|||||||
->orderBy('node_id')
|
->orderBy('node_id')
|
||||||
->orderBy('point_id');
|
->orderBy('point_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* GENERAL METHODS */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the system name, or role name for the zone
|
||||||
|
*
|
||||||
|
* @param Address $o
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function name(Address $o): string
|
||||||
|
{
|
||||||
|
switch ($o->attributes['role']) {
|
||||||
|
case DomainController::NODE_ZC;
|
||||||
|
return sprintf('ZC-%s-%05d',$o->zone->domain->name,$o->zone->zone_id);
|
||||||
|
|
||||||
|
case DomainController::NODE_RC;
|
||||||
|
return sprintf('RC-%s-%05d',$o->zone->domain->name,$o->region_id);
|
||||||
|
|
||||||
|
case DomainController::NODE_NC;
|
||||||
|
case DomainController::NODE_HC;
|
||||||
|
case NULL:
|
||||||
|
default:
|
||||||
|
return $this->name;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -71,7 +71,7 @@
|
|||||||
@foreach ($o->zones as $oz)
|
@foreach ($o->zones as $oz)
|
||||||
<!-- First System Zone -->
|
<!-- First System Zone -->
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ $oz->system->name }}</td>
|
<td>{{ sprintf('ZC-%s-%05d',$oz->domain->name,$oz->zone_id) }}</td>
|
||||||
<td>{{ $oz->system->sysop }}</td>
|
<td>{{ $oz->system->sysop }}</td>
|
||||||
<td>{{ $oz->system->location }}</td>
|
<td>{{ $oz->system->location }}</td>
|
||||||
<td>Zone</td>
|
<td>Zone</td>
|
||||||
@ -80,9 +80,9 @@
|
|||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<!-- Other Nodes -->
|
<!-- Other Nodes -->
|
||||||
@foreach ($oz->addresses()->orderBy('region_id')->orderBy('host_id','desc')->orderBy('node_id')->orderBy('point_id')->with(['system','zone.domain'])->get() as $ao)
|
@foreach ($oz->addresses()->FTNorder()->with(['system','zone.domain'])->get() as $ao)
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ $ao->system->name }}</td>
|
<td>{{ $ao->system->name($ao) }}</td>
|
||||||
<td>{{ $ao->system->sysop }}</td>
|
<td>{{ $ao->system->sysop }}</td>
|
||||||
<td>{{ $ao->system->location }}</td>
|
<td>{{ $ao->system->location }}</td>
|
||||||
<td>{{ $ao->role }}</td>
|
<td>{{ $ao->role }}</td>
|
||||||
|
Loading…
Reference in New Issue
Block a user