diff --git a/bower.json b/bower.json index 8a0fecdd..313afb2b 100644 --- a/bower.json +++ b/bower.json @@ -14,6 +14,7 @@ "tether": "~1.1.1", "tinycolor": "~1.2.1", "dropzone": "~4.2.0", - "jquery.are-you-sure": "~1.9" + "jquery.are-you-sure": "~1.9", + "chart.js": "^2.5.0" } } diff --git a/gulpfile.js b/gulpfile.js index e591f1d3..4832a5de 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -11,6 +11,7 @@ elixir (function (mix) { 'responsive-bootstrap-toolkit/dist/bootstrap-toolkit.js', 'metisMenu/dist/metisMenu.min.js', 'tinycolor/dist/tinycolor-min.js', + 'chart.js/dist/Chart.bundle.min.js', 'jquery.are-you-sure/jquery.are-you-sure.js', '../resources/assets/admin/js/app.js', ], 'public/js/vendor.js', 'bower_components'); diff --git a/modules/Profiler/Http/Controllers/ProfilerController.php b/modules/Profiler/Http/Controllers/ProfilerController.php index e03979e7..9aa23e83 100644 --- a/modules/Profiler/Http/Controllers/ProfilerController.php +++ b/modules/Profiler/Http/Controllers/ProfilerController.php @@ -1,15 +1,28 @@ with('queries') - ->paginate(25); + ->with('queries'); + + if (Input::get('method')) { + $filters[] = 'method'; + $httpLog = $httpLog->where('method', Input::get('method')); + } + + if (Input::get('url')) { + $filters[] = 'url'; + $httpLog = $httpLog->where('url', Input::get('url')); + } + + $httpLog = $httpLog->paginate(25); return view('profiler::index', compact('httpLog')); } diff --git a/modules/Profiler/Http/Controllers/RequestController.php b/modules/Profiler/Http/Controllers/RequestController.php new file mode 100644 index 00000000..25a640d9 --- /dev/null +++ b/modules/Profiler/Http/Controllers/RequestController.php @@ -0,0 +1,23 @@ +url) + ->where('method', $httpLog->method) + ->get(); + + $times = [ + 'avg' => $sameRequests->avg('time'), + 'min' => $sameRequests->min('time'), + 'max' => $sameRequests->max('time') + ]; + + return view('profiler::request.detail', compact('httpLog', 'sameRequests', 'times')); + } +} \ No newline at end of file diff --git a/modules/Profiler/Http/routes.php b/modules/Profiler/Http/routes.php index 4b3da4c2..78ae793c 100644 --- a/modules/Profiler/Http/routes.php +++ b/modules/Profiler/Http/routes.php @@ -1,14 +1,20 @@ LaravelLocalization::setLocale(), - 'namespace' => 'Modules\Profiler\Http\Controllers' + 'prefix' => LaravelLocalization::setLocale(), + 'namespace' => 'Modules\Profiler\Http\Controllers' ], function () { Route::group([ 'middleware' => ['admin'], - 'prefix' => 'profiler' + 'prefix' => 'admin/profiler' ], function () { - Route::get('/', 'ProfilerController@index')->name('profiler.index'); - Route::get('{httpLog}/queries', 'QueryController@index')->name('queries.index'); + Route::get('/', 'ProfilerController@index') + ->name('profiler.index'); + + Route::get('{httpLog}', 'RequestController@detail') + ->name('request.detail'); + + Route::get('{httpLog}/queries', 'QueryController@index') + ->name('queries.index'); }); }); \ 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 4cf8d445..4abae6eb 100644 --- a/modules/Profiler/Resources/lang/cs/module.php +++ b/modules/Profiler/Resources/lang/cs/module.php @@ -11,5 +11,15 @@ return [ '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', + 'sameRequests' => 'Ostatní volání' + ], + 'graphs' => [ + 'responseTime' => 'Doba odezvy' ] + ]; \ 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 new file mode 100644 index 00000000..e81d86fe --- /dev/null +++ b/modules/Profiler/Resources/views/_partials/requestList.blade.php @@ -0,0 +1,55 @@ +
| @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') | ++ |
| {{$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') | -- |
| {{$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}} | -- SQL - | -
| @lang('profiler::module.queries.createdAt') | -@lang('profiler::module.queries.sql') | -@lang('profiler::module.queries.binding') | -@lang('profiler::module.queries.time') | -- |
| @lang('profiler::module.queries.sql') | +@lang('profiler::module.queries.time') | ++ |
| {{$query->created_at->format('d.m.Y G:i')}} | -{{$query->query}} | -+ @foreach($queries as $query) + |
| + @php $sql = $query->query; @endphp + @foreach($query->bindings as $value) + @php $sql = preg_replace('/\?/', $value, $sql, 1); @endphp + @endforeach - {{var_export($query->bindings)}} - | -{{number_format($query->time, 3)}} ms | -
@lang('profiler::module.request.detail')
+@lang('profiler::module.graphs.responseTime')
+@lang('profiler::module.request.sameRequests')
+