Test replacing those?
This commit is contained in:
parent
c7874c19a6
commit
7c6a99b6a6
|
@ -4,9 +4,67 @@ const db = global.db;
|
|||
const router = express.Router();
|
||||
const expressWs = require('express-ws')(router);
|
||||
// GET /login
|
||||
|
||||
dataTypes = {
|
||||
DoorMode: {
|
||||
1: 'NormallyOpen',
|
||||
2: 'NormallyClosed',
|
||||
3: 'Controlled'
|
||||
},
|
||||
|
||||
Direction: {
|
||||
1: 'In',
|
||||
2: 'Out'
|
||||
},
|
||||
EventType: {
|
||||
0: 'None',
|
||||
1: 'Swipe',
|
||||
2: 'Door',
|
||||
3: 'Alarm',
|
||||
255: 'Overwritten'
|
||||
},
|
||||
|
||||
EventReason: {
|
||||
0: 'None',
|
||||
1: 'Swipe',
|
||||
2: 'SwipeOpen',
|
||||
3: 'SwipeClose',
|
||||
5: 'Denied',
|
||||
6: 'NoAccessRights',
|
||||
7: 'IncorrectPassword',
|
||||
8: 'AntiPassback',
|
||||
9: 'MoreCards',
|
||||
10: 'FirstCardOpen',
|
||||
11: 'DoorIsNormallyClosed',
|
||||
12: 'Interlock',
|
||||
13: 'NotInAllowedTimePeriod',
|
||||
15: 'InvalidTimezone',
|
||||
18: 'AccessDenied',
|
||||
20: 'PushbuttonOk',
|
||||
23: 'DoorOpened',
|
||||
24: 'DoorClosed',
|
||||
25: 'DoorOpenedSupervisorPassword',
|
||||
28: 'ControllerPowerOn',
|
||||
29: 'ControllerReset',
|
||||
31: 'PushbuttonInvalidDoorLocked',
|
||||
32: 'PushbuttonInvalidOffline',
|
||||
33: 'PushbuttonInvalidInterlock',
|
||||
34: 'PushbuttonInvalidThreat',
|
||||
37: 'DoorOpenTooLong',
|
||||
38: 'ForcedOpen',
|
||||
39: 'Fire',
|
||||
40: 'ForcedClosed',
|
||||
41: 'TheftPrevention',
|
||||
42: 'Zone24x7',
|
||||
43: 'Emergency',
|
||||
44: 'RemoteOpenDoor',
|
||||
45: 'RemoteOpenDoorUSBReader'
|
||||
}
|
||||
}
|
||||
|
||||
router.get('/', async (req, res) => {
|
||||
const logs = await db.query('SELECT * FROM Events ORDER BY EventIndex DESC LIMIT 100');
|
||||
res.render('event-logs', { logs, user: req.session.user });
|
||||
res.render('event-logs', { logs, user: req.session.user, dataTypes });
|
||||
});
|
||||
|
||||
router.ws('/', (ws, req) => {
|
||||
|
|
|
@ -79,7 +79,7 @@
|
|||
<th>Granted</th>
|
||||
<th>Door</th>
|
||||
<th>Direction</th>
|
||||
<th>Card Number</th>
|
||||
<th>Data</th>
|
||||
<th>Reason</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -102,12 +102,12 @@
|
|||
%>
|
||||
<%= `${yyyy}-${mm}-${dd} ${HH}:${MM}:${ss} ${tz}` %>
|
||||
</td>
|
||||
<td><%= log.Type %></td>
|
||||
<td><%= log.Granted %></td>
|
||||
<td><%= dataTypes.EventType[log.Type] %></td>
|
||||
<td><%= log.Granted ? "True" : "False" %></td>
|
||||
<td><%= log.Door %></td>
|
||||
<td><%= log.Direction %></td>
|
||||
<td><%= dataTypes.Direction[log.Direction] %></td>
|
||||
<td><%= log.CardNumber %></td>
|
||||
<td><%= log.Reason %></td>
|
||||
<td><%= dataTypes.EventReason[log.Reason] %></td>
|
||||
</tr>
|
||||
<% }); %>
|
||||
</tbody>
|
||||
|
|
Loading…
Reference in a new issue