{"version":3,"file":"DownloadDialog.js","sources":["../../src/modules/Datasets/list/DownloadDialog.tsx"],"sourcesContent":["import { computed, defineComponent, toRefs, ref, onMounted, onUnmounted } from 'vue'\nimport { useQuery } from '@vue/apollo-composable'\nimport { DownloadLinkJson, GetDatasetDownloadLink, getDatasetDownloadLink } from '../../../api/dataset'\nimport safeJsonParse from '../../../lib/safeJsonParse'\nimport { ElDialog, ElLoading } from '../../../lib/element-plus'\nimport { useStore } from 'vuex'\n\nconst getFilenameAndExt = (filename: string) => {\n const lastDot = filename.lastIndexOf('.')\n if (lastDot !== -1) {\n const name = filename.slice(0, lastDot)\n const ext = filename.slice(lastDot)\n if (ext.toLowerCase() === '.imzml') {\n return [name, '.imzML']\n } else {\n return [name, ext.toLowerCase()]\n }\n }\n return [filename, '']\n}\n\nconst FileIcon = defineComponent({\n props: { ext: { type: String, required: true } },\n setup(props) {\n return () => (\n \n )\n },\n})\n\nconst FileItem = defineComponent({\n props: {\n filename: { type: String, required: true },\n link: { type: String, required: true },\n },\n setup(props) {\n return () => {\n const { filename, link } = props\n const [name, ext] = getFilenameAndExt(filename)\n\n return (\n
\n \n Sign in\n {' '}\n to download. Access is available for public datasets or those you have permissions for.\n
\nThis dataset cannot be downloaded.
\n{((downloadLinks.value || {}) as any).message}
\n\n {license.code === 'NO-LICENSE' ? (\n
\n This dataset's submitter has not selected a license. Please get approval from the {authorStr} before\n downloading or using this dataset in any way.\n
\n ) : (\n\n This dataset is distributed under the{' '}\n \n {license.code}\n {' '}\n license. Make sure to credit the {authorStr} of this dataset:\n
\n )}\n \n\n \n Please be aware of daily download limits (2 downloads per day). Closing and reopening this dialog will\n count as a new download.\n \n
\n\n These download links expire after 30 minutes.\n
\n