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.
50 lines
1.2 KiB
50 lines
1.2 KiB
// admin/service-node.js
|
|
// Copyright (C) 2022 DTP Technologies, LLC
|
|
// License: Apache-2.0
|
|
|
|
'use strict';
|
|
|
|
const express = require('express');
|
|
|
|
const { SiteController } = require('../../../lib/site-lib');
|
|
|
|
class ServiceNodeController 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 = 'service-node';
|
|
return next();
|
|
});
|
|
|
|
router.get('/', this.getIndex.bind(this));
|
|
|
|
return router;
|
|
}
|
|
|
|
async getIndex (req, res, next) {
|
|
const { oauth2: oauth2Service } = this.dtp.services;
|
|
try {
|
|
res.locals.pagination = this.getPaginationParameters(req, 20);
|
|
res.locals.serviceNodes = await oauth2Service.getClients({ }, res.locals.pagination);
|
|
res.render('admin/service-node/index');
|
|
} catch (error) {
|
|
this.log.error('failed to render Service Node home', { error });
|
|
return next(error);
|
|
}
|
|
}
|
|
}
|
|
|
|
module.exports = {
|
|
name: 'Admin: Service Node',
|
|
slug: 'admin:service-node',
|
|
create: async (dtp) => {
|
|
let controller = new ServiceNodeController(dtp);
|
|
return controller;
|
|
},
|
|
};
|