The Digital Telepresence Platform core implementing user account management, authentication, search, global directory, and other platform-wide services. https://digitaltelepresence.com/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

60 lines
1.4 KiB

// admin/log.js
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';
const express = require('express');
const { SiteController } = require('../../../lib/site-lib');
class LogController extends SiteController {
constructor (dtp) {
super(dtp, module.exports);
}
async start ( ) {
const router = express.Router();
router.use(async (req, res, next) => {
res.locals.currentView = 'admin';
res.locals.adminView = 'log';
return next();
});
router.get('/', this.getIndex.bind(this));
return router;
}
async getIndex (req, res, next) {
const { log: logService } = this.dtp.services;
try {
res.locals.query = req.query;
res.locals.components = await logService.getComponentSlugs();
res.locals.pagination = this.getPaginationParameters(req, 25);
const search = { };
if (req.query.component) {
search.component = { slug: req.query.component };
}
res.locals.logs = await logService.getRecords(search, res.locals.pagination);
res.locals.totalLogCount = await logService.getTotalCount();
res.render('admin/log/index');
} catch (error) {
return next(error);
}
}
}
module.exports = {
name: 'Admin: Log',
slug: 'admin:log',
create: async (dtp) => {
let controller = new LogController(dtp);
return controller;
},
};