You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

62 lines
1.3 KiB

<?php
use yii\helpers\Html;
use yii\grid\GridView;
?>
<h1>Database Queries</h1>
<?php
echo GridView::widget([
'dataProvider' => $dataProvider,
'id' => 'db-panel-detailed-grid',
'filterModel' => $searchModel,
'filterUrl' => $panel->getUrl(),
'columns' => [
['class' => 'yii\grid\SerialColumn'],
[
'attribute' => 'seq',
'label' => 'Time',
'value' => function ($data) {
$timeInSeconds = $data['timestamp'] / 1000;
$millisecondsDiff = (int)(($timeInSeconds - (int)$timeInSeconds) * 1000);
return date('H:i:s.', $timeInSeconds) . sprintf('%03d', $millisecondsDiff);
},
],
[
'attribute' => 'duration',
'value' => function ($data) {
return sprintf('%.1f ms', $data['duration']);
},
'options' => [
'width' => '10%',
],
],
[
'attribute' => 'type',
'value' => function ($data) {
return Html::encode(mb_strtoupper($data['type'], 'utf8'));
},
],
[
'attribute' => 'query',
'value' => function ($data) {
$query = Html::encode($data['query']);
if (!empty($data['trace'])) {
$query .= Html::ul($data['trace'], [
'class' => 'trace',
'item' => function ($trace) {
return "<li>{$trace['file']} ({$trace['line']})</li>";
},
]);
}
return $query;
},
'format' => 'html',
'options' => [
'width' => '60%',
],
]
],
]);
?>