Skip to content
This repository has been archived by the owner on Nov 2, 2020. It is now read-only.

Commit

Permalink
style(Admin Panel): Fix Broken View Admin Panel
Browse files Browse the repository at this point in the history
  • Loading branch information
Rhilip committed Mar 24, 2019
1 parent be94de3 commit e834831
Show file tree
Hide file tree
Showing 6 changed files with 133 additions and 87 deletions.
51 changes: 51 additions & 0 deletions apps/public/static/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,54 @@ ul#torrent-filelist ul{margin-left:1.25em}
#torrent-structure li div.dictionary span.icon{color:#909;padding:2px}
#torrent-structure li div.list span.icon{color:#009;padding:2px}
#torrent-structure li span.title{font-weight:bold}

.admin-panel {
font-size: 0;
}

.admin-panel-tree .layui-tree {
line-height: 32px;
}

.admin-panel-tree .layui-tree li h2 {
line-height: 36px;
border-left: 5px solid #009E94;
margin: 15px 0 5px;
padding: 0 10px;
background-color: #f2f2f2;
}

.admin-panel-tree {
border-right: 1px solid #eee;
}
.admin-panel-tree {
width: 220px;
min-height: 900px;
padding: 5px 0 20px;
}
.admin-panel-tree, .admin-panel-content {
display: inline-block;
vertical-align: top;
font-size: 14px;
}

.admin-panel-content {
width: 899px;
min-height: 900px;
padding: 20px 0 10px 20px;
}

.admin-panel-tree .layui-tree .site-tree-noicon a cite {
padding-left: 15px;
}

.admin-panel-tree .layui-tree li a cite {
padding: 0 8px;
}

.admin-panel-tree .layui-tree li a em {
font-size: 12px;
color: #bbb;
padding-right: 5px;
font-style: normal;
}
25 changes: 10 additions & 15 deletions apps/views/admin/layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,19 @@
<?php $this->start('title')?>Admin Panel<?php $this->end();?>

<?php $this->start('container')?>
<div class="layui-row">
<div class="layui-col-md3">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Site Status</h3>
</div>
<div class="panel-body">
<ul class="nav nav-pills nav-stacked">
<li><!--suppress HtmlUnknownTarget --><a href="/admin/service?provider=mysql">Mysql Status</a></li>
<li><!--suppress HtmlUnknownTarget --><a href="/admin/service?provider=redis">Redis Service Status</a></li>
<li><!--suppress HtmlUnknownTarget --><a href="/admin/service?provider=redis&panel=keys">Redis Keys Status</a></li>
</ul>
</div><!--/.panel-body -->
</div>
<div class="layui-row admin-panel">
<div class="admin-panel-tree">
<ul class="layui-tree">
<li><h2>Site Status</h2></li>
<li><!--suppress HtmlUnknownTarget --><a href="/admin/service?provider=mysql"><cite>Mysql Status</cite></a></li>
<li><!--suppress HtmlUnknownTarget --><a href="/admin/service?provider=redis"><cite>Redis Service Status</cite></a></li>
<li><!--suppress HtmlUnknownTarget --><a href="/admin/service?provider=redis&panel=keys"><cite>Redis Keys Status</cite></a></li>
</ul>
</div>
<div class="layui-col-md9">
<div class="admin-panel-content">
<?= $this->section('panel') ?>
</div>
</div>

<?php $this->end();?>

8 changes: 0 additions & 8 deletions apps/views/admin/mysql_status.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,3 @@
</div>
</div>
<?php $this->end(); ?>

<?php $this->push('script') ?>
<script>
layui.use(['element'],function () {

});
</script>
<?php $this->end() ?>
30 changes: 20 additions & 10 deletions apps/views/admin/redis_keys.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,34 +21,44 @@
<h1>Redis Keys Status</h1>
<p>Please input the search pattern of keys, or your can use the search suggest</p>

<div class="thumbnail">
<div>
<hr>

<div>
<div class="layui-form-item">
<!--suppress HtmlUnknownTarget -->
<form id="search_redis" class="form-inline" method="get" action="/admin/service">
<div class="form-group">
<?php $pattern = $pattern ?? ''; ?>
<label><input name="provider" type="text" class="form-control" value="redis" style="display: none"></label>
<label><input name="panel" type="text" class="form-control" value="keys" style="display: none"></label>
<input name="pattern" type="text" class="form-control" placeholder="<?= $pattern ?>" value="<?= $pattern ?>">
<button type="submit" class="btn btn-primary"><i class="fas fa-search"></i> Search </button>
<button type="reset" class="btn btn-default"><i class="fas fa-times"></i> Reset </button>
<div class="layui-inline">
<label class="layui-form-label">Search Keys</label>
<div class="layui-input-inline" style="width: 300px">
<input name="pattern" type="text" class="layui-input" placeholder="<?= $pattern ?? '' ?>" value="<?= $pattern ?? '' ?>">
</div>
</div>
<div class="layui-inline">
<button type="submit" class="layui-btn layui-btn-normal"><i class="fas fa-search"></i> Search</button>
<button type="reset" class="layui-btn layui-btn-danger"><i class="fas fa-times"></i> Reset</button>
</div>
</div>
</form>
</div>
<?php $suggent_pattern = ['*', 'SESSION:*', 'TORRENT:*', 'TRACKER:*', 'USER:*'] ?>
<div id="suggest_pattern">Suggest Pattern :
<?php foreach ($suggent_pattern as $pat): ?>
<span class="bg-success">
<a href="javascript:void(0);" data-pat="<?= $pat ?>"> <?= $pat ?> </a>
</span>&nbsp;&nbsp;
<a href="javascript:void(0);" data-pat="<?= $pat ?>"><span class="layui-badge layui-bg-green"><?= $pat ?></span></a>&nbsp;&nbsp;
<?php endforeach; ?>
</div>
</div>

<?php if ($pattern != ''): ?>
<hr>
<div>
<div class="pull-left">Keys matching <code><?= $pattern ?></code></div>
<div class="pull-right">(<strong><?= $num_keys ?? 0 ?></strong> out of <strong><?= $dbsize ?? 0 ?></strong> matched)</div>
<div class="pull-right">(<strong><?= $num_keys ?? 0 ?></strong> out of <strong><?= $dbsize ?? 0 ?></strong>
matched)
</div>
</div>
<table class="layui-table">
<thead>
Expand Down Expand Up @@ -96,7 +106,7 @@

<?php $this->push('script') ?>
<script>
layui.use(['jquery'],function () {
layui.use(['jquery'], function () {
let $ = layui.jquery;
$('#suggest_pattern a').click(function () {
let pat = $(this).attr('data-pat');
Expand Down
102 changes: 49 additions & 53 deletions apps/views/admin/redis_status.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,61 +24,57 @@

<p><strong><?= $dbsize ?> Keys available.</strong></p>

<div class="row">
<div class="col-md-12">

<ul class="nav nav-tabs" role="tablist" id="serverstatus-tabs">
<li class="active"><a href="#overall">Overall Status</a></li>
<li><a href="#commands">Command Statistics</a></li>
</ul>

<div class="tab-content">
<div class="tab-pane active" id="overall">
<table class="layui-table">
<thead>
<tr>
<th>Key</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<?php foreach ($info as $key => $value): ?>
<?php if (strpos($key, 'cmdstat_') === false): ?>
<tr>
<td><?= $key ?></td>
<td><code><?= $value ?></code></td>
</tr>
<?php endif ?>
<?php endforeach; ?>
</tbody>
</table>
</div>
<div class="tab-pane" id="commands">
<table class="layui-table">
<thead>
<tr>
<th>Command</th>
<th class="text-right">Calls</th>
<th class="text-right">Call Share</th>
<th class="text-right">Duration (Microseconds)</th>
<th class="text-right">Duration/Call</th>
</tr>
</thead>
<tbody>
<?php foreach ($cmdstat as $key => $value): ?>
<div class="layui-collapse">
<div class="layui-colla-item">
<h2 class="layui-colla-title"> Overall Status </h2>
<div class="layui-colla-content layui-show">
<table class="layui-table">
<thead>
<tr>
<th>Key</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<?php foreach ($info as $key => $value): ?>
<?php if (strpos($key, 'cmdstat_') === false): ?>
<tr>
<td><code><?= str_replace('cmdstat_', '', $key) ?> </code></td>
<td class="text-right"><?= $value['calls'] ?></td>
<td class="text-right"><?= sprintf('%.2f', $value["calls"] / $info["total_commands_processed"] * 100) ?> %</td>
<td class="text-right"><?= $value['usec'] ?></td>
<td class="text-right"><?= sprintf('%.1f', $value['usec_per_call']) ?></td>
<td><?= $key ?></td>
<td><code><?= $value ?></code></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php endif ?>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
<div class="layui-colla-item">
<h2 class="layui-colla-title"> Command Statistics </h2>
<div class="layui-colla-content layui-show">
<table class="layui-table">
<thead>
<tr>
<th>Command</th>
<th class="text-right">Calls</th>
<th class="text-right">Call Share</th>
<th class="text-right">Duration (Microseconds)</th>
<th class="text-right">Duration/Call</th>
</tr>
</thead>
<tbody>
<?php foreach ($cmdstat as $key => $value): ?>
<tr>
<td><code><?= str_replace('cmdstat_', '', $key) ?> </code></td>
<td class="text-right"><?= $value['calls'] ?></td>
<td class="text-right"><?= sprintf('%.2f', $value["calls"] / $info["total_commands_processed"] * 100) ?> %</td>
<td class="text-right"><?= $value['usec'] ?></td>
<td class="text-right"><?= sprintf('%.1f', $value['usec_per_call']) ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>

</div>
</div><?php $this->end(); ?>
</div>
<?php $this->end(); ?>

4 changes: 3 additions & 1 deletion apps/views/layout/base.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
</div>
</div>
</header>
<div class="clearfix"></div>

<nav id="nav" class="header-nav layui-container">
<div class="layui-row" align="center">
Expand Down Expand Up @@ -81,11 +82,12 @@
</div>
</div>
</nav> <!-- /nav -->

<div class="clearfix"></div>

<div id="container" class="layui-container">
<?= $this->section('container') ?> <!-- Page Content -->
</div> <!-- /container -->
<div class="clearfix"></div>

<footer id="footer-menu">
<div class="container" align="center">
Expand Down

0 comments on commit e834831

Please sign in to comment.