@ -22,6 +22,7 @@
"mongo.bytes-out": "Bytes Out",
"mongo.num-requests": "Number of Requests",
"mongo.raw-info": "MongoDB Raw Info",
"mongo.unauthorized": "NodeBB was unable to query the MongoDB database for relevant statistics. Please ensure that the user in use by NodeBB contains the "clusterMonitor" role for the "admin" database.",
"redis": "Redis",
"redis.version": "Redis Version",
@ -5,7 +5,7 @@ var nconf = require('nconf');
var databaseController = module.exports;
databaseController.get = function (req, res, next) {
databaseController.get = function (req, res) {
async.waterfall([
function (next) {
async.parallel({
@ -35,8 +35,15 @@ databaseController.get = function (req, res, next) {
},
}, next);
function (results) {
res.render('admin/advanced/database', results);
], next);
], function (err, results) {
Object.assign(results, { error: err });
// Override mongo error with more human-readable error
if (err.name === 'MongoError' && err.codeName === 'Unauthorized') {
err.friendlyMessage = '[[admin/advanced/database:mongo.unauthorized]]';
delete results.mongo;
}
});
};
@ -1,5 +1,12 @@
<div class="row database">
<div class="col-sm-9">
<!-- IF error -->
<div class="alert alert-warning">
{error.friendlyMessage}
<hr />
<code>{error.errmsg}</code>
</div>
<!-- END -->
<!-- IF mongo -->
<div class="panel panel-default">
<div class="panel-heading"><i class="fa fa-hdd-o"></i> [[admin/advanced/database:mongo]]</div>