admin/redis page

v1.18.x
Baris Usakli 12 years ago
parent 37b5680db0
commit dfdbc3bea2

@ -699,4 +699,11 @@ body .navbar .nodebb-inline-block {
#right-menu{
float:right;
}
#admin-redis-info {
span {
display:inline-block;
width:200px;
}
}

@ -70,7 +70,7 @@ var templates = {};
'login', 'reset', 'reset_code', 'account',
'confirm', '403',
'emails/reset', 'emails/reset_plaintext', 'emails/email_confirm', 'emails/email_confirm_plaintext',
'admin/index', 'admin/categories', 'admin/users', 'admin/topics', 'admin/settings', 'admin/themes', 'admin/twitter', 'admin/facebook', 'admin/gplus'
'admin/index', 'admin/categories', 'admin/users', 'admin/topics', 'admin/settings', 'admin/themes', 'admin/twitter', 'admin/facebook', 'admin/gplus', 'admin/redis'
]);
}

@ -94,6 +94,8 @@
<li class=''><a href='/admin/topics'><i class='icon-book'></i> Topics</a></li>
<li class=''><a href='/admin/themes'><i class='icon-th'></i> Themes</a></li>
<li class=''><a href='/admin/settings'><i class='icon-cogs'></i> Settings</a></li>
<li class=''><a href='/admin/redis'><i class='icon-hdd'></i> Redis</a></li>
<li class="nav-header">Social Authentication</li>
<li class=''><a href='/admin/twitter'><i class='icon-twitter'></i>Twitter</a></li>
<li class=''><a href='/admin/facebook'><i class='icon-facebook'></i>Facebook</a></li>

@ -0,0 +1,23 @@
<h1>Redis</h1>
<hr />
<div id="admin-redis-info">
<span>Redis Version</span> <span class="text-right">{redis_version}</span><br/>
<hr/>
<span>Uptime in Seconds</span> <span class="text-right">{uptime_in_seconds}</span><br/>
<span>Uptime in Days</span> <span class="text-right">{uptime_in_days}</span><br/>
<hr/>
<span>Connected Clients</span> <span class="text-right">{connected_clients}</span><br/>
<span>Connected Slaves</span> <span class="text-right">{connected_slaves}</span><br/>
<span>Blocked Clients</span> <span class="text-right">{blocked_clients}</span><br/>
<hr/>
<span>Used Memory</span> <span class="text-right">{used_memory_human}</span><br/>
<span>Memory Fragmentation Ratio</span> <span class="text-right">{mem_fragmentation_ratio}</span><br/>
<hr/>
<span>Total Connections Received</span> <span class="text-right">{total_connections_received}</span><br/>
<span>Total Commands Processed</span> <span class="text-right">{total_commands_processed}</span><br/>
<hr/>
<span>Keyspace Hits</span> <span class="text-right">{keyspace_hits}</span><br/>
<span>Keyspace Misses</span> <span class="text-right">{keyspace_misses}</span><br/>
</div>

@ -1,16 +1,18 @@
var user = require('./../user.js'),
topics = require('./../topics.js');
topics = require('./../topics.js'),
RDB = require('./../redis.js');
(function(Admin) {
Admin.create_routes = function(app) {
(function() {
var routes = ['categories', 'users', 'topics', 'settings', 'themes', 'twitter', 'facebook', 'gplus'];
var routes = ['categories', 'users', 'topics', 'settings', 'themes', 'twitter', 'facebook', 'gplus', 'redis'];
for (var i=0, ii=routes.length; i<ii; i++) {
(function(route) {
app.get('/admin/' + route, function(req, res) {
console.log("derp " +route);
res.send(templates['admin/header'] + app.create_route('admin/' + route) + templates['admin/footer']);
});
}(routes[i]));
@ -52,6 +54,31 @@ var user = require('./../user.js'),
res.send(JSON.stringify(data));
});
break;
case 'redis':
console.log('going into redis');
RDB.info(function(err, data) {
data = data.split("\r\n");
var finalData = {};
for(var i in data) {
try {
data[i] = data[i].replace(/:/,"\":\"");
var json = "{\"" + data[i] + "\"}";
var jsonObject = JSON.parse(json);
for(var key in jsonObject) {
finalData[key] = jsonObject[key];
}
}catch(err){
}
}
console.log(finalData);
res.send(JSON.stringify(finalData));
});
break;
default :
res.send('{}');
}

@ -90,7 +90,7 @@ var config = require('../config.js'),
if(key === 'email') {
User.setUserField(uid, 'gravatarpicture', User.createGravatarURLFromEmail(data[key]));
RDB.set('email:' + email +':uid', uid);
RDB.set('email:' + data['email'] +':uid', uid);
}
}
}

Loading…
Cancel
Save