Cleaned up formatting

This commit is contained in:
2020-06-07 23:58:40 +02:00
committed by KevinMidboe
parent 89d4148a2c
commit d1963ea728
2 changed files with 13 additions and 23 deletions

View File

@@ -4,7 +4,11 @@ const fs = require('fs');
const app = express()
const config = require('../config')
const { getAllEvents, getEventById, getAlternatingEventStatuses, getEventStatus } = require('./db.js');
const { getAllEvents,
getEventById,
getAlternatingEventStatuses,
getEventStatus
} = require('./db.js');
const PORT = 3000;
@@ -14,22 +18,22 @@ app.get('/', (req, res) => res.sendFile('index.html'));
// Data api endpoints
app.get('/logs', (req, res) =>
app.get('/logs', (req, res) =>
getAllEvents()
.then(allEvents => res.send(allEvents))
)
app.get('/logs/alternating', (req, res) =>
app.get('/logs/alternating', (req, res) =>
getAlternatingEventStatuses()
.then(allEvents => res.send(allEvents))
)
app.get('/logs/:id', (req, res) =>
app.get('/logs/:id', (req, res) =>
getEventById(req.params.id)
.then(event => res.send(event))
)
app.get('/uptime', (req, res) =>
app.get('/uptime', (req, res) =>
getEventStatus()
.then(eventStatuses => res.send(eventStatuses))
)

View File

@@ -7,9 +7,9 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/fetch/3.0.0/fetch.min.js"></script>
</head>
<body>
<h1>Nedetid rapport</h1>
<h1>Downtime monitor</h1>
<div class="page-container">
<h2>Oppetid</h2>
<h2>Uptime</h2>
<div class="container" id="bar-graph">
<!-- BAR GRAPH -->
</div>
@@ -23,7 +23,7 @@
</div>
<hr />
<h2>Indicent log</h2>
<h2>Indicent logs</h2>
<div class="container" id="indicent-logs">
<table id="log-table">
<thead><tr>
@@ -32,21 +32,7 @@
<th>Duration</th>
</tr></thead>
<tbody><tr>
<td>31 Mai 2020 22:34</td>
<td>OK</td>
<td>6d 4t 32min</td>
</tr>
<tr>
<td>31 Mai 2020 22:34</td>
<td>OK</td>
<td>6d 4t 32min</td>
</tr>
<tr>
<td>31 Mai 2020 22:34</td>
<td>OK</td>
<td>6d 4t 32min</td>
</tr></tbody>
<tbody></tbody>
</table>
</div>