-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
For staging environment, include dynamic text for dandi download
command
#1810
Changes from all commits
2d703e7
62d8820
b983ab5
fc46cff
b19f9d0
dbea9f8
54f1714
f4564cd
8b846b3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ | |
width="60%" | ||
class="white--text pl-2 py-1 text-left" | ||
> | ||
<div>> dandi download https://dandiarchive.org/dandiset/{{ dandisetIdentifier }}/draft</div> | ||
<div>> {{ downloadCommand }}</div> | ||
<div>> cd {{ dandisetIdentifier }}</div> | ||
<div>> dandi organize <source_folder> -f dry</div> | ||
<div>> dandi organize <source_folder></div> | ||
|
@@ -53,4 +53,12 @@ import { useDandisetStore } from '@/stores/dandiset'; | |
|
||
const store = useDandisetStore(); | ||
const dandisetIdentifier = computed(() => store.dandiset?.dandiset.identifier); | ||
|
||
if (dandisetIdentifier.value === undefined) { | ||
throw new Error('store.dandiset must be defined'); | ||
} | ||
|
||
const downloadCommand = computed(() => { | ||
return `dandi download ${window.location.origin}/dandiset/${dandisetIdentifier.value}/draft` | ||
}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is a good first step since would allow both main and staging one but it is not a generic solution. The dandi-cli is actually "too smart" to support a wide range of URLs and they do not have to be associated with a specific "short named" instance (if something fails -- it is a bug):
so here IMHO it just should use local server URL... chatgpt suggested some code like this computed: {
baseUrl() {
const protocol = window.location.protocol;
const host = window.location.hostname;
const port = window.location.port ? `:${window.location.port}` : '';
return `${protocol}//${host}${port}`;
}
} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To clarify though -- for example, a user on I do agree that it could be more generic; however, I'd vote to keep it simple and confined in case an unknown edge case exists (e.g. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I pushed a few commits to clean up the PR and change the URL generation to something close to Yarik's ChatGPT code. Check it out and let me know what you think. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
sorry, missed the question -- what "two specific places" you have in mind? here the list of supported URLs organically grown to make it easier for a user to download, e.g. "just cut paste URL from the browser". identifiers.org is indeed niche use case, and would work only for the main instance unless we add some other identifiers to handle in addition to |
||
</script> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not really follow the discussion in the other thread. Could you summarize here whether this logic is correct for the upload instructions? Is there a reason not to use the same logic as in the download dialog below? Specifically, if a user downloads their dandiset via
dandi download DANDI:123456/draft
, will the subsequentdandi upload
command get confused about where to upload?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The DANDI CLI should still be OK -- as @yarikoptic mentioned that any short-hand prefix shouldn't break here, as "The dandi-cli is actually "too smart" to support a wide range of URLs and they do not have to be associated with a specific "short named" instance (if something fails -- it is a bug)"
I can test further if you'd like more confirmation