-
Available Debug Data
-
'yii\i18n\Formatter']) : Yii::$app->formatter;
+if (isset($this->context->module->panels['db']) && isset($this->context->module->panels['request'])) {
-echo GridView::widget([
- 'dataProvider' => $dataProvider,
- 'filterModel' => $searchModel,
- 'rowOptions' => function ($model, $key, $index, $grid) use ($searchModel) {
- $dbPanel = $this->context->module->panels['db'];
+ echo "
Available Debug Data
";
+ $timeFormatter = extension_loaded('intl') ? Yii::createObject(['class' => 'yii\i18n\Formatter']) : Yii::$app->formatter;
- if ($searchModel->isCodeCritical($model['statusCode']) || $dbPanel->isQueryCountCritical($model['sqlCount'])) {
- return ['class'=>'danger'];
- } else {
- return [];
- }
- },
- 'columns' => [
- ['class' => 'yii\grid\SerialColumn'],
- [
- 'attribute' => 'tag',
- 'value' => function ($data) {
- return Html::a($data['tag'], ['view', 'tag' => $data['tag']]);
- },
- 'format' => 'html',
- ],
- [
- 'attribute' => 'time',
- 'value' => function ($data) use ($timeFormatter) {
- return $timeFormatter->asDateTime($data['time'], 'short');
- },
- ],
- 'ip',
- [
- 'attribute' => 'sqlCount',
- 'label' => 'Total queries',
- 'value' => function ($data) {
- $dbPanel = $this->context->module->panels['db'];
+ echo GridView::widget([
+ 'dataProvider' => $dataProvider,
+ 'filterModel' => $searchModel,
+ 'rowOptions' => function ($model, $key, $index, $grid) use ($searchModel) {
+ $dbPanel = $this->context->module->panels['db'];
- if ($dbPanel->isQueryCountCritical($data['sqlCount'])) {
+ if ($searchModel->isCodeCritical($model['statusCode']) || $dbPanel->isQueryCountCritical($model['sqlCount'])) {
+ return ['class'=>'danger'];
+ } else {
+ return [];
+ }
+ },
+ 'columns' => [
+ ['class' => 'yii\grid\SerialColumn'],
+ [
+ 'attribute' => 'tag',
+ 'value' => function ($data) {
+ return Html::a($data['tag'], ['view', 'tag' => $data['tag']]);
+ },
+ 'format' => 'html',
+ ],
+ [
+ 'attribute' => 'time',
+ 'value' => function ($data) use ($timeFormatter) {
+ return $timeFormatter->asDateTime($data['time'], 'short');
+ },
+ ],
+ 'ip',
+ [
+ 'attribute' => 'sqlCount',
+ 'label' => 'Total queries',
+ 'value' => function ($data) {
+ $dbPanel = $this->context->module->panels['db'];
- $content = Html::tag('b', $data['sqlCount']) . ' ' . Html::tag('span', '', ['class' => 'glyphicon glyphicon-exclamation-sign']);
- return Html::a($content, ['view', 'panel' => 'db', 'tag' => $data['tag']], [
- 'title' => 'Too many queries. Allowed count is ' . $dbPanel->criticalQueryThreshold,
- ]);
+ if ($dbPanel->isQueryCountCritical($data['sqlCount'])) {
- } else {
- return $data['sqlCount'];
- }
- },
- 'format' => 'html',
+ $content = Html::tag('b', $data['sqlCount']) . ' ' . Html::tag('span', '', ['class' => 'glyphicon glyphicon-exclamation-sign']);
+ return Html::a($content, ['view', 'panel' => 'db', 'tag' => $data['tag']], [
+ 'title' => 'Too many queries. Allowed count is ' . $dbPanel->criticalQueryThreshold,
+ ]);
+
+ } else {
+ return $data['sqlCount'];
+ }
+ },
+ 'format' => 'html',
+ ],
+ [
+ 'attribute' => 'method',
+ 'filter' => ['get' => 'GET', 'post' => 'POST', 'delete' => 'DELETE', 'put' => 'PUT', 'head' => 'HEAD']
+ ],
+ [
+ 'attribute'=>'ajax',
+ 'value' => function ($data) {
+ return $data['ajax'] ? 'Yes' : 'No';
+ },
+ 'filter' => ['No', 'Yes'],
+ ],
+ [
+ 'attribute' => 'url',
+ 'label' => 'URL',
+ ],
+ [
+ 'attribute' => 'statusCode',
+ 'filter' => [200 => 200, 404 => 404, 403 => 403, 500 => 500],
+ 'label' => 'Status code'
+ ],
],
- [
- 'attribute' => 'method',
- 'filter' => ['get' => 'GET', 'post' => 'POST', 'delete' => 'DELETE', 'put' => 'PUT', 'head' => 'HEAD']
- ],
- [
- 'attribute'=>'ajax',
- 'value' => function ($data) {
- return $data['ajax'] ? 'Yes' : 'No';
- },
- 'filter' => ['No', 'Yes'],
- ],
- [
- 'attribute' => 'url',
- 'label' => 'URL',
- ],
- [
- 'attribute' => 'statusCode',
- 'filter' => [200 => 200, 404 => 404, 403 => 403, 500 => 500],
- 'label' => 'Status code'
- ],
- ],
-]); ?>
+ ]);
+
+} else {
+ echo "
No data available. Panel db or request not found.
";
+}
+
+?>