Optimise queries for rendering the about page
This commit is contained in:
@@ -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
|
@@ -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
|
||||
|
Reference in New Issue
Block a user