From 66f1aa8888835a2bea6d470fc159ed66018531b5 Mon Sep 17 00:00:00 2001 From: mattwr18 Date: Tue, 3 Dec 2019 15:33:54 +0100 Subject: [PATCH] Follow @roschaefer PR review suggestions - Update seed file with more human readable imageAspectRatios - Remove copy script from Dockerfile to not expose to others. we'll need to either start a maintenance server, so it has access to both the backend/public/uploads and cypher-shell, or copy a script to the backend that creates a csv, which can be copied to the neo4j pod and then loaded into the cypher. - Remove unintended changes to deployment/legacy-migration - Add back image compression to Post images --- backend/Dockerfile | 1 - backend/src/seed/seed-db.js | 18 +++++++++--------- .../maintenance-worker/migration/mongo/.env | 2 +- .../migration/neo4j/import.sh | 1 - webapp/components/TeaserImage/TeaserImage.vue | 2 +- 5 files changed, 11 insertions(+), 13 deletions(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index cfaecac9e..3dae08143 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -25,5 +25,4 @@ ENV NODE_ENV=production COPY --from=build-and-test /nitro-backend/dist ./dist COPY ./public/img/ ./public/img/ COPY ./public/providers.json ./public/providers.json -COPY ./public/add_image_aspect_ratio.sh ./public/add_image_aspect_ratio.sh RUN yarn install --production=true --frozen-lockfile --non-interactive --no-cache diff --git a/backend/src/seed/seed-db.js b/backend/src/seed/seed-db.js index 944dca0c2..4040d7449 100644 --- a/backend/src/seed/seed-db.js +++ b/backend/src/seed/seed-db.js @@ -352,7 +352,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] language: sample(languages), image: faker.image.unsplash.food(300, 169), categoryIds: ['cat16'], - imageAspectRatio: 1.777, + imageAspectRatio: 300 / 169, }), factory.create('Post', { author: bobDerBaumeister, @@ -360,7 +360,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] language: sample(languages), image: faker.image.unsplash.technology(300, 1500), categoryIds: ['cat1'], - imageAspectRatio: 0.2, + imageAspectRatio: 300 / 1500, }), factory.create('Post', { author: huey, @@ -386,7 +386,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] language: sample(languages), image: faker.image.unsplash.buildings(300, 857), categoryIds: ['cat6'], - imageAspectRatio: 0.35, + imageAspectRatio: 300 / 857, }), factory.create('Post', { author: huey, @@ -405,7 +405,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] language: sample(languages), image: faker.image.unsplash.people(300, 901), categoryIds: ['cat11'], - imageAspectRatio: 0.333, + imageAspectRatio: 300 / 901, }), factory.create('Post', { author: bobDerBaumeister, @@ -419,7 +419,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] language: sample(languages), image: faker.image.unsplash.objects(300, 200), categoryIds: ['cat14'], - imageAspectRatio: 1.5, + imageAspectRatio: 300 / 450, }), factory.create('Post', { author: huey, @@ -466,7 +466,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] title: `Nature Philosophy Yoga`, content: hashtag1, categoryIds: ['cat2'], - imageAspectRatio: 0.66, + imageAspectRatio: 300 / 200, }, }), mutate({ @@ -476,7 +476,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] title: 'This is post #7', content: `${mention1} ${faker.lorem.paragraph()}`, categoryIds: ['cat7'], - imageAspectRatio: 1.66, + imageAspectRatio: 300 / 180, }, }), mutate({ @@ -487,7 +487,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] title: `Quantum Flow Theory explains Quantum Gravity`, content: hashtagAndMention1, categoryIds: ['cat8'], - imageAspectRatio: 0.3, + imageAspectRatio: 300 / 900, }, }), mutate({ @@ -497,7 +497,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] title: 'This is post #12', content: `${mention2} ${faker.lorem.paragraph()}`, categoryIds: ['cat12'], - imageAspectRatio: 1.5, + imageAspectRatio: 300 / 200, }, }), ]) diff --git a/deployment/legacy-migration/maintenance-worker/migration/mongo/.env b/deployment/legacy-migration/maintenance-worker/migration/mongo/.env index e1f0bcdcf..376cb56d0 100644 --- a/deployment/legacy-migration/maintenance-worker/migration/mongo/.env +++ b/deployment/legacy-migration/maintenance-worker/migration/mongo/.env @@ -12,6 +12,6 @@ # On Windows this resolves to C:\Users\dornhoeschen\AppData\Local\Temp\mongo-export (MinGW) EXPORT_PATH='/tmp/mongo-export/' EXPORT_MONGOEXPORT_BIN='mongoexport' -MONGO_EXPORT_SPLIT_SIZE=500000 +MONGO_EXPORT_SPLIT_SIZE=6000 # On Windows use something like this # EXPORT_MONGOEXPORT_BIN='C:\Program Files\MongoDB\Server\3.6\bin\mongoexport.exe' diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/import.sh b/deployment/legacy-migration/maintenance-worker/migration/neo4j/import.sh index bdb27a5f2..ccb22dafb 100755 --- a/deployment/legacy-migration/maintenance-worker/migration/neo4j/import.sh +++ b/deployment/legacy-migration/maintenance-worker/migration/neo4j/import.sh @@ -39,7 +39,6 @@ function import_collection () { echo "Import $1 ${CHUNK_FILE_NAME} (${chunk})" echo "${NEO4J_COMMAND}" | "${IMPORT_CYPHERSHELL_BIN}" > /dev/null # add file to array and file - echo "$IMPORT_CHUNK_PATH_CQL_FILE" IMPORT_INDEX+=("${CHUNK_FILE_NAME}") echo "${CHUNK_FILE_NAME}" >> ${INDEX_FILE} else diff --git a/webapp/components/TeaserImage/TeaserImage.vue b/webapp/components/TeaserImage/TeaserImage.vue index 327176c5b..95d94d70f 100644 --- a/webapp/components/TeaserImage/TeaserImage.vue +++ b/webapp/components/TeaserImage/TeaserImage.vue @@ -118,7 +118,7 @@ export default { const croppedImageFile = new File([blob], this.file.name, { type: this.file.type }) this.$emit('addTeaserImage', croppedImageFile) this.$emit('addImageAspectRatio', imageAspectRatio) - }) + }, 'image/jpeg') }, setupPreview(canvas) { this.image = new Image()