mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-19 16:01:57 +08:00
Merge pull request #2350 from schmunk42/feature/toolbar-ui-2
Feature/toolbar ui 2
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
namespace yii\debug;
|
||||
|
||||
use yii\web\AssetBundle;
|
||||
|
||||
/**
|
||||
|
||||
@@ -154,5 +154,4 @@ class LogTarget extends Target
|
||||
# / 2 because messages are in couple (begin/end)
|
||||
return count($profileLogs['messages']) / 2;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -39,7 +39,7 @@ class DefaultController extends Controller
|
||||
public function actions()
|
||||
{
|
||||
$actions = [];
|
||||
foreach($this->module->panels as $panel) {
|
||||
foreach ($this->module->panels as $panel) {
|
||||
$actions = array_merge($actions, $panel->actions);
|
||||
}
|
||||
return $actions;
|
||||
@@ -50,7 +50,13 @@ class DefaultController extends Controller
|
||||
$searchModel = new Debug();
|
||||
$dataProvider = $searchModel->search($_GET, $this->getManifest());
|
||||
|
||||
// load latest request
|
||||
$tags = array_keys($this->getManifest());
|
||||
$tag = reset($tags);
|
||||
$this->loadData($tag);
|
||||
|
||||
return $this->render('index', [
|
||||
'panels' => $this->module->panels,
|
||||
'dataProvider' => $dataProvider,
|
||||
'searchModel' => $searchModel,
|
||||
]);
|
||||
@@ -87,10 +93,6 @@ class DefaultController extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
public function actionPhpinfo()
|
||||
{
|
||||
phpinfo();
|
||||
}
|
||||
|
||||
private $_manifest;
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -54,7 +54,7 @@ class DbPanel extends Panel
|
||||
$queryTime = number_format($this->getTotalQueryTime($timings) * 1000) . ' ms';
|
||||
|
||||
return Yii::$app->view->render('panels/db/summary', [
|
||||
'timings' => $this->calculateTimings(),
|
||||
'timings' => $this->calculateTimings(),
|
||||
'panel' => $this,
|
||||
'queryCount' => $queryCount,
|
||||
'queryTime' => $queryTime,
|
||||
@@ -127,7 +127,7 @@ class DbPanel extends Panel
|
||||
$this->_models = [];
|
||||
$timings = $this->calculateTimings();
|
||||
|
||||
foreach($timings as $seq => $dbTiming) {
|
||||
foreach ($timings as $seq => $dbTiming) {
|
||||
$this->_models[] = [
|
||||
'type' => $this->getQueryType($dbTiming['info']),
|
||||
'query' => $dbTiming['info'],
|
||||
@@ -164,5 +164,4 @@ class DbPanel extends Panel
|
||||
{
|
||||
return (($this->criticalQueryThreshold !== null) && ($count > $this->criticalQueryThreshold));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ class LogPanel extends Panel
|
||||
$dataProvider = $searchModel->search(Yii::$app->request->getQueryParams(), $this->getModels());
|
||||
|
||||
return Yii::$app->view->render('panels/log/detail', [
|
||||
'dataProvider' => $dataProvider,
|
||||
'dataProvider' => $dataProvider,
|
||||
'panel' => $this,
|
||||
'searchModel' => $searchModel,
|
||||
]);
|
||||
@@ -78,7 +78,7 @@ class LogPanel extends Panel
|
||||
if ($this->_models === null || $refresh) {
|
||||
$this->_models = [];
|
||||
|
||||
foreach($this->data['messages'] as $message) {
|
||||
foreach ($this->data['messages'] as $message) {
|
||||
$this->_models[] = [
|
||||
'message' => $message[0],
|
||||
'level' => $message[1],
|
||||
|
||||
@@ -86,7 +86,7 @@ class ProfilingPanel extends Panel
|
||||
$this->_models = [];
|
||||
$timings = Yii::$app->getLog()->calculateTimings($this->data['messages']);
|
||||
|
||||
foreach($timings as $seq => $profileTiming) {
|
||||
foreach ($timings as $seq => $profileTiming) {
|
||||
$this->_models[] = [
|
||||
'duration' => $profileTiming['duration'] * 1000, // in milliseconds
|
||||
'category' => $profileTiming['category'],
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
use yii\helpers\Html;
|
||||
use yii\grid\GridView;
|
||||
use yii\data\ArrayDataProvider;
|
||||
use yii\debug\panels\ConfigPanel;
|
||||
|
||||
/**
|
||||
* @var \yii\web\View $this
|
||||
@@ -14,15 +15,18 @@ use yii\data\ArrayDataProvider;
|
||||
$this->title = 'Yii Debugger';
|
||||
?>
|
||||
<div class="default-index">
|
||||
<div id="yii-debug-toolbar" class="yii-debug-toolbar-top">
|
||||
<div class="yii-debug-toolbar-block title">
|
||||
<a href="<?= Yii::$app->homeUrl ?>">
|
||||
<span class="glyphicon glyphicon-home"></span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="yii-debug-toolbar-block title">
|
||||
Yii Debugger
|
||||
</div>
|
||||
|
||||
|
||||
<div id="yii-debug-toolbar" class="yii-debug-toolbar-top">
|
||||
<div class="yii-debug-toolbar-block title">
|
||||
<a href="#">
|
||||
<img width="29" height="30" alt="" src="<?= \yii\debug\Module::getYiiLogo() ?>">
|
||||
Yii Debugger
|
||||
</a>
|
||||
</div>
|
||||
<?php foreach ($panels as $panel): ?>
|
||||
<?= $panel->getSummary() ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
@@ -49,17 +53,15 @@ echo GridView::widget([
|
||||
['class' => 'yii\grid\SerialColumn'],
|
||||
[
|
||||
'attribute' => 'tag',
|
||||
'value' => function ($data)
|
||||
{
|
||||
'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'], 'long');
|
||||
'value' => function ($data) use ($timeFormatter) {
|
||||
return $timeFormatter->asDateTime($data['time'], 'short');
|
||||
},
|
||||
],
|
||||
'ip',
|
||||
@@ -71,7 +73,7 @@ echo GridView::widget([
|
||||
|
||||
if ($dbPanel->isQueryCountCritical($data['sqlCount'])) {
|
||||
|
||||
$content = Html::tag('b', $data['sqlCount']) . ' ' . Html::tag('span','',['class' => 'glyphicon glyphicon-exclamation-sign']);
|
||||
$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,
|
||||
]);
|
||||
@@ -88,8 +90,7 @@ echo GridView::widget([
|
||||
],
|
||||
[
|
||||
'attribute'=>'ajax',
|
||||
'value' => function ($data)
|
||||
{
|
||||
'value' => function ($data) {
|
||||
return $data['ajax'] ? 'Yes' : 'No';
|
||||
},
|
||||
'filter' => ['No', 'Yes'],
|
||||
|
||||
@@ -8,8 +8,6 @@ $extensions = $panel->getExtensions();
|
||||
?>
|
||||
<h1>Configuration</h1>
|
||||
|
||||
<div><?= Html::a('Show phpinfo() »', ['phpinfo'], ['class' => 'btn btn-info', 'target' => 'phpinfo']) ?></div>
|
||||
|
||||
<?php
|
||||
echo $this->render('panels/config/table', [
|
||||
'caption' => 'Application Configuration',
|
||||
@@ -37,4 +35,6 @@ echo $this->render('panels/config/table', [
|
||||
'Memcache' => $panel->data['php']['memcache'] ? 'Enabled' : 'Disabled',
|
||||
],
|
||||
]);
|
||||
|
||||
echo $panel->getPhpInfo();
|
||||
?>
|
||||
@@ -8,10 +8,9 @@ use yii\helpers\Html;
|
||||
?>
|
||||
<div class="yii-debug-toolbar-block">
|
||||
<a href="<?= $panel->getUrl() ?>">
|
||||
<img width="29" height="30" alt="" src="<?= $panel->getYiiLogo() ?>">
|
||||
<span><?= $panel->data['application']['yii'] ?></span>
|
||||
Yii
|
||||
<span class="label label-info"><?= $panel->data['application']['yii'] ?></span>
|
||||
PHP
|
||||
<span class="label label-info"><?= $panel->data['php']['version'] ?></span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="yii-debug-toolbar-block">
|
||||
<?= Html::a('PHP ' . $panel->data['php']['version'], ['phpinfo'], ['title' => 'Show phpinfo()', 'target' => 'phpinfo']) ?>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
<div class="yii-debug-toolbar-block">
|
||||
<a href="<?= $panel->getUrl() ?>" title="Total request processing time was <?= $time ?>">Time <span class="label"><?= $time ?></span></a>
|
||||
</div>
|
||||
<div class="yii-debug-toolbar-block">
|
||||
<a href="<?= $panel->getUrl() ?>" title="Peak memory consumption">Memory <span class="label"><?= $memory ?></span></a>
|
||||
</div>
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
* @var string $tag
|
||||
* @var string $position
|
||||
*/
|
||||
use yii\helpers\Html;
|
||||
use yii\debug\panels\ConfigPanel;
|
||||
|
||||
$minJs = <<<EOD
|
||||
@@ -23,22 +24,25 @@ if (window.localStorage) {
|
||||
}
|
||||
EOD;
|
||||
|
||||
$url = $panels['request']->getUrl();
|
||||
$firstPanel = reset($panels);
|
||||
$url = $firstPanel->getUrl();
|
||||
?>
|
||||
<div id="yii-debug-toolbar" class="yii-debug-toolbar-<?= $position ?>">
|
||||
<div class="yii-debug-toolbar-block">
|
||||
<a href="<?= Yii::$app->homeUrl ?>">
|
||||
<span class="glyphicon glyphicon-home"></span>
|
||||
<div class="yii-debug-toolbar-block title">
|
||||
<a href="<?= Html::url(['index']) ?>">
|
||||
<img width="29" height="30" alt="" src="<?= \yii\debug\Module::getYiiLogo() ?>">
|
||||
Yii Debugger
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<?php foreach ($panels as $panel): ?>
|
||||
<?= $panel->getSummary() ?>
|
||||
<?= $panel->getSummary() ?>
|
||||
<?php endforeach; ?>
|
||||
<span class="yii-debug-toolbar-toggler" onclick="<?= $minJs ?>">›</span>
|
||||
</div>
|
||||
<div id="yii-debug-toolbar-min">
|
||||
<a href="<?= $url ?>" title="Open Yii Debugger" id="yii-debug-toolbar-logo">
|
||||
<img width="29" height="30" alt="" src="<?= ConfigPanel::getYiiLogo() ?>">
|
||||
<img width="29" height="30" alt="" src="<?= \yii\debug\Module::getYiiLogo() ?>">
|
||||
</a>
|
||||
<span class="yii-debug-toolbar-toggler" onclick="<?= $maxJs ?>">‹</span>
|
||||
</div>
|
||||
|
||||
@@ -17,14 +17,14 @@ $this->title = 'Yii Debugger';
|
||||
?>
|
||||
<div class="default-view">
|
||||
<div id="yii-debug-toolbar" class="yii-debug-toolbar-top">
|
||||
<div class="yii-debug-toolbar-block">
|
||||
<a href="<?= Yii::$app->homeUrl ?>">
|
||||
<span class="glyphicon glyphicon-home"></span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="yii-debug-toolbar-block title">
|
||||
<?= Html::a('Yii Debugger', ['index'], ['title' => 'Back to main debug page']) ?>
|
||||
</div>
|
||||
|
||||
<div class="yii-debug-toolbar-block title">
|
||||
<a href="<?= Html::url(['index']) ?>">
|
||||
<img width="29" height="30" alt="" src="<?= \yii\debug\Module::getYiiLogo() ?>">
|
||||
Yii Debugger
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<?php foreach ($panels as $panel): ?>
|
||||
<?= $panel->getSummary() ?>
|
||||
<?php endforeach; ?>
|
||||
@@ -32,7 +32,7 @@ $this->title = 'Yii Debugger';
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-2">
|
||||
<div class="col-lg-2 col-md-2">
|
||||
<div class="list-group">
|
||||
<?php
|
||||
foreach ($panels as $id => $panel) {
|
||||
@@ -44,7 +44,7 @@ $this->title = 'Yii Debugger';
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-10">
|
||||
<div class="col-lg-10 col-md-10">
|
||||
<div class="callout callout-danger">
|
||||
<?php
|
||||
$count = 0;
|
||||
|
||||
Reference in New Issue
Block a user