Query optimisations for last_messages and traffic

This commit is contained in:
Deon George
2022-01-06 00:19:57 +11:00
parent 3d6f233c1d
commit 6b0bf32552
8 changed files with 104 additions and 130 deletions

View File

@@ -8,7 +8,7 @@
<p>Welcome to the FTN Clearing House.</p>
<div style="float:right; width: 50%; height: 20em;" id="network_traffic"></div>
<div class="float-end" id="network_traffic"></div>
<p>The FTN Clearing House (FCH) is both a FTN Mailer and FTN message tosser, where mail is stored internally in a DB. FCH can also hatch and toss files into FTN networks for both up/downstream nodes.</p>
<p>It was created as an idea to bring modern technology and capabilities to a legacy computing network that existed in the 1970's, 1980's and 1990's (before the Internet basically).</p>
@@ -130,7 +130,7 @@ If you have more than 1 BBS, then the Clearing House can receive all your mail f
}
},
series: [
@foreach (\App\Models\Domain::active()->public()->with(['echoareas'])->get() as $o)
@foreach (\App\Models\Domain::active()->public()->orderBy('name')->with(['echoareas'])->get() as $o)
{
name: '{{ $o->name }}',
data: {!! $o->daily_area_stats() !!},

View File

@@ -161,12 +161,11 @@
name: 'Networks',
colorByPoint: true,
data: [
@foreach(($xx=$user->systems->pluck('addresses')->flatten()->pluck('zone.domain')->sortBy('name')) as $oo)
@php($x = $oo->stats())
@foreach(($xx=$user->systems->pluck('addresses')->flatten()->pluck('zone.domain')->unique(function($item) { return $item->name; })->sortBy('name')) as $do)
{
name: '{{ $oo->name }}',
y: {{ $x->sum('count') }},
drilldown: 'n-{{ $oo->name }}',
name: '{{ $do->name }}',
y: {{ $do->daily_area_stats()->sum('y') }},
drilldown: 'n-{{ $do->name }}',
},
@endforeach
]
@@ -176,12 +175,11 @@
colorByPoint: true,
pointPlacement: 0.1,
data: [
@foreach($xx as $oo)
@php($x = $oo->stats($o))
@foreach($xx as $do)
{
name: '{{ $oo->name }}',
y: {{ $x->sum('count') }},
drilldown: 'ny-{{ $oo->name }}',
name: '{{ $do->name }}',
y: {{ $do->daily_area_stats(FALSE,$user->systems)->sum('y') }},
drilldown: 'ny-{{ $do->name }}',
color: Highcharts.color(Highcharts.getOptions().colors[{{$loop->index}}]).brighten(-0.2).get()
},
@endforeach
@@ -196,21 +194,19 @@
}
},
series: [
@foreach($xx as $oo)
@php($x = $oo->stats())
@foreach($xx as $do)
{
name: '{{ $oo->name }}',
id: 'n-{{ $oo->name }}',
data: {!! $x->sortBy('name')->map(function($item) use ($oo) { return ['name'=>$item->name,'y'=>$item->count,'drilldown'=>'e-'.$item->name]; })->values() !!}
name: '{{ $do->name }}',
id: 'n-{{ $do->name }}',
data: {!! $do->daily_area_stats(TRUE)->sortBy('name')->map(function($item) { return ['name'=>$item['name'],'y'=>$item['data']->sum('y'),'drilldown'=>'e-'.$item['name']]; })->values() !!}
},
@endforeach
@foreach($xx as $oo)
@php($x = $oo->stats($o))
@foreach($xx as $do)
{
name: '{{ $oo->name }}',
id: 'ny-{{ $oo->name }}',
data: {!! $x->sortBy('name')->map(function($item) { return ['name'=>$item->name,'y'=>$item->count,'drilldown'=>'ey-'.$item->name]; })->values() !!}
name: '{{ $do->name }}',
id: 'ny-{{ $do->name }}',
data: {!! $do->daily_area_stats(TRUE,$user->systems)->sortBy('name')->map(function($item) { return ['name'=>$item['name'],'y'=>$item['data']->sum('y'),'drilldown'=>'ey-'.$item['name']]; })->values() !!}
},
@endforeach
]

View File

@@ -15,7 +15,7 @@
<div id="collapse_about" class="accordion-collapse collapse show" aria-labelledby="about" data-bs-parent="#accordion_homepage">
<div class="accordion-body">
<div style="float:right; width: 50%; height: 20em;" id="network_traffic"></div>
<div class="float-end" style="max-height: 25em;" id="network_traffic"></div>
{!! \Illuminate\Mail\Markdown::parse($o->homepage) !!}
</div>
</div>
@@ -46,7 +46,7 @@
</thead>
<tbody>
@foreach ($o->echoareas->sortBy('name') as $oo)
@foreach ($o->latest_echomail_message() as $oo)
<tr>
<td style="width: 15%;"><a href="{{ url('ftn/echoarea/addedit',[$oo->id]) }}">{{ $oo->name }}</a></td>
<td>{{ $oo->description }}</td>
@@ -166,7 +166,7 @@
@css('datatables')
<style>
div#collapse_about {
min-height: 20em;
min-height: 25em;
}
div#collapse_about .collapse{
min-height: 0;
@@ -235,7 +235,8 @@
zoomType: 'x',
resetZoomButton: {
position: {
x: 0,
align: 'left',
x: -40,
y: -40,
}
}
@@ -263,7 +264,7 @@
legend: {
align: 'right',
layout: 'vertical',
symbolWidth: 40,
symbolWidth: 20,
floating: false,
navigation: {
arrowSize: 10
@@ -281,15 +282,7 @@
cursor: 'pointer'
}
},
series: [
@foreach($o->echoareas->sortBy('name') as $oo)
{
name: '{{ $oo->name }}',
data: {!! $o->daily_echoarea_stats($oo) !!},
dashStyle: 'ShortDot',
},
@endforeach
],
series: {!! $o->daily_area_stats('true') !!}
});
</script>
@append