diff --git a/index.js b/index.js index 93aa6ef..f7d9994 100644 --- a/index.js +++ b/index.js @@ -171,8 +171,8 @@ function renderConfigAskDelete(req, res) { }); } -function renderDashboardIndex(req, res) { - var template = "dashboard.index.html"; +function renderRuntimeInfo(req, res) { + var template = "runtime-info.html"; var os_info = { uptime: os.uptime(), @@ -185,13 +185,21 @@ function renderDashboardIndex(req, res) { totalmem: os.totalmem(), } + var pendings; + try { + pendings = JSON.stringify(aaa.getPendingList(), null, 2); + } + catch(err) { + pendings = "{}"; + } + res.render(template, { gateway_name: config.globals.gateway_name, - title: 'Dashboard', + title: 'Runtime Info', matrix: JSON.stringify(matrix, null, 2), config: JSON.stringify(config, null, 2), nodejs_versions: JSON.stringify(process.versions, null, 2), - pendings: JSON.stringify(aaa.getPendingList(), null, 2), + pendings: pendings, memory_usage: JSON.stringify(process.memoryUsage(), null, 2), uptime: process.uptime(), os_info: JSON.stringify(os_info, null, 2), @@ -268,10 +276,10 @@ function createServer() { done(null, user); }); - app.get('/', loggedIn, function(req, res) { res.redirect('/dashboard'); }); + app.get('/', loggedIn, function(req, res) { res.redirect('/runtime-info'); }); app.get('/config', loggedIn, renderConfigIndex); app.get('/login', renderLoginPage); - app.post('/login', passport.authenticate('local', { successRedirect: '/dashboard', failureRedirect: '/login' })); + app.post('/login', passport.authenticate('local', { successRedirect: '/', failureRedirect: '/login' })); app.get('/logout', function(req, res){ req.logout(); res.redirect('/login'); @@ -302,7 +310,7 @@ function createServer() { app.get('/resume', loggedIn, submitResume); app.get('/terminate', loggedIn, submitTerminate); - app.get('/dashboard', loggedIn, renderDashboardIndex); + app.get('/runtime-info', loggedIn, renderRuntimeInfo); var server = app.listen(config.expresso.listen_port, function () { var host = server.address().address; diff --git a/views/dashboard.index.html b/views/dashboard.index.html deleted file mode 100644 index f4b8a48..0000000 --- a/views/dashboard.index.html +++ /dev/null @@ -1,31 +0,0 @@ -{% extends "layout-with-topbar.html" %} - -{% block content %} - -<p> - Process uptime: {{ uptime }} seconds -</p> - -<h2 id="matrix">The Matrix</h2> -<pre>{{ matrix }}</pre> - -<h2 id="pendings">Pending Transactions</h2> -<pre>{{ pendings }}</pre> - - -<h2 id="config">Config</h2> -<pre>{{ config }}</pre> - -<h2 id="memory">Memory Usage</h2> -<pre>{{ memory_usage }}</pre> - -<h2 id="nodejs_versions">Node.js Versions</h2> -<pre>{{ nodejs_versions }}</pre> - -<h2 id="os_info">OS</h2> -<pre>{{ os_info }}</pre> - -<h2 id="net_iface">Network Interfaces</h2> -<pre>{{ net_ifaces }}</pre> - -{% endblock %} diff --git a/views/layout-with-topbar.html b/views/layout-with-topbar.html index 29840e1..1ac8b0f 100644 --- a/views/layout-with-topbar.html +++ b/views/layout-with-topbar.html @@ -40,8 +40,8 @@ <div id="navbar" class="collapse navbar-collapse"> <ul class="nav navbar-nav"> <li><a href="/">Home</a></li> - <li><a href="/dashboard">Dashboard</a></li> <li><a href="/config">Config</a></li> + <li><a href="/runtime-info">Runtime</a></li> <li><a href="/logout">Logout</a></li> </ul> </div><!--/.nav-collapse -->