diff --git a/modules/Profiler/Http/Controllers/ProfilerController.php b/modules/Profiler/Http/Controllers/ProfilerController.php index 9aa23e83..dbf84d07 100644 --- a/modules/Profiler/Http/Controllers/ProfilerController.php +++ b/modules/Profiler/Http/Controllers/ProfilerController.php @@ -1,6 +1,7 @@ with('queries'); + $pastDays = Input::get('pastDays', session('profilerPastDays', 0)); + $httpLog = HttpLog::query(); + + if (is_numeric($pastDays) && $pastDays >= 0) { + $httpLog = $httpLog->where('created_at', '>=', Carbon::today() + ->subDays($pastDays)); + } + + session(['profilerPastDays' => $pastDays]); if (Input::get('method')) { $filters[] = 'method'; $httpLog = $httpLog->where('method', Input::get('method')); } + $displayGrouped = false; + if (Input::get('url')) { - $filters[] = 'url'; - $httpLog = $httpLog->where('url', Input::get('url')); + $httpLog = $httpLog->where('url', Input::get('url')) + ->with('queries'); + } else { + $displayGrouped = true; + $httpLog = $httpLog->groupBy('url', 'method') + ->select(\DB::raw('*'), \DB::raw('COUNT(url) as total'), \DB::raw('AVG(time) as time_avg')) + ->orderBy('total', 'DESC'); } $httpLog = $httpLog->paginate(25); - return view('profiler::index', compact('httpLog')); + $filter = Input::all(); + return view('profiler::index', compact('httpLog', 'displayGrouped', 'filter', 'pastDays')); } } \ 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 4abae6eb..2fae13b0 100644 --- a/modules/Profiler/Resources/lang/cs/module.php +++ b/modules/Profiler/Resources/lang/cs/module.php @@ -2,24 +2,40 @@ return [ 'name' => 'Profiler', 'index' => [ - 'createdAt' => 'Datum', - 'httpMethod' => 'HTTP metoda', - 'url' => 'URL', - 'time' => 'Čas', - 'systemLoad' => 'Load serveru' + 'createdAt' => 'Datum', + 'httpMethod' => 'HTTP metoda', + 'url' => 'URL', + 'time' => 'Čas', + 'timeAvg' => 'Průměrný čas', + 'timeMin' => 'Minimální čas', + 'timeMax' => 'Maximální čas', + 'systemLoad' => 'Load serveru', + 'calledTotal' => 'Volání', + 'pastDays' => [ + 'today' => 'Dnes', + 'overall' => 'Vše', + 'days' => '1 den|:count dny|:count dní' + ] ], 'settings' => [ 'useProfilerInVisitorArea' => 'Zapnout měření ve veřejné části?', 'useProfilerInAdmin' => 'Zapnout měření v administraci?' ], 'request' => [ - 'info' => 'Detaily requestu', - 'sql' => 'SQL dotazy', - 'detail' => 'Detail požadavku', + 'info' => 'Detaily requestu', + 'sql' => 'SQL dotazy', + 'detail' => 'Detail požadavku', 'sameRequests' => 'Ostatní volání' ], 'graphs' => [ 'responseTime' => 'Doba odezvy' - ] + ], + 'queries' => [ + 'sql' => 'SQL dotaz', + 'time' => 'Čas dotazu' + ], + 'listDescription' => 'Seznam HTTP požadavků na tuto aplikaci.', + 'groupedListDescription' => 'Seznam HTTP požadavků na tuto aplikaci.', + 'requestDetail' => 'Detail HTTP požadavku' ]; \ 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 new file mode 100644 index 00000000..782000f5 --- /dev/null +++ b/modules/Profiler/Resources/views/_partials/groupedRequestList.blade.php @@ -0,0 +1,27 @@ +
| @lang('profiler::module.index.calledTotal') | +@lang('profiler::module.index.httpMethod') | +@lang('profiler::module.index.url') | +@lang('profiler::module.index.timeAvg') | ++ |
| {{$request->total}} | +{{$request->method}} | +{{$request->url}} | +{{number_format($request->time_avg, 2)}} ms | ++ + + + | +