yii2-arangodb/panels/arangodb/views/detail.php

76 lines
2.2 KiB
PHP
Raw Normal View History

2014-08-05 13:28:36 +08:00
<?php
/* @var $panel yii\debug\panels\DbPanel */
/* @var $searchModel yii\debug\models\search\Db */
/* @var $dataProvider yii\data\ArrayDataProvider */
use yii\helpers\Html;
use yii\grid\GridView;
?>
<h1>Arango Database Queries</h1>
<?php
echo GridView::widget([
'dataProvider' => $dataProvider,
'id' => 'arango-db-panel-detailed-grid',
'options' => ['class' => 'detail-grid-view'],
'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);
},
'headerOptions' => [
'class' => 'sort-numerical'
]
],
[
'attribute' => 'duration',
'value' => function ($data) {
return sprintf('%.1f ms', $data['duration']);
},
'options' => [
'width' => '10%',
],
'headerOptions' => [
'class' => 'sort-numerical'
]
],
2014-08-12 16:54:30 +08:00
[
'attribute' => 'type',
'value' => function ($data) {
return Html::encode(mb_strtoupper($data['type'], 'utf8'));
},
],
2014-08-05 13:28:36 +08:00
[
'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%',
],
]
],
]);