FEATURE #2389 @20m: add deleting all data from profiler

This commit is contained in:
Michal Kváček
2017-03-28 01:01:21 +02:00
parent aa55ffe46a
commit 7d6a3737e3
9 changed files with 156 additions and 85 deletions
+14 -11
View File
@@ -1,7 +1,7 @@
<?php
return [
'name' => 'Profiler',
'index' => [
'name' => 'Profiler',
'index' => [
'createdAt' => 'Datum',
'httpMethod' => 'HTTP metoda',
'url' => 'URL',
@@ -11,31 +11,34 @@ return [
'timeMax' => 'Maximální čas',
'systemLoad' => 'Load serveru',
'calledTotal' => 'Volání',
'pastDays' => [
'today' => 'Dnes',
'pastDays' => [
'today' => 'Dnes',
'overall' => 'Vše',
'days' => '1 den|:count dny|:count dní'
'days' => '1 den|:count dny|:count dní'
]
],
'settings' => [
'settings' => [
'useProfilerInVisitorArea' => 'Zapnout měření ve veřejné části?',
'useProfilerInAdmin' => 'Zapnout měření v administraci?'
],
'request' => [
'request' => [
'info' => 'Detaily requestu',
'sql' => 'SQL dotazy',
'detail' => 'Detail požadavku',
'sameRequests' => 'Ostatní volání'
],
'graphs' => [
'graphs' => [
'responseTime' => 'Doba odezvy'
],
'queries' => [
'queries' => [
'sql' => 'SQL dotaz',
'time' => 'Čas dotazu'
],
'listDescription' => 'Seznam HTTP požadavků na tuto aplikaci.',
'listDescription' => 'Seznam HTTP požadavků na tuto aplikaci.',
'groupedListDescription' => 'Seznam HTTP požadavků na tuto aplikaci.',
'requestDetail' => 'Detail HTTP požadavku'
'requestDetail' => 'Detail HTTP požadavku',
'deleteAllData' => 'Smazat všechna data',
'deleteOld' => 'Smazat data starší než 30 dní',
'succesfullyDeleted' => 'Úspěšně vymazána data z profileru.',
];
@@ -1,27 +1,31 @@
<table class="item-list content-overview full-width table striped">
<thead>
<tr>
<td>@lang('profiler::module.index.calledTotal')</td>
<td>@lang('profiler::module.index.httpMethod')</td>
<td>@lang('profiler::module.index.url')</td>
<td>@lang('profiler::module.index.timeAvg')</td>
<td></td>
</tr>
</thead>
<tbody>
@foreach($requests as $request)
@if(count($requests) > 0)
<table class="item-list content-overview full-width table striped">
<thead>
<tr>
<td>{{$request->total}}</td>
<td><a href="{{route('profiler.index', ['method' => $request->method])}}">{{$request->method}}</a></td>
<td><a href="{{route('profiler.index', ['url' => $request->url])}}">{{$request->url}}</a></td>
<td>{{number_format($request->time_avg, 2)}} ms</td>
<td>
<a href="{{route('request.detail', ['httpLog' => $request])}}" data-toggle="tooltip"
title="@lang('profiler::module.request.info')">
<i class="fa fa-info"></i>
</a>
</td>
<td>@lang('profiler::module.index.calledTotal')</td>
<td>@lang('profiler::module.index.httpMethod')</td>
<td>@lang('profiler::module.index.url')</td>
<td>@lang('profiler::module.index.timeAvg')</td>
<td></td>
</tr>
@endforeach
</tbody>
</table>
</thead>
<tbody>
@foreach($requests as $request)
<tr>
<td>{{$request->total}}</td>
<td><a href="{{route('profiler.index', ['method' => $request->method])}}">{{$request->method}}</a></td>
<td><a href="{{route('profiler.index', ['url' => $request->url])}}">{{$request->url}}</a></td>
<td>{{number_format($request->time_avg, 2)}} ms</td>
<td>
<a href="{{route('request.detail', ['httpLog' => $request])}}" data-toggle="tooltip"
title="@lang('profiler::module.request.info')">
<i class="fa fa-info"></i>
</a>
</td>
</tr>
@endforeach
</tbody>
</table>
@else
@lang('admin/common.empty')
@endif
@@ -1,55 +1,60 @@
<table class="item-list content-overview full-width table striped">
<thead>
<tr>
<td>@lang('profiler::module.index.createdAt')</td>
<td>@lang('profiler::module.index.httpMethod')</td>
<td>@lang('profiler::module.index.url')</td>
<td>@lang('profiler::module.index.time')</td>
<td>@lang('profiler::module.index.systemLoad')</td>
<td></td>
</tr>
</thead>
<tbody>
@foreach($requests as $request)
@if(count($requests) > 0)
<table class="item-list content-overview full-width table striped">
<thead>
<tr>
<td>{{$request->created_at->format('d.m.Y G:i')}}</td>
<td><a href="{{route('profiler.index', ['method' => $request->method])}}">{{$request->method}}</a></td>
<td><a href="{{route('profiler.index', ['url' => $request->url])}}">{{$request->url}}</a></td>
<td>{{number_format($request->time, 3)}} ms</td>
<td>{{$request->load_1}}, {{$request->load_5}}, {{$request->load_15}}</td>
<td>
<td>@lang('profiler::module.index.createdAt')</td>
<td>@lang('profiler::module.index.httpMethod')</td>
<td>@lang('profiler::module.index.url')</td>
<td>@lang('profiler::module.index.time')</td>
<td>@lang('profiler::module.index.systemLoad')</td>
<td></td>
</tr>
</thead>
<tbody>
<div class="item-actions-dropdown">
<a class="item-actions-toggle-btn">
@foreach($requests as $request)
<tr>
<td>{{$request->created_at->format('d.m.Y G:i')}}</td>
<td><a href="{{route('profiler.index', ['method' => $request->method])}}">{{$request->method}}</a></td>
<td><a href="{{route('profiler.index', ['url' => $request->url])}}">{{$request->url}}</a></td>
<td>{{number_format($request->time, 3)}} ms</td>
<td>{{$request->load_1}}, {{$request->load_5}}, {{$request->load_15}}</td>
<td>
<div class="item-actions-dropdown">
<a class="item-actions-toggle-btn">
<span class="inactive">
<i class="fa fa-cog"></i>
</span>
<span class="active">
<span class="active">
<i class="fa fa-chevron-circle-right"></i>
</span>
</a>
<div class="item-actions-block">
<ul class="item-actions-list">
<li>
<a href="{{route('request.detail', ['httpLog' => $request])}}" data-toggle="tooltip"
title="@lang('profiler::module.request.info')">
<i class="fa fa-info"></i>
</a>
</li>
<li>
<a href="{{route('queries.index', ['httpLog' => $request])}}" data-toggle="tooltip"
title="@lang('profiler::module.request.sql')">
<i class="fa fa-database"></i></a>
</li>
</ul>
</a>
<div class="item-actions-block">
<ul class="item-actions-list">
<li>
<a href="{{route('request.detail', ['httpLog' => $request])}}" data-toggle="tooltip"
title="@lang('profiler::module.request.info')">
<i class="fa fa-info"></i>
</a>
</li>
<li>
<a href="{{route('queries.index', ['httpLog' => $request])}}" data-toggle="tooltip"
title="@lang('profiler::module.request.sql')">
<i class="fa fa-database"></i></a>
</li>
</ul>
</div>
</div>
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
</td>
</tr>
@endforeach
</tbody>
</table>
@else
@lang('admin/common.empty')
@endif
@@ -3,7 +3,16 @@
@section('pageHeading', trans('profiler::module.requestDetail'))
@section('headerButtons')
<a class="btn btn-sm rounded btn-primary" href="{{route('profiler.index')}}"><i class="fa fa-list"></i></a>
<a class="btn btn-sm rounded btn-primary" href="{{route('profiler.index')}}"><i class="fa fa-list"></i></a>
<div class="pull-right">
@foreach(['0' => 'today', '7' => 'days', '30' => 'days', 'inf' => 'overall'] as $pastDay => $name)
@php $filter['httpLog'] = $httpLog ;$filter['pastDays'] = $pastDay; @endphp
<a class="btn btn-sm rounded @if($pastDays === (string)$pastDay) btn-primary @else btn-secondary @endif"
href="{{route('request.detail', $filter)}}">{{trans_choice('profiler::module.index.pastDays.'.$name, $pastDay)}}</a>
@endforeach
</div>
@endsection
@@ -48,6 +48,16 @@
</div>
</div>
<div class="row text-center">
<a href="{{route('profiler.deleteAll')}}" class="btn btn-danger remove confirm">
<i class="fa fa-trash-o"></i> @lang('profiler::module.deleteAllData')
</a>
<a href="{{route('profiler.deleteAll', ['olderThan' => 30])}}" class="btn btn-danger remove confirm">
<i class="fa fa-trash-o"></i> @lang('profiler::module.deleteOld')
</a>
</div>