Commit 7e19f799 by Serge Postrash

Http status codes are hardcoded in filter

Arbitrary http status codes are hardcoded in filter so it is impossible to search by status code not present in select.
parent cb87d7be
...@@ -34,6 +34,15 @@ if (isset($this->context->module->panels['db']) && isset($this->context->module- ...@@ -34,6 +34,15 @@ if (isset($this->context->module->panels['db']) && isset($this->context->module-
echo " <h1>Available Debug Data</h1>"; echo " <h1>Available Debug Data</h1>";
$timeFormatter = extension_loaded('intl') ? Yii::createObject(['class' => 'yii\i18n\Formatter']) : Yii::$app->formatter; $timeFormatter = extension_loaded('intl') ? Yii::createObject(['class' => 'yii\i18n\Formatter']) : Yii::$app->formatter;
$codes = [];
foreach ($manifest as $tag => $vals) {
if (!empty($vals['statusCode'])) {
$codes[] = $vals['statusCode'];
}
}
$codes = array_unique($codes, SORT_NUMERIC);
$status_codes = (!empty($codes)) ? array_combine($codes, $codes) : true;
echo GridView::widget([ echo GridView::widget([
'dataProvider' => $dataProvider, 'dataProvider' => $dataProvider,
'filterModel' => $searchModel, 'filterModel' => $searchModel,
...@@ -104,7 +113,7 @@ if (isset($this->context->module->panels['db']) && isset($this->context->module- ...@@ -104,7 +113,7 @@ if (isset($this->context->module->panels['db']) && isset($this->context->module-
], ],
[ [
'attribute' => 'statusCode', 'attribute' => 'statusCode',
'filter' => [200 => 200, 404 => 404, 403 => 403, 500 => 500], 'filter' => $status_codes,
'label' => 'Status code' 'label' => 'Status code'
], ],
], ],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment