Fix log-viewer ignoring screenshotless events
continuous-integration/drone Build is passing Details

This commit is contained in:
Léo Carpentier 2022-02-17 10:25:36 +02:00
parent 066474190d
commit 6370a37e5a
2 changed files with 9 additions and 8 deletions

View File

@ -46,15 +46,18 @@ async function run() {
}); });
async function wrapEvent(doc) { async function wrapEvent(doc) {
let newDoc; let screenShotArray = [];
let blob;
if (doc && doc.screenshot_count) { if (doc && doc.screenshot_count) {
newDoc = {...doc, screenshots: []}
for (let i = 1; i <= doc.screenshot_count ; i++) { for (let i = 1; i <= doc.screenshot_count ; i++) {
let presignedUrl = await minioClient.presignedUrl('GET', minioBucket, `${doc.camera}/${doc._id}/${i}.jpg`, 60 * 60); let presignedUrl = await minioClient.presignedUrl('GET', minioBucket, `${doc.camera}/${doc._id}/${i}.jpg`, 60 * 60);
newDoc.screenshots.push({ url: presignedUrl }); screenShotArray.push({ url: presignedUrl });
} }
blob = JSON.stringify({...doc, ...screenShotArray});
} else {
blob = JSON.stringify({...doc})
}; };
let blob = JSON.stringify(newDoc);
return `event: log-entry\ndata: ${blob}\n\n` return `event: log-entry\ndata: ${blob}\n\n`
} }

View File

@ -2,14 +2,12 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" /> <meta name="theme-color" content="#000000" />
<meta <meta
name="description" name="Event logging"
content="Web site created using create-react-app" content="Web site created using create-react-app"
/> />
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!-- <!--
manifest.json provides metadata used when your web app is installed on a manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/ user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
@ -24,7 +22,7 @@
work correctly both with client-side routing and a non-root public URL. work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`. Learn how to configure a non-root public URL by running `npm run build`.
--> -->
<title>React App</title> <title>Event log</title>
</head> </head>
<body> <body>
<noscript>You need to enable JavaScript to run this app.</noscript> <noscript>You need to enable JavaScript to run this app.</noscript>