diff --git a/modules/Profiler/Http/Controllers/ProfilerController.php b/modules/Profiler/Http/Controllers/ProfilerController.php
index dbf84d07..8aca7beb 100644
--- a/modules/Profiler/Http/Controllers/ProfilerController.php
+++ b/modules/Profiler/Http/Controllers/ProfilerController.php
@@ -4,6 +4,7 @@ use App\Http\Controllers\Admin\Controller;
use Carbon\Carbon;
use Illuminate\Support\Facades\Input;
use Modules\Profiler\Entities\HttpLog;
+use Modules\Profiler\Entities\QueryLog;
class ProfilerController extends Controller
{
@@ -29,6 +30,7 @@ class ProfilerController extends Controller
if (Input::get('url')) {
$httpLog = $httpLog->where('url', Input::get('url'))
+ ->orderBy('created_at', 'DESC')
->with('queries');
} else {
$displayGrouped = true;
@@ -42,4 +44,24 @@ class ProfilerController extends Controller
$filter = Input::all();
return view('profiler::index', compact('httpLog', 'displayGrouped', 'filter', 'pastDays'));
}
+
+ public function destroy()
+ {
+ $older = Input::get('olderThan');
+
+ if (is_null($older)) {
+ \DB::statement("SET foreign_key_checks=0");
+ QueryLog::truncate();
+ HttpLog::truncate();
+ \DB::statement("SET foreign_key_checks=1");
+ } else {
+ HttpLog::where('created_at', '<=', Carbon::now()
+ ->subDays($older))
+ ->delete();
+ }
+
+ return redirect()
+ ->back()
+ ->with('success', trans('profiler::module.succesfullyDeleted'));
+ }
}
\ No newline at end of file
diff --git a/modules/Profiler/Http/Controllers/RequestController.php b/modules/Profiler/Http/Controllers/RequestController.php
index 25a640d9..56c734d5 100644
--- a/modules/Profiler/Http/Controllers/RequestController.php
+++ b/modules/Profiler/Http/Controllers/RequestController.php
@@ -1,7 +1,10 @@
url)
- ->where('method', $httpLog->method)
- ->get();
+ ->where('method', $httpLog->method);
+
+ $pastDays = Input::get('pastDays', session('profilerPastDays', 0));
+ if (is_numeric($pastDays) && $pastDays >= 0) {
+ $sameRequests = $sameRequests->where('created_at', '>=', Carbon::today()
+ ->subDays($pastDays));
+ }
+
+ session(['profilerPastDays' => $pastDays]);
+
+ $sameRequests = $sameRequests->get();
$times = [
'avg' => $sameRequests->avg('time'),
@@ -18,6 +30,8 @@ class RequestController extends Controller
'max' => $sameRequests->max('time')
];
- return view('profiler::request.detail', compact('httpLog', 'sameRequests', 'times'));
+ $filter = Input::all();
+
+ return view('profiler::request.detail', compact('httpLog', 'sameRequests', 'times', 'pastDays', 'filter'));
}
}
\ No newline at end of file
diff --git a/modules/Profiler/Http/routes.php b/modules/Profiler/Http/routes.php
index 78ae793c..b64505b3 100644
--- a/modules/Profiler/Http/routes.php
+++ b/modules/Profiler/Http/routes.php
@@ -16,5 +16,8 @@ Route::group([
Route::get('{httpLog}/queries', 'QueryController@index')
->name('queries.index');
+
+ Route::get('delete/all', 'ProfilerController@destroy')
+ ->name('profiler.deleteAll');
});
});
\ No newline at end of file
diff --git a/modules/Profiler/Resources/lang/cs/module.php b/modules/Profiler/Resources/lang/cs/module.php
index 2fae13b0..c3b34536 100644
--- a/modules/Profiler/Resources/lang/cs/module.php
+++ b/modules/Profiler/Resources/lang/cs/module.php
@@ -1,7 +1,7 @@
'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.',
];
\ No newline at end of file
diff --git a/modules/Profiler/Resources/views/_partials/groupedRequestList.blade.php b/modules/Profiler/Resources/views/_partials/groupedRequestList.blade.php
index 782000f5..90cadf31 100644
--- a/modules/Profiler/Resources/views/_partials/groupedRequestList.blade.php
+++ b/modules/Profiler/Resources/views/_partials/groupedRequestList.blade.php
@@ -1,27 +1,31 @@
-
-
-
- | @lang('profiler::module.index.calledTotal') |
- @lang('profiler::module.index.httpMethod') |
- @lang('profiler::module.index.url') |
- @lang('profiler::module.index.timeAvg') |
- |
-
-
-
- @foreach($requests as $request)
+@if(count($requests) > 0)
+
+
- | {{$request->total}} |
- {{$request->method}} |
- {{$request->url}} |
- {{number_format($request->time_avg, 2)}} ms |
-
-
-
-
- |
+ @lang('profiler::module.index.calledTotal') |
+ @lang('profiler::module.index.httpMethod') |
+ @lang('profiler::module.index.url') |
+ @lang('profiler::module.index.timeAvg') |
+ |
- @endforeach
-
-
\ No newline at end of file
+
+
+ @foreach($requests as $request)
+
+ | {{$request->total}} |
+ {{$request->method}} |
+ {{$request->url}} |
+ {{number_format($request->time_avg, 2)}} ms |
+
+
+
+
+ |
+
+ @endforeach
+
+
+@else
+ @lang('admin/common.empty')
+@endif
\ No newline at end of file
diff --git a/modules/Profiler/Resources/views/_partials/requestList.blade.php b/modules/Profiler/Resources/views/_partials/requestList.blade.php
index e81d86fe..f578b00d 100644
--- a/modules/Profiler/Resources/views/_partials/requestList.blade.php
+++ b/modules/Profiler/Resources/views/_partials/requestList.blade.php
@@ -1,55 +1,60 @@
-
-
-
- | @lang('profiler::module.index.createdAt') |
- @lang('profiler::module.index.httpMethod') |
- @lang('profiler::module.index.url') |
- @lang('profiler::module.index.time') |
- @lang('profiler::module.index.systemLoad') |
- |
-
-
-
-
-
- @foreach($requests as $request)
+@if(count($requests) > 0)
+
+
- | {{$request->created_at->format('d.m.Y G:i')}} |
- {{$request->method}} |
- {{$request->url}} |
- {{number_format($request->time, 3)}} ms |
- {{$request->load_1}}, {{$request->load_5}}, {{$request->load_15}} |
-
+ | @lang('profiler::module.index.createdAt') |
+ @lang('profiler::module.index.httpMethod') |
+ @lang('profiler::module.index.url') |
+ @lang('profiler::module.index.time') |
+ @lang('profiler::module.index.systemLoad') |
+ |
+
+
+
-
-
\ No newline at end of file
+
+
+ @endforeach
+
+
+
+@else
+ @lang('admin/common.empty')
+@endif
\ No newline at end of file
diff --git a/modules/Profiler/Resources/views/request/detail.blade.php b/modules/Profiler/Resources/views/request/detail.blade.php
index 17ff6ace..850194bf 100644
--- a/modules/Profiler/Resources/views/request/detail.blade.php
+++ b/modules/Profiler/Resources/views/request/detail.blade.php
@@ -3,7 +3,16 @@
@section('pageHeading', trans('profiler::module.requestDetail'))
@section('headerButtons')
-
+
+
+
@endsection
diff --git a/modules/Profiler/Resources/views/settings/profiler.blade.php b/modules/Profiler/Resources/views/settings/profiler.blade.php
index c3e2bdeb..8cf845e5 100644
--- a/modules/Profiler/Resources/views/settings/profiler.blade.php
+++ b/modules/Profiler/Resources/views/settings/profiler.blade.php
@@ -48,6 +48,16 @@
+
+
diff --git a/resources/lang/cs/admin/common.php b/resources/lang/cs/admin/common.php
index f2a6a17f..6f0180de 100644
--- a/resources/lang/cs/admin/common.php
+++ b/resources/lang/cs/admin/common.php
@@ -7,4 +7,5 @@ return [
"logoutSuccessfull" => "Odhlášení proběhlo úspěšně",
"no" => "Ne",
"yes" => "Ano",
+ 'empty' => 'Žádná data nebyla nalezena.'
];