Performance enhancements for system view
This commit is contained in:
parent
c5500020ae
commit
23e8522e1a
@ -638,7 +638,7 @@ class SystemController extends Controller
|
|||||||
|
|
||||||
public function view(System $o)
|
public function view(System $o)
|
||||||
{
|
{
|
||||||
$o->load(['addresses.echomails.echoarea']);
|
$o->load(['addresses']);
|
||||||
|
|
||||||
return view('system.view')
|
return view('system.view')
|
||||||
->with('o',$o);
|
->with('o',$o);
|
||||||
|
@ -44,6 +44,13 @@ class System extends Model
|
|||||||
return $this->hasMany(SystemLog::class);
|
return $this->hasMany(SystemLog::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function logs_recent()
|
||||||
|
{
|
||||||
|
return $this->hasMany(SystemLog::class)
|
||||||
|
->orderby('created_at','DESC')
|
||||||
|
->limit(10);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Session Passwords for system
|
* Session Passwords for system
|
||||||
*
|
*
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
@endif
|
@endif
|
||||||
<tr>
|
<tr>
|
||||||
<th>Last Seen</th>
|
<th>Last Seen</th>
|
||||||
<td>{{ $o->logs->count() ? $o->logs->last()->created_at : '-' }}</td>
|
<td>{{ $o->logs_recent->count() ? $o->logs_recent->last()->created_at : '-' }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
@if($o->addresses->count())
|
@if($o->addresses->count())
|
||||||
<tr>
|
<tr>
|
||||||
@ -72,29 +72,31 @@
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Domain</th>
|
<th>Domain</th>
|
||||||
<th>Echoarea</th>
|
|
||||||
<th class="text-end">#</th>
|
<th class="text-end">#</th>
|
||||||
<th class="text-end">Last</th>
|
<th class="text-end">Last</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach($o->addresses->sortBy('zone.domain.name')->groupBy('zone.domain.name') as $net => $children)
|
@foreach($o->addresses->sortBy('zone.domain.name')->groupBy('zone.domain_id') as $did => $domain_addresses)
|
||||||
@if($children->pluck('echomails')->flatten()->count())
|
@foreach(\App\Models\Echoarea::select([DB::raw('count(echomails.*) as count'),DB::raw('max(echomails.datetime) as most_recent')])
|
||||||
@foreach($children->pluck('echomails')->flatten()->sortBy('echoarea.name')->groupBy('echoarea.name') as $name => $echomails)
|
->join('echomails',['echomails.echoarea_id'=>'echoareas.id'])
|
||||||
<tr>
|
->join('echomail_seenby',function($join) use ($domain_addresses) {
|
||||||
<td><a href="{{ url('network',[$children->first()->zone->domain_id]) }}">{{ $net }}</a></td>
|
return $join->on('echomail_seenby.echomail_id','echomails.id')
|
||||||
<td><a href="{{ url('echoarea/view',[$x=$echomails->first()->echoarea_id]) }}">{{ $name }}</a></td>
|
->whereIn('echomail_seenby.address_id',$domain_addresses->pluck('id'));
|
||||||
<td class="text-end">{{ ($y=$children->pluck('echomail_from')->flatten()->where('echoarea_id',$x))->count() }}</td>
|
})
|
||||||
<td class="text-end">{{ $y->max('datetime') }}</td>
|
->get() as $o)
|
||||||
</tr>
|
|
||||||
@endforeach
|
|
||||||
@else
|
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="{{ url('network',[$children->first()->zone->domain_id]) }}">{{ $net }}</a></td>
|
<td><a href="{{ url('network',[$did]) }}">{{ $domain_addresses->first()->zone->domain->name }}</a></td>
|
||||||
<td colspan="3">No Echoarea Activity</td>
|
|
||||||
|
@if($o->count)
|
||||||
|
<td class="text-end">{{ $o->count }}</td>
|
||||||
|
<td class="text-end">{{ $o->most_recent }}</td>
|
||||||
|
@else
|
||||||
|
<td class="text-end" colspan="2">No Echoarea Activity</td>
|
||||||
|
@endif
|
||||||
</tr>
|
</tr>
|
||||||
@endif
|
@endforeach
|
||||||
@endforeach
|
@endforeach
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
Loading…
Reference in New Issue
Block a user