Merge pull request #2350 from schmunk42/feature/toolbar-ui-2

Feature/toolbar ui 2
This commit is contained in:
Qiang Xue
2014-02-07 10:39:52 -05:00
14 changed files with 85 additions and 65 deletions

View File

@@ -6,6 +6,7 @@
*/ */
namespace yii\debug; namespace yii\debug;
use yii\web\AssetBundle; use yii\web\AssetBundle;
/** /**

View File

@@ -154,5 +154,4 @@ class LogTarget extends Target
# / 2 because messages are in couple (begin/end) # / 2 because messages are in couple (begin/end)
return count($profileLogs['messages']) / 2; return count($profileLogs['messages']) / 2;
} }
} }

View File

File diff suppressed because one or more lines are too long

View File

@@ -50,7 +50,13 @@ class DefaultController extends Controller
$searchModel = new Debug(); $searchModel = new Debug();
$dataProvider = $searchModel->search($_GET, $this->getManifest()); $dataProvider = $searchModel->search($_GET, $this->getManifest());
// load latest request
$tags = array_keys($this->getManifest());
$tag = reset($tags);
$this->loadData($tag);
return $this->render('index', [ return $this->render('index', [
'panels' => $this->module->panels,
'dataProvider' => $dataProvider, 'dataProvider' => $dataProvider,
'searchModel' => $searchModel, 'searchModel' => $searchModel,
]); ]);
@@ -87,10 +93,6 @@ class DefaultController extends Controller
]); ]);
} }
public function actionPhpinfo()
{
phpinfo();
}
private $_manifest; private $_manifest;

View File

File diff suppressed because one or more lines are too long

View File

@@ -164,5 +164,4 @@ class DbPanel extends Panel
{ {
return (($this->criticalQueryThreshold !== null) && ($count > $this->criticalQueryThreshold)); return (($this->criticalQueryThreshold !== null) && ($count > $this->criticalQueryThreshold));
} }
} }

View File

@@ -3,6 +3,7 @@
use yii\helpers\Html; use yii\helpers\Html;
use yii\grid\GridView; use yii\grid\GridView;
use yii\data\ArrayDataProvider; use yii\data\ArrayDataProvider;
use yii\debug\panels\ConfigPanel;
/** /**
* @var \yii\web\View $this * @var \yii\web\View $this
@@ -14,15 +15,18 @@ use yii\data\ArrayDataProvider;
$this->title = 'Yii Debugger'; $this->title = 'Yii Debugger';
?> ?>
<div class="default-index"> <div class="default-index">
<div id="yii-debug-toolbar" class="yii-debug-toolbar-top"> <div id="yii-debug-toolbar" class="yii-debug-toolbar-top">
<div class="yii-debug-toolbar-block title"> <div class="yii-debug-toolbar-block title">
<a href="<?= Yii::$app->homeUrl ?>"> <a href="#">
<span class="glyphicon glyphicon-home"></span> <img width="29" height="30" alt="" src="<?= \yii\debug\Module::getYiiLogo() ?>">
Yii Debugger
</a> </a>
</div> </div>
<div class="yii-debug-toolbar-block title"> <?php foreach ($panels as $panel): ?>
Yii Debugger <?= $panel->getSummary() ?>
</div> <?php endforeach; ?>
</div> </div>
<div class="container"> <div class="container">
@@ -49,17 +53,15 @@ echo GridView::widget([
['class' => 'yii\grid\SerialColumn'], ['class' => 'yii\grid\SerialColumn'],
[ [
'attribute' => 'tag', 'attribute' => 'tag',
'value' => function ($data) 'value' => function ($data) {
{
return Html::a($data['tag'], ['view', 'tag' => $data['tag']]); return Html::a($data['tag'], ['view', 'tag' => $data['tag']]);
}, },
'format' => 'html', 'format' => 'html',
], ],
[ [
'attribute' => 'time', 'attribute' => 'time',
'value' => function ($data) use ($timeFormatter) 'value' => function ($data) use ($timeFormatter) {
{ return $timeFormatter->asDateTime($data['time'], 'short');
return $timeFormatter->asDateTime($data['time'], 'long');
}, },
], ],
'ip', 'ip',
@@ -88,8 +90,7 @@ echo GridView::widget([
], ],
[ [
'attribute'=>'ajax', 'attribute'=>'ajax',
'value' => function ($data) 'value' => function ($data) {
{
return $data['ajax'] ? 'Yes' : 'No'; return $data['ajax'] ? 'Yes' : 'No';
}, },
'filter' => ['No', 'Yes'], 'filter' => ['No', 'Yes'],

View File

@@ -8,8 +8,6 @@ $extensions = $panel->getExtensions();
?> ?>
<h1>Configuration</h1> <h1>Configuration</h1>
<div><?= Html::a('Show phpinfo() »', ['phpinfo'], ['class' => 'btn btn-info', 'target' => 'phpinfo']) ?></div>
<?php <?php
echo $this->render('panels/config/table', [ echo $this->render('panels/config/table', [
'caption' => 'Application Configuration', 'caption' => 'Application Configuration',
@@ -37,4 +35,6 @@ echo $this->render('panels/config/table', [
'Memcache' => $panel->data['php']['memcache'] ? 'Enabled' : 'Disabled', 'Memcache' => $panel->data['php']['memcache'] ? 'Enabled' : 'Disabled',
], ],
]); ]);
echo $panel->getPhpInfo();
?> ?>

View File

@@ -8,10 +8,9 @@ use yii\helpers\Html;
?> ?>
<div class="yii-debug-toolbar-block"> <div class="yii-debug-toolbar-block">
<a href="<?= $panel->getUrl() ?>"> <a href="<?= $panel->getUrl() ?>">
<img width="29" height="30" alt="" src="<?= $panel->getYiiLogo() ?>"> Yii
<span><?= $panel->data['application']['yii'] ?></span> <span class="label label-info"><?= $panel->data['application']['yii'] ?></span>
PHP
<span class="label label-info"><?= $panel->data['php']['version'] ?></span>
</a> </a>
</div> </div>
<div class="yii-debug-toolbar-block">
<?= Html::a('PHP ' . $panel->data['php']['version'], ['phpinfo'], ['title' => 'Show phpinfo()', 'target' => 'phpinfo']) ?>
</div>

View File

@@ -1,6 +1,4 @@
<div class="yii-debug-toolbar-block"> <div class="yii-debug-toolbar-block">
<a href="<?= $panel->getUrl() ?>" title="Total request processing time was <?= $time ?>">Time <span class="label"><?= $time ?></span></a> <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> <a href="<?= $panel->getUrl() ?>" title="Peak memory consumption">Memory <span class="label"><?= $memory ?></span></a>
</div> </div>

View File

@@ -5,6 +5,7 @@
* @var string $tag * @var string $tag
* @var string $position * @var string $position
*/ */
use yii\helpers\Html;
use yii\debug\panels\ConfigPanel; use yii\debug\panels\ConfigPanel;
$minJs = <<<EOD $minJs = <<<EOD
@@ -23,14 +24,17 @@ if (window.localStorage) {
} }
EOD; EOD;
$url = $panels['request']->getUrl(); $firstPanel = reset($panels);
$url = $firstPanel->getUrl();
?> ?>
<div id="yii-debug-toolbar" class="yii-debug-toolbar-<?= $position ?>"> <div id="yii-debug-toolbar" class="yii-debug-toolbar-<?= $position ?>">
<div class="yii-debug-toolbar-block"> <div class="yii-debug-toolbar-block title">
<a href="<?= Yii::$app->homeUrl ?>"> <a href="<?= Html::url(['index']) ?>">
<span class="glyphicon glyphicon-home"></span> <img width="29" height="30" alt="" src="<?= \yii\debug\Module::getYiiLogo() ?>">
Yii Debugger
</a> </a>
</div> </div>
<?php foreach ($panels as $panel): ?> <?php foreach ($panels as $panel): ?>
<?= $panel->getSummary() ?> <?= $panel->getSummary() ?>
<?php endforeach; ?> <?php endforeach; ?>
@@ -38,7 +42,7 @@ $url = $panels['request']->getUrl();
</div> </div>
<div id="yii-debug-toolbar-min"> <div id="yii-debug-toolbar-min">
<a href="<?= $url ?>" title="Open Yii Debugger" id="yii-debug-toolbar-logo"> <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> </a>
<span class="yii-debug-toolbar-toggler" onclick="<?= $maxJs ?>"></span> <span class="yii-debug-toolbar-toggler" onclick="<?= $maxJs ?>"></span>
</div> </div>

View File

@@ -17,14 +17,14 @@ $this->title = 'Yii Debugger';
?> ?>
<div class="default-view"> <div class="default-view">
<div id="yii-debug-toolbar" class="yii-debug-toolbar-top"> <div id="yii-debug-toolbar" class="yii-debug-toolbar-top">
<div class="yii-debug-toolbar-block">
<a href="<?= Yii::$app->homeUrl ?>"> <div class="yii-debug-toolbar-block title">
<span class="glyphicon glyphicon-home"></span> <a href="<?= Html::url(['index']) ?>">
<img width="29" height="30" alt="" src="<?= \yii\debug\Module::getYiiLogo() ?>">
Yii Debugger
</a> </a>
</div> </div>
<div class="yii-debug-toolbar-block title">
<?= Html::a('Yii Debugger', ['index'], ['title' => 'Back to main debug page']) ?>
</div>
<?php foreach ($panels as $panel): ?> <?php foreach ($panels as $panel): ?>
<?= $panel->getSummary() ?> <?= $panel->getSummary() ?>
<?php endforeach; ?> <?php endforeach; ?>
@@ -32,7 +32,7 @@ $this->title = 'Yii Debugger';
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-lg-2"> <div class="col-lg-2 col-md-2">
<div class="list-group"> <div class="list-group">
<?php <?php
foreach ($panels as $id => $panel) { foreach ($panels as $id => $panel) {
@@ -44,7 +44,7 @@ $this->title = 'Yii Debugger';
?> ?>
</div> </div>
</div> </div>
<div class="col-lg-10"> <div class="col-lg-10 col-md-10">
<div class="callout callout-danger"> <div class="callout callout-danger">
<?php <?php
$count = 0; $count = 0;