diff --git a/web/src/views/DandisetLandingView/DownloadDialog.vue b/web/src/views/DandisetLandingView/DownloadDialog.vue index 5b28e56ac..54f92a540 100644 --- a/web/src/views/DandisetLandingView/DownloadDialog.vue +++ b/web/src/views/DandisetLandingView/DownloadDialog.vue @@ -63,10 +63,6 @@ label="Draft" value="draft" /> - - Don't have DANDI CLI? + Don't have the DANDI CLI? Install the Python client (DANDI CLI) - in a Python 3.8+ environment using command: + in a Python 3.9+ environment using command: - pip install "dandi>=0.60.0" + pip install dandi @@ -120,18 +116,23 @@ import { computed, ref } from 'vue'; import { useDandisetStore } from '@/stores/dandiset'; import CopyText from '@/components/CopyText.vue'; -function downloadCommand(identifier: string, version: string): string { - // Use the special 'DANDI:' url prefix if appropriate. - const generalUrl = `${window.location.origin}/dandiset/${identifier}`; - const dandiUrl = `DANDI:${identifier}`; - const url = window.location.origin == 'https://dandiarchive.org' ? dandiUrl : generalUrl; +function formatDownloadCommand(identifier: string, version: string): string { + const baseUrl = import.meta.env.VITE_APP_DANDI_API_ROOT === 'https://staging-api.lincbrain.org/api/' + ? 'https://staging.lincbrain.org/dandiset/' + : 'https://lincbrain.org/dandiset/'; + + if (version === 'draft') { + return `dandi download ${baseUrl}${identifier}/draft`; + } - // Prepare a url suffix to specify a specific version (or not). - const versionPath = version ? `/${version}` : ''; + if (!version) { + return `dandi download ${baseUrl}${identifier}`; + } - return `dandi download ${url}${versionPath}`; + return `dandi download ${baseUrl}${identifier}/${version}`; } + const store = useDandisetStore(); const currentDandiset = computed(() => store.dandiset); @@ -149,7 +150,7 @@ const availableVersions = computed( ); const defaultDownloadText = computed( - () => (identifier.value ? downloadCommand(identifier.value, currentVersion.value) : ''), + () => (identifier.value ? formatDownloadCommand(identifier.value, currentVersion.value) : ''), ); const customDownloadText = computed(() => { @@ -157,15 +158,15 @@ const customDownloadText = computed(() => { return ''; } if (selectedDownloadOption.value === 'draft') { - return downloadCommand(identifier.value, 'draft'); + return formatDownloadCommand(identifier.value, 'draft'); } if (selectedDownloadOption.value === 'latest') { - return downloadCommand(identifier.value, ''); + return formatDownloadCommand(identifier.value, ''); } if (selectedDownloadOption.value === 'other') { - return downloadCommand( + return formatDownloadCommand( identifier.value, availableVersions.value[selectedVersion.value].version, ); } return ''; }); - + \ No newline at end of file