Skip to content

Commit

Permalink
with message for files bigger than 100mb
Browse files Browse the repository at this point in the history
  • Loading branch information
vfried committed Feb 26, 2021
1 parent 9ca55ce commit d636298
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 2 deletions.
2 changes: 2 additions & 0 deletions client/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 "==================================================="

Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions client/run-telepresence.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]]
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions client/src/project/datasets/ProjectDatasets.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ describe("rendering", () => {
model={model}
user={loggedUser}
location={fakeHistory}
params={{ UPLOAD_THRESHOLD: { hard: 104857600 } }}
/>
</MemoryRouter>
, div);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
11 changes: 9 additions & 2 deletions client/src/utils/formgenerator/fields/FileUploaderInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -514,7 +515,13 @@ function FileUploaderInput({ name, label, alert, value, setInputs, help, disable
</span>
</div>;
}
return <span><Progress value={file.file_status}>{file.file_status}%</Progress></span>;
return <span>
<Progress value={file.file_status}>{file.file_status}%</Progress>
{file.file_size >= uploadThresholdHard ? <small>
<span className="text-muted"> No need to wait. We will <Link to="/notifications">
notify you</Link> when the upload is finished.
</span></small> : null }
</span>;
}
};

Expand Down
2 changes: 2 additions & 0 deletions helm-chart/renku-ui/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 5 additions & 0 deletions helm-chart/renku-ui/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d636298

Please sign in to comment.