From d636298e452a3b649f40ab82be6888920601974b Mon Sep 17 00:00:00 2001 From: Virginia Friedrich Date: Mon, 22 Feb 2021 16:01:09 +0100 Subject: [PATCH] with message for files bigger than 100mb --- client/docker-entrypoint.sh | 2 ++ client/run-telepresence.sh | 2 ++ client/src/project/datasets/ProjectDatasets.test.js | 1 + .../datasets/change/DatasetChange.container.js | 1 + .../utils/formgenerator/fields/FileUploaderInput.js | 11 +++++++++-- helm-chart/renku-ui/templates/deployment.yaml | 2 ++ helm-chart/renku-ui/values.yaml | 5 +++++ 7 files changed, 22 insertions(+), 2 deletions(-) diff --git a/client/docker-entrypoint.sh b/client/docker-entrypoint.sh index 86b2c5be39..4be74adcab 100755 --- a/client/docker-entrypoint.sh +++ b/client/docker-entrypoint.sh @@ -32,6 +32,7 @@ echo " PRIVACY_BANNER_CONTENT=${PRIVACY_BANNER_CONTENT}" echo " PRIVACY_BANNER_LAYOUT=${PRIVACY_BANNER_LAYOUT}" echo " TEMPLATES=${TEMPLATES}" echo " PREVIEW_THRESHOLD=${PREVIEW_THRESHOLD}" +echo " UPLOAD_THRESHOLD=${UPLOAD_THRESHOLD}" echo " STATUSPAGE_ID=${STATUSPAGE_ID}" echo "===================================================" @@ -55,6 +56,7 @@ tee > "${NGINX_PATH}/config.json" << EOF "PRIVACY_BANNER_LAYOUT": ${PRIVACY_BANNER_LAYOUT}, "TEMPLATES": ${TEMPLATES}, "PREVIEW_THRESHOLD": ${PREVIEW_THRESHOLD}, + "UPLOAD_THRESHOLD": ${UPLOAD_THRESHOLD}, "STATUSPAGE_ID": "${STATUSPAGE_ID}" } EOF diff --git a/client/run-telepresence.sh b/client/run-telepresence.sh index 6161b13a9f..08c069bd41 100755 --- a/client/run-telepresence.sh +++ b/client/run-telepresence.sh @@ -28,6 +28,7 @@ TEMPLATES='{"custom":true,"repositories": {"name":"Telepresence","ref":"0.1.11", "url":"https://github.com/SwissDataScienceCenter/renku-project-template"}]}' PREVIEW_THRESHOLD='{"soft":"1048576","hard":"10485760"}' +UPLOAD_THRESHOLD='{"hard":"104857600"}' CURRENT_CHART=`grep -oE "(^version: )[.0-9a-f\-]*" ../helm-chart/renku-ui/Chart.yaml | cut -d" " -f2` CURRENT_COMMIT=`git rev-parse --short HEAD` if [[ "$OSTYPE" == "linux-gnu" ]] @@ -112,6 +113,7 @@ tee > ./public/config.json << EOF "PRIVACY_ENABLED": "false", "TEMPLATES": ${TEMPLATES}, "PREVIEW_THRESHOLD": ${PREVIEW_THRESHOLD}, + "UPLOAD_THRESHOLD": ${UPLOAD_THRESHOLD}, "STATUSPAGE_ID": "${STATUSPAGE_ID}" } EOF diff --git a/client/src/project/datasets/ProjectDatasets.test.js b/client/src/project/datasets/ProjectDatasets.test.js index 1369a08ffb..64b4741386 100644 --- a/client/src/project/datasets/ProjectDatasets.test.js +++ b/client/src/project/datasets/ProjectDatasets.test.js @@ -99,6 +99,7 @@ describe("rendering", () => { model={model} user={loggedUser} location={fakeHistory} + params={{ UPLOAD_THRESHOLD: { hard: 104857600 } }} /> , div); diff --git a/client/src/project/datasets/change/DatasetChange.container.js b/client/src/project/datasets/change/DatasetChange.container.js index c9c09ef495..41ff8a04b8 100644 --- a/client/src/project/datasets/change/DatasetChange.container.js +++ b/client/src/project/datasets/change/DatasetChange.container.js @@ -69,6 +69,7 @@ function ChangeDataset(props) { if (!fileField.uploadFileFunction) fileField.uploadFileFunction = props.client.uploadFile; + fileField.uploadThresholdHard = props.params.UPLOAD_THRESHOLD ? props.params.UPLOAD_THRESHOLD.hard : 104857600; if (!fileField.notifyFunction) { fileField.notifyFunction = (success = true, error) => { diff --git a/client/src/utils/formgenerator/fields/FileUploaderInput.js b/client/src/utils/formgenerator/fields/FileUploaderInput.js index 76635e359d..cb38e5f92d 100644 --- a/client/src/utils/formgenerator/fields/FileUploaderInput.js +++ b/client/src/utils/formgenerator/fields/FileUploaderInput.js @@ -25,6 +25,7 @@ import React, { useState, useEffect, useRef } from "react"; import { FormGroup, Table, Button, UncontrolledCollapse, Card, CardBody, Input, InputGroup, InputGroupAddon, Progress } from "reactstrap"; +import { Link } from "react-router-dom"; import ValidationAlert from "./ValidationAlert"; import HelpText from "./HelpText"; import FormLabel from "./FormLabel"; @@ -92,7 +93,7 @@ function getFileObject(name, path, size, id, error, alias, controller, uncompres } function FileUploaderInput({ name, label, alert, value, setInputs, help, disabled = false, - uploadFileFunction, required = false, internalValues, handlers, formLocation, notifyFunction }) { + uploadFileFunction, required = false, internalValues, handlers, formLocation, notifyFunction, uploadThresholdHard }) { //send value as an already built tree/hash to display and @@ -514,7 +515,13 @@ function FileUploaderInput({ name, label, alert, value, setInputs, help, disable ; } - return {file.file_status}%; + return + {file.file_status}% + {file.file_size >= uploadThresholdHard ? + No need to wait. We will + notify you when the upload is finished. + : null } + ; } }; diff --git a/helm-chart/renku-ui/templates/deployment.yaml b/helm-chart/renku-ui/templates/deployment.yaml index bcfdb3ee47..fe46df3108 100644 --- a/helm-chart/renku-ui/templates/deployment.yaml +++ b/helm-chart/renku-ui/templates/deployment.yaml @@ -81,6 +81,8 @@ spec: value: {{ toJson .Values.templates | quote }} - name: PREVIEW_THRESHOLD value: {{ toJson .Values.previewSizeThreshold | quote }} + - name: UPLOAD_THRESHOLD + value: {{ toJson .Values.uploadSizeThreshold | quote }} - name: UI_VERSION value: {{ .Chart.Version | quote }} livenessProbe: diff --git a/helm-chart/renku-ui/values.yaml b/helm-chart/renku-ui/values.yaml index 05c7351d5b..280e163381 100644 --- a/helm-chart/renku-ui/values.yaml +++ b/helm-chart/renku-ui/values.yaml @@ -71,6 +71,11 @@ previewSizeThreshold: soft: 1048576 # 1MB hard: 10485760 # 10MB +# This defines the threshold for displaying a message when a user is trying to upload a large file +# so that they know it's not necessary to wait for this. There is only hard limit for now. +uploadSizeThreshold: + hard: 104857600 # 100MB + # Any string here, other than 'false', will enable the maintenance page and be added on it as an info. # Setting 'true' will display a standard message embedded in maintenace page. maintenance: false