Browse Source

Fix comment indetaion levels after converting to tabs

xo
Luke Childs 8 years ago
parent
commit
c1c48791db
  1. 18
      lib/nunjucks-filters.js

18
lib/nunjucks-filters.js

@ -28,34 +28,34 @@ function humanTimeAgo(utcDate) {
const filters = { const filters = {
bandwidth: node => `${prettyBytes(node.advertised_bandwidth)}/s`, bandwidth: node => `${prettyBytes(node.advertised_bandwidth)}/s`,
uptime: node => { uptime: node => {
// Check node is up // Check node is up
if (!node.running) { if (!node.running) {
return 'Down'; return 'Down';
} }
// Check uptime // Check uptime
return humanTimeAgo(node.last_restarted); return humanTimeAgo(node.last_restarted);
}, },
pagination: (req, direction) => { pagination: (req, direction) => {
// Clone query string // Clone query string
const query = Object.assign({}, req.query); const query = Object.assign({}, req.query);
// Set page as 1 by default // Set page as 1 by default
query.p = query.p ? query.p : 1; query.p = query.p ? query.p : 1;
// Update page // Update page
if (direction === 'next') { if (direction === 'next') {
query.p++; query.p++;
} else if (direction === 'prev') { } else if (direction === 'prev') {
query.p--; query.p--;
} }
// Don't add p var if it's page 1 // Don't add p var if it's page 1
if (query.p === 1) { if (query.p === 1) {
delete query.p; delete query.p;
} }
// Encode query string // Encode query string
const queryString = querystring.encode(query); const queryString = querystring.encode(query);
return queryString ? `/?${queryString}` : '/'; return queryString ? `/?${queryString}` : '/';
}, },
@ -69,8 +69,8 @@ const filters = {
return name; return name;
}, },
status: node => node.running ? status: node => node.running ?
`Up for ${humanTimeAgo(node.last_restarted)}` : `Up for ${humanTimeAgo(node.last_restarted)}` :
`Down for ${humanTimeAgo(node.last_seen)}` `Down for ${humanTimeAgo(node.last_seen)}`
}; };
module.exports = app => Object.keys(filters).forEach(filter => { module.exports = app => Object.keys(filters).forEach(filter => {

Loading…
Cancel
Save