Fix zone update with zt_id, added some ZeroTier network settings
This commit is contained in:
parent
ebabe6e698
commit
25f853cea4
@ -35,11 +35,15 @@ class ZoneController extends Controller
|
|||||||
})
|
})
|
||||||
],
|
],
|
||||||
'system_id' => 'required|exists:systems,id',
|
'system_id' => 'required|exists:systems,id',
|
||||||
'ztid' => 'nullable|size:10|regex:/^([A-Fa-f0-9]){10}$/',
|
'zt_id' => 'nullable|size:10|regex:/^([A-Fa-f0-9]){10}$/',
|
||||||
|
'zt_ipv4' => 'nullable|ipv4',
|
||||||
|
'zt_ipv4_mask' => 'nullable|numeric|lte:31',
|
||||||
|
'zt_ipv6' => 'nullable|ipv6',
|
||||||
|
'zt_ipv6_mask' => 'nullable|numeric|lte:112',
|
||||||
'active' => 'required|boolean',
|
'active' => 'required|boolean',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
foreach (['zone_id','domain_id','system_id','active','notes','ztid'] as $key)
|
foreach (['zone_id','domain_id','system_id','active','notes','zt_id','zt_ipv4','zt_ipv4_mask','zt_ipv6','zt_ipv6_mask'] as $key)
|
||||||
$o->{$key} = $request->post($key);
|
$o->{$key} = $request->post($key);
|
||||||
|
|
||||||
$o->save();
|
$o->save();
|
||||||
|
@ -10,6 +10,16 @@ class Zone extends Model
|
|||||||
{
|
{
|
||||||
use ScopeActive;
|
use ScopeActive;
|
||||||
|
|
||||||
|
/* SCOPES */
|
||||||
|
|
||||||
|
public function scopeDomainZoneOrder($query)
|
||||||
|
{
|
||||||
|
return $query
|
||||||
|
->join('domains',['domains.id'=>'zones.domain_id'])
|
||||||
|
->orderBy('domains.name')
|
||||||
|
->orderBy('zone_id');
|
||||||
|
}
|
||||||
|
|
||||||
/* RELATIONS */
|
/* RELATIONS */
|
||||||
|
|
||||||
public function addresses()
|
public function addresses()
|
||||||
|
@ -311,7 +311,7 @@
|
|||||||
<span class="input-group-text"><i class="bi bi-hash"></i></span>
|
<span class="input-group-text"><i class="bi bi-hash"></i></span>
|
||||||
<select class="form-select @error('zone_id') is-invalid @enderror" id="zone_id" name="zone_id" required>
|
<select class="form-select @error('zone_id') is-invalid @enderror" id="zone_id" name="zone_id" required>
|
||||||
<option></option>
|
<option></option>
|
||||||
@foreach(\App\Models\Zone::active()->with(['domain'])->get() as $zo)
|
@foreach(\App\Models\Zone::active()->domainZoneOrder()->with(['domain'])->get() as $zo)
|
||||||
<option value="{{ $zo->id }}">{{ $zo->zone_id }} <small>({{ $zo->domain->name }})</small></option>
|
<option value="{{ $zo->id }}">{{ $zo->zone_id }} <small>({{ $zo->domain->name }})</small></option>
|
||||||
@endforeach
|
@endforeach
|
||||||
</select>
|
</select>
|
||||||
|
@ -87,17 +87,53 @@
|
|||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-2">
|
<div class="col-2">
|
||||||
<label for="ztid" class="form-label">ZeroTier Network ID</label>
|
<label for="zt_id" class="form-label">ZeroTier Network ID</label>
|
||||||
<div class="input-group has-validation">
|
<div class="input-group has-validation">
|
||||||
<span class="input-group-text"><i class="bi bi-shield-lock-fill"></i></span>
|
<span class="input-group-text"><i class="bi bi-shield-lock-fill"></i></span>
|
||||||
<input type="text" class="form-control @error('ztid') is-invalid @enderror" id="ztid" placeholder="ZeroTier" name="ztid" value="{{ old('ztid',$o->ztid) }}" @cannot('admin',$o)disabled @endcannot>
|
<input type="text" class="form-control @error('zt_id') is-invalid @enderror" id="zt_id" placeholder="ZeroTier" name="zt_id" value="{{ old('zt_id',$o->zt_id) }}" @cannot('admin',$o)disabled @endcannot>
|
||||||
<span class="invalid-feedback" role="alert">
|
<span class="invalid-feedback" role="alert">
|
||||||
@error('ztid')
|
@error('zt_id')
|
||||||
{{ $message }}
|
{{ $message }}
|
||||||
@enderror
|
@enderror
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="col-4">
|
||||||
|
<label for="zt_ipv4" class="form-label">ZeroTier IPv4 Network</label>
|
||||||
|
<div class="input-group has-validation">
|
||||||
|
<span class="input-group-text"><i class="bi bi-share-fill"></i></span>
|
||||||
|
<input type="text" style="width: 55%;" class="form-control @error('zt_ipv4') is-invalid @enderror" id="zt_ipv4" placeholder="10.0.0.0" name="zt_ipv4" value="{{ old('zt_ipv4',$o->zt_ipv4) }}" @cannot('admin',$o)disabled @endcannot>
|
||||||
|
<span class="input-group-text">/</span>
|
||||||
|
<input type="text" class="form-control @error('zt_ipv4_mask') is-invalid @enderror" id="zt_ipv4_mask" placeholder="24" name="zt_ipv4_mask" value="{{ old('zt_ipv4_mask',$o->zt_ipv4_mask) }}" @cannot('admin',$o)disabled @endcannot>
|
||||||
|
<span class="invalid-feedback" role="alert">
|
||||||
|
@error('zt_ipv4')
|
||||||
|
{{ $message }}
|
||||||
|
@enderror
|
||||||
|
@error('zt_ipv4_mask')
|
||||||
|
{{ $message }}
|
||||||
|
@enderror
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-6">
|
||||||
|
<label for="zt_ipv6" class="form-label">ZeroTier IPv6 Network</label>
|
||||||
|
<div class="input-group has-validation">
|
||||||
|
<span class="input-group-text"><i class="bi bi-broadcast-pin"></i></span>
|
||||||
|
<input type="text" style="width: 65%;" class="form-control @error('zt_ipv6') is-invalid @enderror" id="zt_ipv6" placeholder="fd00:f1d0:0000:0000:0000:0000:0000:0000" name="zt_ipv6" value="{{ old('zt_ipv6',$o->zt_ipv6) }}" @cannot('admin',$o)disabled @endcannot>
|
||||||
|
<span class="input-group-text">/</span>
|
||||||
|
<input type="text" class="form-control @error('zt_ipv6_mask') is-invalid @enderror" id="zt_ipv6_mask" placeholder="112" name="zt_ipv6_mask" value="{{ old('zt_ipv6_mask',$o->zt_ipv6_mask) }}" @cannot('admin',$o)disabled @endcannot>
|
||||||
|
<span class="invalid-feedback" role="alert">
|
||||||
|
@error('zt_ipv6')
|
||||||
|
{{ $message }}
|
||||||
|
@enderror
|
||||||
|
@error('zt_ipv6_mask')
|
||||||
|
{{ $message }}
|
||||||
|
@enderror
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
Loading…
Reference in New Issue
Block a user