From a951f16494136ff200537dc0e12ec3808fc32346 Mon Sep 17 00:00:00 2001 From: rakbaal Date: Wed, 16 Feb 2022 11:48:18 +0200 Subject: [PATCH] Add iteration through screenshot array in frontend/src/component/Event.js --- backend/server.js | 4 ++-- docker-compose.yml | 2 +- frontend/src/components/event/Event.js | 12 +++++++++++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/backend/server.js b/backend/server.js index 1083343..9186037 100644 --- a/backend/server.js +++ b/backend/server.js @@ -11,7 +11,7 @@ const mongoUri = process.env.MONGO_URI || 'mongodb://127.0.0.1:27017/default?rep const minioURI = new URL(process.env.MINIO_URI || 'http://kspace-mugshot:2mSI6HdbJ8@127.0.0.1:9000/kspace-mugshot'); const minioBucket = minioURI.pathname.substring(1); console.info("Using bucket:", minioBucket); -const historyNumber = parseInt(process.env.HISTORY_AMOUNT) || 1000; +const historyNumber = parseInt(process.env.HISTORY_AMOUNT) || 10; // Stream set-up variables let changeStream; @@ -39,7 +39,7 @@ async function run() { app.get('/events', async function (request, response) { let minioClient = new minio.Client({ endPoint: minioURI.hostname, - port: parseInt(minioURI.port) || (minioURI.protocol == 'https' ? 443 : 80), + port: parseInt(minioURI.port) || (minioURI.protocol == 'https:' ? 443 : 80), useSSL: minioURI.protocol == 'https:', accessKey: minioURI.username, secretKey: minioURI.password diff --git a/docker-compose.yml b/docker-compose.yml index f1e8ff5..e49eb50 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,7 +12,7 @@ x-common: &common MINIO_ACCESS_KEY: kspace-mugshot MINIO_SECRET_KEY: 2mSI6HdbJ8 MINIO_DEFAULT_BUCKETS: kspace-mugshot:download - MINIO_URI: 'https://kspace-mugshot:2mSI6HdbJ8@127.0.0.1:9000/kspace-mugshot' + MINIO_URI: 'http://kspace-mugshot:2mSI6HdbJ8@127.0.0.1:9000/kspace-mugshot' services: diff --git a/frontend/src/components/event/Event.js b/frontend/src/components/event/Event.js index 32ca0ac..c9d086c 100644 --- a/frontend/src/components/event/Event.js +++ b/frontend/src/components/event/Event.js @@ -3,9 +3,19 @@ import "./Event.css"; function Event(props) { + let imgArray = []; + + if (props.data.hasOwnProperty('screenshots')) { + props.data.screenshots.forEach(element => { + imgArray = [(), ...imgArray] + }); + } + return (
- {props.screenshots ? : JSON.stringify(props)} + {JSON.stringify(props.data)} +

+ {[...imgArray]}
); }