DB query performance fixes

This commit is contained in:
Deon George
2021-06-25 23:38:57 +10:00
parent 64215ebcea
commit 17a44a0945
8 changed files with 29 additions and 943 deletions

View File

@@ -41,7 +41,7 @@
<td colspan="5"><a href="{{ url('ftn/domain/addedit') }}">Add New Domain</a></td>
</tr>
@endcan
@foreach (\App\Models\Domain::orderBy('name')->cursor() as $oo)
@foreach (\App\Models\Domain::orderBy('name')->with(['zones'])->get() as $oo)
<tr>
<td><a href="{{ url('ftn/domain/addedit',[$oo->id]) }}">{{ $oo->id }}</a></td>
<td>{{ $oo->name }}</td>

View File

@@ -101,16 +101,18 @@
</tr>
<!-- If this node is a hub -->
@foreach ($oz->addresses()->active()->FTNorder()->where('hub_id',$ao->id)->with(['system','zone.domain'])->get() as $aoo)
<tr>
<td>{{ $aoo->system->full_name($aoo) }}</td>
<td>{{ $aoo->system->sysop }}</td>
<td>{{ $ao->system->location }}</td>
<td>{{ $aoo->role }}</td>
<td>{{ $aoo->ftn }}</td>
<td>-</td>
</tr>
@endforeach
@if ($ao->role == 'Hub')
@foreach ($oz->addresses()->active()->FTNorder()->where('hub_id',$ao->id)->with(['system','zone.domain'])->get() as $aoo)
<tr>
<td>{{ $aoo->system->full_name($aoo) }}</td>
<td>{{ $aoo->system->sysop }}</td>
<td>{{ $ao->system->location }}</td>
<td>{{ $aoo->role }}</td>
<td>{{ $aoo->ftn }}</td>
<td>-</td>
</tr>
@endforeach
@endif
@endforeach
@endforeach
</tbody>

View File

@@ -525,7 +525,7 @@
$.get('{{ url('api/regions') }}'+'/'+this.value,function(data) {
$('#region_id').append('<option value=""></option>');
$('#region_id').append('<option value="no">No Region</option>');
$('#region_id').append('<option value="0">No Region</option>');
$('#region_id').append('<option value="new">New Region</option>');
data.forEach(function(item) {
@@ -584,7 +584,7 @@
$('#action').val('region');
break;
case 'no':
case '0':
default:
// Find Hosts
if ($('#host-select').hasClass('d-none'))
@@ -610,10 +610,10 @@
$('#host_id').children().remove();
var that = this;
$.get('{{ url('api/hosts') }}'+'/'+$('#zone_id').val()+'/'+((this.value === 'no') ? 0 : this.value),function(data) {
$.get('{{ url('api/hosts') }}'+'/'+$('#zone_id').val()+'/'+this.value,function(data) {
$('#host_id').append('<option value=""></option>');
if (that.value !== 'no')
$('#host_id').append('<option value="no">No Host</option>');
if (that.value !== '0')
$('#host_id').append('<option value="0">No Host</option>');
$('#host_id').append('<option value="new">New Host</option>');
data.forEach(function(item) {
@@ -661,7 +661,7 @@
$('#action').val('host');
break;
case 'no':
case '0':
default:
if (! $('#host-address').hasClass('d-none'))
$('#host-address').addClass('d-none');
@@ -679,8 +679,8 @@
$('#hub_id').prop('disabled',true);
$('#hub_id').children().remove();
$.get('{{ url('api/hubs') }}'+'/'+$('#zone_id').val()+'/'+((this.value === 'no') ? 0 : this.value),function(data) {
$('#hub_id').append('<option value="no">No Hub</option>');
$.get('{{ url('api/hubs') }}'+'/'+$('#zone_id').val()+'/'+this.value,function(data) {
$('#hub_id').append('<option value="">No Hub</option>');
data.forEach(function(item) {
$('#hub_id').append('<option value="'+item.id+'">'+item.id+':'+item.value+'</option>');
@@ -698,7 +698,7 @@
$('#hub_id').on('change',function() {
switch(this.value) {
case 'no':
case '':
if ($('#hub-checkbox').hasClass('d-none'))
$('#hub-checkbox').removeClass('d-none');
break;

View File

@@ -40,7 +40,7 @@
</thead>
<tbody>
@foreach (\App\Models\System::active()->orderBy('name')->cursor() as $oo)
@foreach (\App\Models\System::active()->orderBy('name')->with(['addresses.zone.domain'])->get() as $oo)
<tr>
<td><a href="{{ url('ftn/system/addedit',[$oo->id]) }}">{{ $oo->id }}</a></td>
<td>{{ $oo->name }}</td>

View File

@@ -38,7 +38,7 @@
</thead>
<tbody>
@foreach (\App\Models\Zone::with(['domain'])->cursor() as $oo)
@foreach (\App\Models\Zone::with(['domain'])->get() as $oo)
<tr>
<td>{{ $oo->domain->name }}</td>
<td><a href="{{ url('ftn/zone/addedit',[$oo->id]) }}">{{ $oo->zone_id }}</a></td>