Only show 3D addresses where necessary

This commit is contained in:
Deon George 2021-06-26 11:48:55 +10:00
parent 2f23158c1b
commit 945afbfe4b
5 changed files with 28 additions and 17 deletions

View File

@ -71,7 +71,7 @@ class DomainController extends Controller
->get(); ->get();
return $oo->map(function($item) { return $oo->map(function($item) {
return ['id'=>$item->host_id,'value'=>sprintf('%s %s',$item->ftn,$item->system->name)]; return ['id'=>$item->host_id,'value'=>sprintf('%s %s',$item->ftn_3d,$item->system->name)];
}); });
} }
@ -91,7 +91,7 @@ class DomainController extends Controller
->get(); ->get();
return $oo->map(function($item) { return $oo->map(function($item) {
return ['id'=>$item->id,'value'=>sprintf('%s %s',$item->ftn,$item->system->name)]; return ['id'=>$item->id,'value'=>sprintf('%s %s',$item->ftn_3d,$item->system->name)];
}); });
} }
@ -112,7 +112,7 @@ class DomainController extends Controller
->get(); ->get();
return $oo->map(function($item) { return $oo->map(function($item) {
return ['id'=>$item->region_id,'value'=>sprintf('%s %s',$item->ftn,$item->system->location)]; return ['id'=>$item->region_id,'value'=>sprintf('%s %s',$item->ftn_3d,$item->system->location)];
}); });
} }

View File

@ -45,7 +45,17 @@ class Address extends Model
*/ */
public function getFTNAttribute() public function getFTNAttribute()
{ {
return sprintf('%d:%d/%d.%d@%s',$this->zone->zone_id,$this->host_id ?: $this->region_id,$this->node_id,$this->point_id,$this->zone->domain->name); return sprintf('%s@%s',$this->getFTN4DAttribute(),$this->zone->domain->name);
}
public function getFTN3DAttribute()
{
return sprintf('%d:%d/%d',$this->zone->zone_id,$this->host_id ?: $this->region_id,$this->node_id);
}
public function getFTN4DAttribute()
{
return sprintf('%s.%d',$this->getFTN3DAttribute(),$this->point_id);
} }
public function getRoleAttribute($value) public function getRoleAttribute($value)

View File

@ -73,38 +73,38 @@
<td>{{ sprintf('ZC-%s-%05d',$oz->domain->name,$oz->zone_id) }}</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>{{ $oz->zone_id }}:0/0.0<span>@</span>{{ $oz->domain->name }}</td> <td>{{ $oz->zone_id }}:0/0</td>
<td>-</td> <td>-</td>
</tr> </tr>
@foreach ($oz->addresses()->active()->FTNorder()->whereNull('hub_id')->with(['system','zone.domain'])->get() as $ao) @foreach ($oz->addresses()->active()->FTNorder()->where('point_id',0)->whereNull('hub_id')->with(['system','zone.domain'])->get() as $ao)
@if ($ao->role == 'Host') @if ($ao->role == 'Host')
<tr> <tr>
<td>{{ sprintf('NC-%s-%05d',$oz->domain->name,$ao->host_id) }} @auth<span class="float-end"><small>[{{ $ao->id }}]</small></span>@endauth</td> <td>{{ sprintf('NC-%s-%05d',$oz->domain->name,$ao->host_id) }} @auth<span class="float-end"><small>[{{ $ao->system_id }}]</small></span>@endauth</td>
<td>{{ $ao->system->sysop }}</td> <td>{{ $ao->system->sysop }}</td>
<td>{{ $ao->system->location }}</td> <td>{{ $ao->system->location }}</td>
<td>{{ $oz->zone_id }}:{{ $ao->host_id }}/0.0<span>@</span>{{ $oz->domain->name }}</td> <td>{{ $oz->zone_id }}:{{ $ao->host_id }}/0</td>
<td>-</td> <td>-</td>
</tr> </tr>
@endif @endif
<tr> <tr>
<td>{{ $ao->system->full_name($ao) }} @auth<span class="float-end"><small>[{{ $ao->id }}]</small></span>@endauth</td> <td>{{ $ao->system->full_name($ao) }} @auth<span class="float-end"><small>[{{ $ao->system_id }}]</small></span>@endauth</td>
<td>{{ $ao->system->sysop }}</td> <td>{{ $ao->system->sysop }}</td>
<td>{{ $ao->system->location }}</td> <td>{{ $ao->system->location }}</td>
<td>{{ $ao->ftn }}</td> <td>{{ $ao->ftn_3d }}</td>
<td>-</td> <td>-</td>
</tr> </tr>
<!-- If this node is a hub --> <!-- If this node is a hub -->
@if ($ao->role == 'Hub') @if ($ao->role == 'Hub')
@foreach ($oz->addresses()->active()->FTNorder()->where('hub_id',$ao->id)->with(['system','zone.domain'])->get() as $aoo) @foreach ($oz->addresses()->active()->FTNorder()->where('point_id',0)->where('hub_id',$ao->id)->with(['system','zone.domain'])->get() as $aoo)
<tr> <tr>
<td>{{ $aoo->system->full_name($aoo) }} @auth<span class="float-end"><small>[{{ $aoo->id }}]</small></span>@endauth</td> <td>{{ $aoo->system->full_name($aoo) }} @auth<span class="float-end"><small>[{{ $aoo->system_id }}]</small></span>@endauth</td>
<td>{{ $aoo->system->sysop }}</td> <td>{{ $aoo->system->sysop }}</td>
<td>{{ $aoo->system->location }}</td> <td>{{ $aoo->system->location }}</td>
<td>{{ $aoo->role }}</td> <td>{{ $aoo->role }}</td>
<td>{{ $aoo->ftn }}</td> <td>{{ $aoo->ftn_3d }}</td>
<td>-</td> <td>-</td>
</tr> </tr>
@endforeach @endforeach

View File

@ -288,7 +288,7 @@
<tbody> <tbody>
@foreach ($o->addresses->sortBy(['region_id','host_id']) as $oo) @foreach ($o->addresses->sortBy(['region_id','host_id']) as $oo)
<tr> <tr>
<td>{{ $oo->ftn }}</td> <td>{{ $oo->ftn_4d }}</td>
<td>{{ $oo->active ? 'YES' : 'NO' }}</td> <td>{{ $oo->active ? 'YES' : 'NO' }}</td>
<td>{{ $oo->role }}</td> <td>{{ $oo->role }}</td>
</tr> </tr>
@ -529,7 +529,7 @@
$('#region_id').append('<option value="new">New Region</option>'); $('#region_id').append('<option value="new">New Region</option>');
data.forEach(function(item) { data.forEach(function(item) {
$('#region_id').append('<option value="'+item.id+'">'+item.id+':'+item.value+'</option>'); $('#region_id').append('<option value="'+item.id+'">'+item.value+'</option>');
}); });
$('#region_id').prop('disabled',false); $('#region_id').prop('disabled',false);
@ -617,7 +617,7 @@
$('#host_id').append('<option value="new">New Host</option>'); $('#host_id').append('<option value="new">New Host</option>');
data.forEach(function(item) { data.forEach(function(item) {
$('#host_id').append('<option value="'+item.id+'">'+item.id+':'+item.value+'</option>'); $('#host_id').append('<option value="'+item.id+'">'+item.value+'</option>');
}); });
$('#host_id').prop('disabled',false); $('#host_id').prop('disabled',false);
@ -683,7 +683,7 @@
$('#hub_id').append('<option value="">No Hub</option>'); $('#hub_id').append('<option value="">No Hub</option>');
data.forEach(function(item) { data.forEach(function(item) {
$('#hub_id').append('<option value="'+item.id+'">'+item.id+':'+item.value+'</option>'); $('#hub_id').append('<option value="'+item.id+'">'+item.value+'</option>');
}); });
$('#hub_id').prop('disabled',false); $('#hub_id').prop('disabled',false);

View File

@ -85,6 +85,7 @@
paging: true, paging: true,
pageLength: 25, pageLength: 25,
searching: true, searching: true,
autoWidth: false,
columnDefs: [ columnDefs: [
{ {
targets: [5,6], targets: [5,6],