mirror of
https://github.com/smartyellow/status.git
synced 2025-06-28 04:35:11 +00:00
Dashboard works properly now
Signed-off-by: Romein van Buren <romein@vburen.nl>
This commit is contained in:
@ -16,21 +16,6 @@ async function createDashboardSocket(server) {
|
||||
uws = server.ws({
|
||||
route: '/statusdashboard/socket',
|
||||
onOpen: async ws => {
|
||||
function sendTime() {
|
||||
try {
|
||||
ws.send(JSON.stringify({
|
||||
cmd: 'time',
|
||||
time: new Date().getTime(),
|
||||
}));
|
||||
}
|
||||
catch {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
sendTime();
|
||||
setInterval(sendTime, 5000);
|
||||
|
||||
async function sendStatuses() {
|
||||
const services = await server.storage
|
||||
.store('smartyellow/webservice')
|
||||
@ -62,12 +47,19 @@ async function createDashboardSocket(server) {
|
||||
}
|
||||
}
|
||||
|
||||
const total = [
|
||||
...servicesUp,
|
||||
...servicesDown,
|
||||
...servicesUnknown,
|
||||
].length;
|
||||
|
||||
try {
|
||||
ws.send(JSON.stringify({
|
||||
cmd: 'data',
|
||||
servicesUp,
|
||||
servicesDown,
|
||||
servicesUnknown,
|
||||
total,
|
||||
}));
|
||||
}
|
||||
catch {
|
||||
|
Reference in New Issue
Block a user