query type in debug panel
This commit is contained in:
parent
9c044353d0
commit
6f9bbda9f0
|
@ -122,6 +122,7 @@ class ArangoDbPanel extends Panel
|
|||
|
||||
foreach ($timings as $seq => $dbTiming) {
|
||||
$this->_models[] = [
|
||||
'type' => $this->getQueryType($dbTiming['category']),
|
||||
'query' => $dbTiming['info'],
|
||||
'duration' => ($dbTiming['duration'] * 1000), // in milliseconds
|
||||
'trace' => $dbTiming['trace'],
|
||||
|
@ -134,6 +135,23 @@ class ArangoDbPanel extends Panel
|
|||
return $this->_models;
|
||||
}
|
||||
|
||||
protected function getQueryType($category) {
|
||||
switch ($category) {
|
||||
case 'devgroup\arangodb\Query::query' :
|
||||
return 'SELECT';
|
||||
case 'devgroup\arangodb\Query::insert' :
|
||||
return 'INSERT';
|
||||
case 'devgroup\arangodb\Query::update' :
|
||||
return 'UPDATE';
|
||||
case 'devgroup\arangodb\Query::remove' :
|
||||
return 'REMOVE';
|
||||
case 'devgroup\arangodb\Query::execute' :
|
||||
return 'EXECUTE';
|
||||
default :
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
return ['arango-messages' => $this->getProfileLogs()];
|
||||
|
|
|
@ -14,6 +14,8 @@ class ArangoDb extends Base
|
|||
*/
|
||||
public $query;
|
||||
|
||||
public $type;
|
||||
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
|
@ -21,7 +23,7 @@ class ArangoDb extends Base
|
|||
public function rules()
|
||||
{
|
||||
return [
|
||||
[['query'], 'safe'],
|
||||
[['query', 'type'], 'safe'],
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -31,6 +33,7 @@ class ArangoDb extends Base
|
|||
public function attributeLabels()
|
||||
{
|
||||
return [
|
||||
'type' => 'Type',
|
||||
'query' => 'Query',
|
||||
];
|
||||
}
|
||||
|
@ -48,7 +51,7 @@ class ArangoDb extends Base
|
|||
'allModels' => $models,
|
||||
'pagination' => false,
|
||||
'sort' => [
|
||||
'attributes' => ['duration', 'seq', 'query'],
|
||||
'attributes' => ['duration', 'seq', 'query', 'type'],
|
||||
'defaultOrder' => [
|
||||
'duration' => SORT_DESC,
|
||||
],
|
||||
|
@ -60,6 +63,7 @@ class ArangoDb extends Base
|
|||
}
|
||||
|
||||
$filter = new Filter();
|
||||
$this->addCondition($filter, 'type', true);
|
||||
$this->addCondition($filter, 'query', true);
|
||||
$dataProvider->allModels = $filter->filter($models);
|
||||
|
||||
|
|
|
@ -44,6 +44,12 @@ echo GridView::widget([
|
|||
'class' => 'sort-numerical'
|
||||
]
|
||||
],
|
||||
[
|
||||
'attribute' => 'type',
|
||||
'value' => function ($data) {
|
||||
return Html::encode(mb_strtoupper($data['type'], 'utf8'));
|
||||
},
|
||||
],
|
||||
[
|
||||
'attribute' => 'query',
|
||||
'value' => function ($data) {
|
||||
|
|
Loading…
Reference in New Issue