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
|
Reference in New Issue
Block a user