mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-06-23 15:21:11 +02:00
display posts cache capacity/post count
This commit is contained in:
@@ -33,6 +33,7 @@ var adminController = {
|
||||
events: {},
|
||||
logs: {},
|
||||
database: {},
|
||||
postCache: {},
|
||||
plugins: {},
|
||||
languages: {},
|
||||
settings: {},
|
||||
@@ -236,6 +237,26 @@ adminController.logs.get = function(req, res, next) {
|
||||
});
|
||||
};
|
||||
|
||||
adminController.postCache.get = function(req, res, next) {
|
||||
var cache = require('../posts/cache');
|
||||
var avgPostSize = 0;
|
||||
var percentFull = 0;
|
||||
if (cache.itemCount > 0) {
|
||||
avgPostSize = parseInt((cache.length / cache.itemCount), 10);
|
||||
percentFull = ((cache.length / cache.max) * 100).toFixed(2);
|
||||
}
|
||||
|
||||
res.render('admin/advanced/post-cache', {
|
||||
cache: {
|
||||
length: cache.length,
|
||||
max: cache.max,
|
||||
itemCount: cache.itemCount,
|
||||
percentFull: percentFull,
|
||||
avgPostSize: avgPostSize
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
adminController.plugins.get = function(req, res, next) {
|
||||
plugins.getAll(function(err, plugins) {
|
||||
if (err || !Array.isArray(plugins)) {
|
||||
|
||||
@@ -72,6 +72,7 @@ function addRoutes(router, middleware, controllers) {
|
||||
router.get('/advanced/database', controllers.admin.database.get);
|
||||
router.get('/advanced/events', controllers.admin.events.get);
|
||||
router.get('/advanced/logs', controllers.admin.logs.get);
|
||||
router.get('/advanced/post-cache', controllers.admin.postCache.get);
|
||||
|
||||
router.get('/development/logger', controllers.admin.logger.get);
|
||||
}
|
||||
|
||||
27
src/views/admin/advanced/post-cache.tpl
Normal file
27
src/views/admin/advanced/post-cache.tpl
Normal file
@@ -0,0 +1,27 @@
|
||||
|
||||
<div class="post-cache">
|
||||
<div class="col-lg-9">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading"><i class="fa fa-calendar-o"></i> Post Cache</div>
|
||||
<div class="panel-body" data-next="{next}">
|
||||
|
||||
<label>Posts in Cache</label><br/>
|
||||
<span>{cache.itemCount}</span><br/>
|
||||
|
||||
<label>Average Post Size</label><br/>
|
||||
<span>{cache.avgPostSize}</span><br/>
|
||||
|
||||
<label>Length / Max</label><br/>
|
||||
<span>{cache.length} / {cache.max}</span><br/>
|
||||
|
||||
<div class="progress">
|
||||
<div class="progress-bar" role="progressbar" aria-valuenow="{cache.percentFull}" aria-valuemin="0" aria-valuemax="100" style="width: {cache.percentFull}%;">
|
||||
{cache.percentFull}% Full
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -58,6 +58,7 @@
|
||||
<li><a href="{relative_path}/admin/advanced/database">Database</a></li>
|
||||
<li><a href="{relative_path}/admin/advanced/events">Events</a></li>
|
||||
<li><a href="{relative_path}/admin/advanced/logs">Logs</a></li>
|
||||
<li><a href="{relative_path}/admin/advanced/post-cache">Post Cache</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<!-- IF authentication.length -->
|
||||
|
||||
Reference in New Issue
Block a user