add ArangoDb debug panel
This commit is contained in:
69
panels/arangodb/views/detail.php
Normal file
69
panels/arangodb/views/detail.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?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'
|
||||
]
|
||||
],
|
||||
[
|
||||
'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%',
|
||||
],
|
||||
]
|
||||
],
|
||||
]);
|
12
panels/arangodb/views/summary.php
Normal file
12
panels/arangodb/views/summary.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
/* @var $panel \devgroup\arangodb\panels\arangodb\ArangoDbPanel */
|
||||
/* @var $queryCount integer */
|
||||
/* @var $queryTime integer */
|
||||
?>
|
||||
<?php if ($queryCount): ?>
|
||||
<div class="yii-debug-toolbar-block">
|
||||
<a href="<?= $panel->getUrl() ?>" title="Executed <?= $queryCount ?> database queries which took <?= $queryTime ?>.">
|
||||
Ar. DB <span class="label label-info"><?= $queryCount ?></span> <span class="label"><?= $queryTime ?></span>
|
||||
</a>
|
||||
</div>
|
||||
<?php endif; ?>
|
Reference in New Issue
Block a user