From 9ca5b720b52bd6a996ade959f3e1b9216c3f1620 Mon Sep 17 00:00:00 2001 From: vedfordev Date: Fri, 6 Dec 2024 15:03:40 +0530 Subject: [PATCH 1/2] avniproject/avni-webapp#1178 | fix: coded file urls are showing in DEA --- src/dataEntryApp/components/Observations.js | 30 +++++++++++++-------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/src/dataEntryApp/components/Observations.js b/src/dataEntryApp/components/Observations.js index 804c1a737..8a3d5a4fe 100644 --- a/src/dataEntryApp/components/Observations.js +++ b/src/dataEntryApp/components/Observations.js @@ -298,19 +298,27 @@ const Observations = ({ observations, additionalRows, form, customKey, highlight }; const fileOptions = conceptName => { - const signedURL = get(find(mediaDataList, ({ altTag }) => altTag === conceptName), "url"); - return _.isNil(signedURL) ? ( + const signedURLS = mediaDataList.filter(mediaData => mediaData.altTag === conceptName).map(mediaData => mediaData.url); + return _.isNil(signedURLS) ? ( MediaData.MissingSignedMediaMessage ) : ( - { - event.preventDefault(); - window.open(signedURL, "_blank"); - }} - > - {t("View/Download File")} - + <> + {signedURLS.map((signedURL, index) => ( + <> + { + event.preventDefault(); + window.open(signedURL, "_blank"); + }} + key={index} + > + {t("View/Download File")} + +
+ + ))} + ); }; From c4d3b39e93dd98a791b19ad62aba633473e3268f Mon Sep 17 00:00:00 2001 From: vedfordev Date: Fri, 6 Dec 2024 16:23:20 +0530 Subject: [PATCH 2/2] avniproject/avni-webapp#1178 | fix: upload button work for multiselect file --- src/dataEntryApp/components/MediaUploader.js | 2 +- src/dataEntryApp/components/Observations.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dataEntryApp/components/MediaUploader.js b/src/dataEntryApp/components/MediaUploader.js index 3b66d6454..f0a4c407d 100644 --- a/src/dataEntryApp/components/MediaUploader.js +++ b/src/dataEntryApp/components/MediaUploader.js @@ -167,7 +167,7 @@ export const MediaUploader = ({ label, obsValue, mediaType, update, formElement const [openImage, setOpenImage] = useState(); const isFileDataType = formElement.getType() === Concept.dataType.File; const supportedMIMEType = isFileDataType ? getFileMimeType(formElement) : `${mediaType}/*`; - const isMultiSelect = formElement.isMultiSelect() && !isFileDataType; + const isMultiSelect = formElement.isMultiSelect(); useEffect(() => { addObsResultsToPreview(localObsValue, setPreview); diff --git a/src/dataEntryApp/components/Observations.js b/src/dataEntryApp/components/Observations.js index 8a3d5a4fe..14915c85e 100644 --- a/src/dataEntryApp/components/Observations.js +++ b/src/dataEntryApp/components/Observations.js @@ -11,7 +11,7 @@ import { subjectService } from "../services/SubjectService"; import { useTranslation } from "react-i18next"; import ErrorIcon from "@material-ui/icons/Error"; import PropTypes from "prop-types"; -import { find, get, includes, isEmpty, isNil, lowerCase, map } from "lodash"; +import { find, includes, isEmpty, isNil, lowerCase, map } from "lodash"; import clsx from "clsx"; import Colors from "dataEntryApp/Colors"; import { Link } from "react-router-dom";