Optimise queries for rendering the about page
All checks were successful
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 33s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 1m38s
Create Docker Image / Final Docker Image Manifest (push) Successful in 10s

This commit is contained in:
2024-04-13 22:41:58 +10:00
parent 2edc41b11e
commit d6e23b9a90
7 changed files with 56 additions and 10 deletions

View File

@@ -125,7 +125,7 @@
@js('highcharts')
<script>
Highcharts.chart('network_traffic', {
var chart = Highcharts.chart('network_traffic', {
chart: {
type: 'spline',
zoomType: 'x',
@@ -176,16 +176,30 @@
@foreach (\App\Models\Domain::active()
->when(((! $user) || (! $user->isAdmin())),function($query) { return $query->public()->active(); })
->orderBy('name')
->with(['echoareas'])->get() as $o)
->with(['echoareas'])
->get() as $o)
@if ($o->managed())
{
name: '{{ $o->name }}',
data: {!! $o->daily_area_stats() !!},
data: [],
dashStyle: 'ShortDot',
},
@endif
@endforeach
],
});
chart.series.forEach(function(item) {
$.ajax({
url: '/api/domain/daily',
type: 'GET',
dataType: 'json',
data : {name: item.name},
success: function(data) {
item.setData(data);
},
cache: false
});
});
</script>
@append

View File

@@ -14,8 +14,9 @@
<dt>Explore Networks</dt>
@foreach (\App\Models\Domain::select(['id','name'])
->when(((! $user) || (! $user->isAdmin())),function($query) { return $query->public()->active(); })
->orderBy('name')->get() as $o)
@if ($o->managed())
->orderBy('name')
->get() as $o)
@if ($o->isManaged())
<dd><a href="{{ url('domain/view',['id'=>$o->id]) }}">{{ $o->name }}</a></dd>
@endif
@endforeach