Commit 5f3165f4 authored by Matija Obreza's avatar Matija Obreza
Browse files

Datasets: Download dataset files

parent 6c778084
import React from 'react';
import {useTranslation} from 'react-i18next';
// import {useSelector} from "react-redux";
import {useSelector} from "react-redux";
import {Link} from "react-router-dom";
// model
......@@ -43,6 +43,7 @@ const DatasetDetailsPage = ({match}: DatasetDetailsPageProps) => {
// redux
// const publicWebsiteUrl = useSelector((state: any) => state?.apiInfo?.apiInfo?.publicWebsiteUrl);
const genesysApiUrl = useSelector((state: any) => state?.appConfig?.config?.apiUrl);
React.useEffect(() => {
loadData(match.params.uuid);
......@@ -170,6 +171,24 @@ const DatasetDetailsPage = ({match}: DatasetDetailsPageProps) => {
/>
}
{ dataset.repositoryFiles &&
<>
<h2 className="mt-4">{t('dataset.details.repositoryFiles')}</h2>
{dataset.repositoryFiles.map((repoFile) =>
<p key={ repoFile.uuid}>
<form target="_blank" method="post" action={ `${genesysApiUrl}/api/v1/dataset/${dataset.uuid}/download${
repoFile.originalFilename === 'Metadata.xlsx'
? '?metadata'
: `/${repoFile.id}`
}` }>
<button type="submit">{ t('action.download') }</button> <b>{ repoFile.originalFilename }</b> { repoFile.title }
{ repoFile.description && <p>{ repoFile.description }</p> }
</form>
</p>
)}
</>
}
{accessions && accessions.length > 0 && (
<>
<h2 className="mt-4">{t('dataset.details.accessions')}</h2>
......
......@@ -12,7 +12,8 @@
"andMore": "And {{otherMore, number}} more"
},
"action": {
"submit": "Submit"
"submit": "Submit",
"download": "Download"
},
"pag": {
"first": "First",
......@@ -253,7 +254,8 @@
"metadata": "Other metadata",
"accessions": "Accessions",
"traits": "Traits Observed",
"locations": "Location information"
"locations": "Location information",
"repositoryFiles": "Dataset files"
}
},
"creator": {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment