Add query cache, show per echo stats on network page
This commit is contained in:
parent
871430edf8
commit
be886d9e4b
@ -69,6 +69,21 @@ class Domain extends Model
|
||||
->values();
|
||||
}
|
||||
|
||||
public function daily_echoarea_stats(Echoarea $o): Collection
|
||||
{
|
||||
if (! $this->echoareas->count())
|
||||
return collect();
|
||||
|
||||
$where = ['echoarea_id'=>[$o->id]];
|
||||
|
||||
$echostats = Echomail::countGroupBy(['datetime',['datetime'=>'%Y-%m-%d']],$where);
|
||||
|
||||
return $echostats
|
||||
->sortBy(function($item) { return $item->id->datetime; })
|
||||
->map(function($item) { return ['x'=>Carbon::createFromFormat('Y-m-d',$item->id->datetime)->timestamp*1000,'y'=>$item->count]; })
|
||||
->values();
|
||||
}
|
||||
|
||||
public function stats(System $o=NULL): Collection
|
||||
{
|
||||
if (! $this->echoareas->count())
|
||||
|
@ -8,8 +8,8 @@
|
||||
"php": "^8.0",
|
||||
"ext-pcntl": "*",
|
||||
"ext-sockets": "*",
|
||||
"ext-zlib": "*",
|
||||
"ext-zip": "*",
|
||||
"ext-zlib": "*",
|
||||
"eduardokum/laravel-mail-auto-embed": "^1.0",
|
||||
"fideloper/proxy": "^4.4",
|
||||
"fruitcake/laravel-cors": "^2.0",
|
||||
@ -17,6 +17,7 @@
|
||||
"laravel/framework": "^8.0",
|
||||
"laravel/passport": "^10.1",
|
||||
"laravel/ui": "^3.2",
|
||||
"rennokki/laravel-eloquent-query-cache": "^3.1",
|
||||
"repat/laravel-job-models": "^0.5.1"
|
||||
},
|
||||
"require-dev": {
|
||||
|
1891
composer.lock
generated
1891
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -15,6 +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>
|
||||
{!! \Illuminate\Mail\Markdown::parse($o->homepage) !!}
|
||||
</div>
|
||||
</div>
|
||||
@ -163,9 +164,18 @@
|
||||
|
||||
@section('page-css')
|
||||
@css('datatables')
|
||||
<style>
|
||||
div#collapse_about {
|
||||
min-height: 20em;
|
||||
}
|
||||
div#collapse_about .collapse{
|
||||
min-height: 0;
|
||||
}
|
||||
</style>
|
||||
@append
|
||||
@section('page-scripts')
|
||||
@js('datatables')
|
||||
@js('highcharts')
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
@ -218,5 +228,62 @@
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Highcharts.chart('network_traffic', {
|
||||
chart: {
|
||||
type: 'spline',
|
||||
zoomType: 'x',
|
||||
resetZoomButton: {
|
||||
position: {
|
||||
x: 0,
|
||||
y: -40,
|
||||
}
|
||||
}
|
||||
},
|
||||
credits: {
|
||||
enabled: false
|
||||
},
|
||||
exporting: {
|
||||
buttons: false
|
||||
},
|
||||
title: {
|
||||
text: 'FTN Network Traffic for {{ $o->name }}'
|
||||
},
|
||||
xAxis: {
|
||||
type: 'datetime',
|
||||
title: {
|
||||
text: 'Time'
|
||||
},
|
||||
},
|
||||
yAxis: {
|
||||
title: {
|
||||
text: 'Echomail'
|
||||
},
|
||||
},
|
||||
legend: {
|
||||
symbolWidth: 40
|
||||
},
|
||||
plotOptions: {
|
||||
series: {
|
||||
point: {
|
||||
events: {
|
||||
click: function () {
|
||||
//window.location.href = this.series.options.website;
|
||||
}
|
||||
}
|
||||
},
|
||||
cursor: 'pointer'
|
||||
}
|
||||
},
|
||||
series: [
|
||||
@foreach($o->echoareas as $oo)
|
||||
{
|
||||
name: '{{ $oo->name }}',
|
||||
data: {!! $o->daily_echoarea_stats($oo) !!},
|
||||
dashStyle: 'ShortDot',
|
||||
},
|
||||
@endforeach
|
||||
],
|
||||
});
|
||||
</script>
|
||||
@append
|
Loading…
Reference in New Issue
Block a user