From 2f8f64ccc8303f15aa44a5b62381fe48dc69d476 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Sat, 4 Jan 2014 23:51:53 +0100 Subject: [PATCH] added sorting links to debug toolbar as requested in https://github.com/yiisoft/yii2/pull/1781#issuecomment-31587963 https://github.com/yiisoft/yii2/issues/1478#issuecomment-31576474 fixes #1478 --- extensions/yii/debug/assets/main.css | 42 +++++++++++++++++++++- .../yii/debug/views/default/panels/db/detail.php | 6 ++++ .../yii/debug/views/default/panels/log/detail.php | 6 +++- .../debug/views/default/panels/profile/detail.php | 6 ++++ 4 files changed, 58 insertions(+), 2 deletions(-) diff --git a/extensions/yii/debug/assets/main.css b/extensions/yii/debug/assets/main.css index d192124..63df423 100644 --- a/extensions/yii/debug/assets/main.css +++ b/extensions/yii/debug/assets/main.css @@ -28,7 +28,47 @@ ul.trace { float: right; } -td, th { +td { white-space: pre-line; word-wrap: break-word; } + +th { + white-space: nowrap; +} + +/* add sorting icons to gridview sort links */ +a.asc:after, a.desc:after { + position: relative; + top: 1px; + display: inline-block; + font-family: 'Glyphicons Halflings'; + font-style: normal; + font-weight: normal; + line-height: 1; + padding-left: 5px; +} + +a.asc:after { + content: /*"\e113"*/ "\e151"; +} + +a.desc:after { + content: /*"\e114"*/ "\e152"; +} + +.sort-numerical a.asc:after { + content: "\e153"; +} + +.sort-numerical a.desc:after { + content: "\e154"; +} + +.sort-ordinal a.asc:after { + content: "\e155"; +} + +.sort-ordinal a.desc:after { + content: "\e156"; +} \ No newline at end of file diff --git a/extensions/yii/debug/views/default/panels/db/detail.php b/extensions/yii/debug/views/default/panels/db/detail.php index ad46636..826c045 100644 --- a/extensions/yii/debug/views/default/panels/db/detail.php +++ b/extensions/yii/debug/views/default/panels/db/detail.php @@ -21,6 +21,9 @@ echo GridView::widget([ $millisecondsDiff = (int)(($timeInSeconds - (int)$timeInSeconds) * 1000); return date('H:i:s.', $timeInSeconds) . sprintf('%03d', $millisecondsDiff); }, + 'headerOptions' => [ + 'class' => 'sort-numerical' + ] ], [ 'attribute' => 'duration', @@ -30,6 +33,9 @@ echo GridView::widget([ 'options' => [ 'width' => '10%', ], + 'headerOptions' => [ + 'class' => 'sort-numerical' + ] ], [ 'attribute' => 'type', diff --git a/extensions/yii/debug/views/default/panels/log/detail.php b/extensions/yii/debug/views/default/panels/log/detail.php index d40996a..7460516 100644 --- a/extensions/yii/debug/views/default/panels/log/detail.php +++ b/extensions/yii/debug/views/default/panels/log/detail.php @@ -29,6 +29,9 @@ echo GridView::widget([ $millisecondsDiff = (int)(($timeInSeconds - (int)$timeInSeconds) * 1000); return date('H:i:s.',$timeInSeconds) . sprintf('%03d',$millisecondsDiff); }, + 'headerOptions' => [ + 'class' => 'sort-numerical' + ] ], [ 'attribute' => 'level', @@ -37,9 +40,10 @@ echo GridView::widget([ }, 'filter' => [ Logger::LEVEL_TRACE => ' Trace ', - Logger::LEVEL_PROFILE => ' Profile ', Logger::LEVEL_INFO => ' Info ', + Logger::LEVEL_WARNING => ' Warning ', Logger::LEVEL_ERROR => ' Error ', + Logger::LEVEL_PROFILE => ' Profile ', ], ], 'category', diff --git a/extensions/yii/debug/views/default/panels/profile/detail.php b/extensions/yii/debug/views/default/panels/profile/detail.php index 61f2c2e..842795a 100644 --- a/extensions/yii/debug/views/default/panels/profile/detail.php +++ b/extensions/yii/debug/views/default/panels/profile/detail.php @@ -20,6 +20,9 @@ echo GridView::widget([ $millisecondsDiff = (int)(($timeInSeconds - (int)$timeInSeconds) * 1000); return date('H:i:s.', $timeInSeconds) . sprintf('%03d', $millisecondsDiff); }, + 'headerOptions' => [ + 'class' => 'sort-numerical' + ] ], [ 'attribute' => 'duration', @@ -29,6 +32,9 @@ echo GridView::widget([ 'options' => [ 'width' => '10%', ], + 'headerOptions' => [ + 'class' => 'sort-numerical' + ] ], 'category', [