Rework ZoneController methods and paths, no functional changes

This commit is contained in:
Deon George 2023-10-05 22:27:25 +11:00
parent fda68bba04
commit 27985dbf0b
7 changed files with 16 additions and 18 deletions

View File

@ -126,9 +126,4 @@ class ZoneController extends Controller
'default' => (bool)$request->set, 'default' => (bool)$request->set,
]); ]);
} }
public function home()
{
return view('zone.home');
}
} }

View File

@ -27,7 +27,7 @@
<dt>Network Admin</dt> <dt>Network Admin</dt>
<dd><a href="{{ url('ftn/domain') }}">Domains</a></dd> <dd><a href="{{ url('ftn/domain') }}">Domains</a></dd>
<dd><a href="{{ url('system') }}">Systems</a></dd> <dd><a href="{{ url('system') }}">Systems</a></dd>
<dd><a href="{{ url('ftn/zone') }}">Zones</a></dd> <dd><a href="{{ url('zone') }}">Zones</a></dd>
<dd><a href="{{ url('ftn/echoarea') }}">Echoareas</a></dd> <dd><a href="{{ url('ftn/echoarea') }}">Echoareas</a></dd>
<dd><a href="{{ url('ftn/filearea') }}">Fileareas</a></dd> <dd><a href="{{ url('ftn/filearea') }}">Fileareas</a></dd>
</dl> </dl>

View File

@ -669,7 +669,7 @@
if (e.status != 412) if (e.status != 412)
alert('That didnt work? Please try again....'); alert('That didnt work? Please try again....');
}, },
url: '{{ url('default') }}/'+item.attributes.itemid.nodeValue, url: '{{ url('zone/api/default') }}/'+item.attributes.itemid.nodeValue,
cache: false cache: false
}) })
}); });

View File

@ -165,7 +165,7 @@
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<a href="{{ url('ftn/zone') }}" class="btn btn-danger">Cancel</a> <a href="{{ url('zone') }}" class="btn btn-danger">Cancel</a>
@can('admin',$o) @can('admin',$o)
<button type="submit" name="submit" class="btn btn-success float-end">@if ($o->exists)Save @else Add @endif</button> <button type="submit" name="submit" class="btn btn-success float-end">@if ($o->exists)Save @else Add @endif</button>
@endcan @endcan

View File

@ -10,7 +10,7 @@
<p>In FTN network addresses, a zone is the 3rd dimension and used when a system supports 3D (or better) addressing, ie: <strong class="highlight">zone</strong>:net/node.point@domain.</p> <p>In FTN network addresses, a zone is the 3rd dimension and used when a system supports 3D (or better) addressing, ie: <strong class="highlight">zone</strong>:net/node.point@domain.</p>
<p>Zones are used with domains to uniquely identify a FTN network. Within an FTN network there can be multiple zones with the same domain.</p> <p>Zones are used with domains to uniquely identify a FTN network. Within an FTN network there can be multiple zones with the same domain.</p>
<p>It is rare that a domain has multiple zones - unless it grows quite large. Zones can also be used to group systems into a common boundary.</p> <p>It is rare that a domain has multiple zones - unless it grows quite large. Zones can also be used to group systems into a common boundary.</p>
<p>This system is aware of the following zones in each domain @can('admin',(new \App\Models\Zone))(you can <a href="{{ url('ftn/zone/addedit') }}">add</a> more)@endcan:</p> <p>This system is aware of the following zones in each domain @can('admin',(new \App\Models\Zone))(you can <a href="{{ url('zone/addedit') }}">add</a> more)@endcan:</p>
</div> </div>
</div> </div>
@ -18,7 +18,7 @@
<div class="col-9"> <div class="col-9">
@if (\App\Models\Zone::count() === 0) @if (\App\Models\Zone::count() === 0)
@can('admin',(new \App\Models\Zone)) @can('admin',(new \App\Models\Zone))
<p>There are no zones setup, to <a href="{{ url('ftn/zone/addedit') }}">set up your first</a>.</p> <p>There are no zones setup, to <a href="{{ url('zone/addedit') }}">set up your first</a>.</p>
@else @else
<p class="pad">There are no zones - you need to ask an admin to create one for you.</p> <p class="pad">There are no zones - you need to ask an admin to create one for you.</p>
@endcan @endcan
@ -38,7 +38,7 @@
@foreach (\App\Models\Zone::orderBy('zone_id')->with(['domain','addresses'])->get() as $oo) @foreach (\App\Models\Zone::orderBy('zone_id')->with(['domain','addresses'])->get() as $oo)
<tr> <tr>
<td>{{ $oo->domain->name }}</td> <td>{{ $oo->domain->name }}</td>
<td><a href="{{ url('ftn/zone/addedit',[$oo->id]) }}">{{ $oo->zone_id }}</a></td> <td><a href="{{ url('zone/addedit',[$oo->id]) }}">{{ $oo->zone_id }}</a></td>
<td>{{ $oo->active ? 'YES' : 'NO' }}</td> <td>{{ $oo->active ? 'YES' : 'NO' }}</td>
<td>{{ $oo->default ? 'YES' : 'NO' }}</td> <td>{{ $oo->default ? 'YES' : 'NO' }}</td>
<td>{{ $oo->addresses->count() }}</td> <td>{{ $oo->addresses->count() }}</td>

View File

@ -52,8 +52,7 @@ Route::get('search',[HomeController::class,'search']);
Route::middleware(['auth','verified','activeuser'])->group(function () { Route::middleware(['auth','verified','activeuser'])->group(function () {
Route::get('dashboard',[UserController::class,'dashboard']); Route::get('dashboard',[UserController::class,'dashboard']);
Route::post('default/{o}',[ZoneController::class,'api_default'])
->where('o','[0-9]+');
Route::get('ftn/domain',[DomainController::class,'home']); Route::get('ftn/domain',[DomainController::class,'home']);
Route::match(['get','post'],'ftn/domain/addedit/{o?}',[DomainController::class,'add_edit']) Route::match(['get','post'],'ftn/domain/addedit/{o?}',[DomainController::class,'add_edit'])
@ -108,9 +107,6 @@ Route::middleware(['auth','verified','activeuser'])->group(function () {
Route::post('file/contents/{o}/{date}',[HomeController::class,'file_contents']) Route::post('file/contents/{o}/{date}',[HomeController::class,'file_contents'])
->where('o','[0-9]+') ->where('o','[0-9]+')
->where('date','[0-9:\-@]+'); ->where('date','[0-9:\-@]+');
Route::get('ftn/zone',[ZoneController::class,'home']);
Route::match(['get','post'],'ftn/zone/addedit/{o?}',[ZoneController::class,'add_edit'])
->where('o','[0-9]+');
Route::get('hosts/{o}/{region}',[DomainController::class,'api_hosts']) Route::get('hosts/{o}/{region}',[DomainController::class,'api_hosts'])
->where('o','[0-9]+') ->where('o','[0-9]+')
@ -127,6 +123,13 @@ Route::middleware(['auth','verified','activeuser'])->group(function () {
Route::match(['get','post'],'user/system/register',[SystemController::class,'register']); Route::match(['get','post'],'user/system/register',[SystemController::class,'register']);
Route::match(['post'],'user/system/link',[SystemController::class,'system_link']); Route::match(['post'],'user/system/link',[SystemController::class,'system_link']);
/* ZONE PATHS */
Route::view('zone','zone.home');
Route::post('zone/api/default/{o}',[ZoneController::class,'api_default'])
->where('o','[0-9]+');
Route::match(['get','post'],'zone/addedit/{o?}',[ZoneController::class,'add_edit'])
->where('o','[0-9]+');
}); });
Route::middleware(['auth','can:admin'])->group(function () { Route::middleware(['auth','can:admin'])->group(function () {

View File

@ -23,7 +23,7 @@ class SiteAdminTest extends TestCase
$this->get('ftn/domain') $this->get('ftn/domain')
->assertRedirect('login'); ->assertRedirect('login');
$this->get('ftn/zone') $this->get('zone')
->assertRedirect('login'); ->assertRedirect('login');
$this->get('network/999') $this->get('network/999')
@ -54,7 +54,7 @@ class SiteAdminTest extends TestCase
$this->get('ftn/domain') $this->get('ftn/domain')
->assertRedirect('email/verify'); ->assertRedirect('email/verify');
$this->get('ftn/zone') $this->get('zone')
->assertRedirect('email/verify'); ->assertRedirect('email/verify');
Auth::logout(); Auth::logout();