Implemented echoarea/filearea security

This commit is contained in:
2023-07-29 13:17:36 +10:00
parent f1ccca25ea
commit cd140971e2
22 changed files with 548 additions and 58 deletions

View File

@@ -5,7 +5,7 @@
<div class="row pt-0">
<div class="col-12">
<div class="greyframe titledbox shadow0xb0">
<h2 class="cap">Assign New address</h2>
<h2 class="cap">Assign New/Update Existing Address</h2>
<div class="row">
<!-- Select Zone -->
@@ -83,7 +83,7 @@
<label for="node_id" class="form-label">Node/Point Address</label>
<div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-hash"></i></span>
<input type="text" style="width: 35%;" class="form-control @error('node_id') is-invalid @enderror" id="node_id" placeholder="Node" name="node_id" value="{{ old('node_id',$o->node_id) }}" @cannot('admin',$o)disabled @endcannot>
<input type="text" style="width: 35%;" class="form-control text-end @error('node_id') is-invalid @enderror" id="node_id" placeholder="Node" name="node_id" value="{{ old('node_id',$o->node_id) }}" @cannot('admin',$o)disabled @endcannot>
<span class="input-group-text p-0">.</span>
<input type="text" class="form-control @error('point_id') is-invalid @enderror" id="point_id" placeholder="0" name="point_id" value="{{ old('point_id',$o->point_id) ?: 0 }}" @cannot('admin',$o)disabled @endcannot style="padding-left: 0;">
<span class="invalid-feedback" role="alert">
@@ -119,7 +119,7 @@
<label for="host_id_new" class="form-label">Host Address</label>
<div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-hash"></i></span>
<input type="text" class="form-control @error('host_id_new') is-invalid @enderror" id="host_id_new" placeholder="Host #" name="host_id_new" value="{{ old('host_id_new') }}" @cannot('admin',$o)disabled @endcannot>
<input type="text" class="form-control text-end @error('host_id_new') is-invalid @enderror" id="host_id_new" placeholder="Host #" name="host_id_new" value="{{ old('host_id_new') }}" @cannot('admin',$o)disabled @endcannot>
<span class="input-group-text p-0">/</span>
<input type="text" class="form-control @error('node_id_new') is-invalid @enderror" id="node_id_new" placeholder="Node #" name="node_id_new" value="{{ old('node_id_new') }}" @cannot('admin',$o)disabled @endcannot>
<span class="input-group-text">.0</span>
@@ -151,6 +151,20 @@
</div>
</div>
</div>
<!-- Security -->
<div class="col-2 d-none" id="sec-level">
<label for="security" class="form-label">Security Level</label>
<div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-file-lock"></i></span>
<input type="text" class="form-control text-end @error('security') is-invalid @enderror" id="security" placeholder="#" name="security" value="{{ old('security') }}" @cannot('admin',$o)disabled @endcannot>
<span class="invalid-feedback" role="alert">
@error('security')
{{ $message }}
@enderror
</span>
</div>
</div>
</div>
<div class="row">
@@ -168,7 +182,7 @@
@can('admin',$o)
<div class="col-2">
<button type="submit" name="submit" class="btn btn-success float-end">Add</button>
<button type="submit" id="submit" name="submit" class="btn btn-success float-end">Add/Update</button>
</div>
@endcan
</div>
@@ -180,6 +194,9 @@
@section('page-scripts')
<script type="text/javascript">
$(document).ready(function() {
var modify;
var id;
/*
// Disable enter for form submission.
$('input').on('keydown', function(event) {
@@ -190,6 +207,21 @@
});
*/
$('.modaddress').on('click',function(event) {
id = $(this).attr('data-id');
event.stopPropagation();
modify = $.get('{{ url('address/get') }}'+'/'+id,function(data) {
console.log(data.security);
$('#zone_id').val(data.zone_id).change();
$('#node_id').val(data.node_id).change();
$('#point_id').val(data.point_id).change();
$('#security').val(data.security).change();
});
return false;
});
$('#zone_id').on('change',function() {
$(this).parent().find('i').addClass('spinner-grow spinner-grow-sm');
$('#region_id').prop('disabled',true);
@@ -224,6 +256,9 @@
$('#region_id').prop('disabled',false);
$('#region_id').show();
if (modify.responseJSON.region_id)
$('#region_id').val(modify.responseJSON.region_id).change();
});
$('#region-select').removeClass('d-none');
@@ -312,6 +347,9 @@
$('#host_id').prop('disabled',false);
$('#host_id').show();
if (modify.responseJSON.host_id)
$('#host_id').val(modify.responseJSON.host_id).change();
});
$('#host-select').removeClass('d-none');
@@ -378,11 +416,22 @@
$('#hub_id').prop('disabled',false);
$('#hub_id').show();
if (modify.responseJSON.hub_id)
$('#host_id').val(modify.responseJSON.hub_id).change();
});
$('#hub-select').removeClass('d-none');
$('#sec-level').removeClass('d-none');
$(this).parent().find('i').removeClass('spinner-grow spinner-grow-sm');
$('#action').val('node');
if (modify.responseJSON) {
$('#submit').val(id);
$('#action').val('update');
} else {
$('#action').val('node');
}
}
});