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();
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();
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();
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()
{
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)