Change address promot/demote to only apply to normal nodes and hubs

This commit is contained in:
Deon George 2024-12-06 08:45:29 +11:00
parent e7336a942b
commit 70f3a049f6
2 changed files with 13 additions and 7 deletions

View File

@ -173,7 +173,9 @@ class SystemController extends Controller
// Make sure that no other system has this address active. // Make sure that no other system has this address active.
if ($o->role_id === Address::NODE_NN) if ($o->role_id === Address::NODE_NN)
return redirect()->back()->withErrors(['address'=>sprintf('%s cannot be demoted any more',$o->ftn3D)]); return redirect()
->back()
->withErrors(['address'=>sprintf('%s cannot be demoted any more',$o->ftn3D)]);
$off = $o->role_id; $off = $o->role_id;
$o->role &= ~$off; $o->role &= ~$off;
@ -181,7 +183,8 @@ class SystemController extends Controller
$o->save(); $o->save();
return redirect()->to(sprintf('system/addedit/%d',$o->system_id)); return redirect()
->to(sprintf('system/addedit/%d',$o->system_id));
} }
public function address_merge(AddressMerge $request,int $id) public function address_merge(AddressMerge $request,int $id)
@ -351,8 +354,10 @@ class SystemController extends Controller
session()->flash('accordion','address'); session()->flash('accordion','address');
// Make sure that no other system has this address active. // Make sure that no other system has this address active.
if ($o->role_id === Address::NODE_NC) if ($o->role_id === Address::NODE_HC)
return redirect()->back()->withErrors(['address'=>sprintf('%s cannot be promoted any more',$o->ftn3D)]); return redirect()
->back()
->withErrors(['address'=>sprintf('%s cannot be promoted any more',$o->ftn3D)]);
$off = $o->role_id; $off = $o->role_id;
$o->role &= ~$off; $o->role &= ~$off;
@ -360,7 +365,8 @@ class SystemController extends Controller
$o->save(); $o->save();
return redirect()->to(sprintf('system/addedit/%d',$o->system_id)); return redirect()
->to(sprintf('system/addedit/%d',$o->system_id));
} }
/** /**

View File

@ -142,10 +142,10 @@
<a href="{{ url('system/address/sus',[$oo->id]) }}" title="@if($oo->active)Pause @else Activate @endif Address"><i class="bi @if($oo->active)bi-pause-circle @else bi-play-circle @endif"></i></a> <a href="{{ url('system/address/sus',[$oo->id]) }}" title="@if($oo->active)Pause @else Activate @endif Address"><i class="bi @if($oo->active)bi-pause-circle @else bi-play-circle @endif"></i></a>
<a href="{{ url('system/address/mov',[$o->id,$oo->id]) }}" title="Move Address to another System"><i class="bi bi-arrow-right-square"></i></a> <a href="{{ url('system/address/mov',[$o->id,$oo->id]) }}" title="Move Address to another System"><i class="bi bi-arrow-right-square"></i></a>
<a href="{{ url('system/address/del',[$oo->id]) }}" title="Delete Address"><i class="bi bi-trash"></i></a> <a href="{{ url('system/address/del',[$oo->id]) }}" title="Delete Address"><i class="bi bi-trash"></i></a>
@if ((Address::NODE_HC|Address::NODE_NN) & $oo->role_id) @if ($oo->role_id === Address::NODE_NN)
<a href="{{ url('system/address/pro',[$oo->id]) }}" title="Promote Address"><i class="bi bi-arrow-up-square"></i></a> <a href="{{ url('system/address/pro',[$oo->id]) }}" title="Promote Address"><i class="bi bi-arrow-up-square"></i></a>
@endif @endif
@if ((Address::NODE_NC|Address::NODE_HC) & $oo->role_id) @if ($oo->role_id === Address::NODE_HC)
<a href="{{ url('system/address/dem',[$oo->id]) }}" title="Demote Address"><i class="bi bi-arrow-down-square"></i></a> <a href="{{ url('system/address/dem',[$oo->id]) }}" title="Demote Address"><i class="bi bi-arrow-down-square"></i></a>
@endif @endif
@endif @endif