diff --git a/Dockerfile b/Dockerfile index 9eeeebaf45634dfd21cc097ad8253e1e8d524c09..11a753a4276d8d22a55b22b841675573a5253a6d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,6 +14,7 @@ ADD vospace-ui-frontend/*.js /vospace-ui-frontend/ ADD vospace-ui-frontend/*.json /vospace-ui-frontend/ ADD vospace-ui-frontend/.env.production /vospace-ui-frontend/ WORKDIR /vospace-ui-frontend +ARG VUE_APP_MAX_UPLOAD_SIZE=10 RUN npm run build ADD vospace-ui-backend/src /vospace-ui-backend/src/ diff --git a/vospace-ui-frontend/.env.development b/vospace-ui-frontend/.env.development index b4b1787f8fc876c82213c6344e414c0329d867d2..a30a4d96369110b6df3b2de45df582b55e5347bc 100644 --- a/vospace-ui-frontend/.env.development +++ b/vospace-ui-frontend/.env.development @@ -1,2 +1,3 @@ VUE_APP_API_CLIENT = 'mock' VUE_APP_API_BASE_URL = 'http://localhost:8085/' +VUE_APP_MAX_UPLOAD_SIZE = 10 diff --git a/vospace-ui-frontend/.env.production b/vospace-ui-frontend/.env.production index 6010f55022316c82ff11bfeeb216720afd9614ea..d05173e0338d9aade49e0d25db82df7e981b7f74 100644 --- a/vospace-ui-frontend/.env.production +++ b/vospace-ui-frontend/.env.production @@ -1,2 +1,3 @@ VUE_APP_API_CLIENT = 'server' VUE_APP_API_BASE_URL = '' +VUE_APP_MAX_UPLOAD_SIZE = 10 diff --git a/vospace-ui-frontend/src/components/modal/UploadFilesModal.vue b/vospace-ui-frontend/src/components/modal/UploadFilesModal.vue index 8d9ca50161a84c3113923a598391a01e3862c1a0..17d68b19e2138ac76e0a1c63e108d8659ec6a5fb 100644 --- a/vospace-ui-frontend/src/components/modal/UploadFilesModal.vue +++ b/vospace-ui-frontend/src/components/modal/UploadFilesModal.vue @@ -10,7 +10,10 @@ <div class="mt-3">Selected files: {{ selectedFiles }}</div> </b-modal> </template> + <script> +const maxUploadSize = process.env.VUE_APP_MAX_UPLOAD_SIZE; + export default { data() { return { @@ -56,6 +59,15 @@ export default { } } + // Check size limit + for (let file of this.files) { + if (file.size >= maxUploadSize * Math.pow(10, 9)) { + this.uploadFileError = "File " + file.name + " is too big. Max allowed file size is " + maxUploadSize + " GB"; + return; + } + } + + // Upload this.$store.dispatch('uploadFiles', this.files) .then(() => { this.$bvModal.hide('upload-files-modal');