Skip to content
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

adding license field to the create dandiset page #839

Merged
merged 18 commits into from
Jul 6, 2022
Merged

Conversation

djarecka
Copy link
Contributor

@djarecka djarecka commented Jan 21, 2022

Adding a new field - license to the create dandiset page as a mandatory field.

closes #747

this PR requires changes in Dandischema, this is WIP

@djarecka
Copy link
Contributor Author

@dchiquito @mvandenburgh - I know I'm not doing this properly, I hardcoded the licenses we are using. I found license types in schema.js file, but not sure what is the best way to extract the information from there..

@satra
Copy link
Member

satra commented Jan 22, 2022

we should discuss this a bit more in the context of not requiring license for embargoed dandisets. see: dandi/dandi-schema#115

@mvandenburgh
Copy link
Contributor

@dchiquito @mvandenburgh - I know I'm not doing this properly, I hardcoded the licenses we are using. I found license types in schema.js file, but not sure what is the best way to extract the information from there..

Types are only used for type-checking and are evaluated at compile time and then discarded, so unfortunately there's no way to access the license types in schema.ts at runtime. But, you should be able to extract them from the schema like this -

const licenses: ComputedRef<LicenseType[]> = computed(() => store.state.dandiset.schema.definitions.LicenseType.enum);

@djarecka
Copy link
Contributor Author

@mvandenburgh - thank you, will try!

@waxlamp waxlamp marked this pull request as draft January 27, 2022 17:41
@waxlamp
Copy link
Member

waxlamp commented Jan 27, 2022

@djarecka, I converted this to a draft PR since you are still working on it.

@netlify
Copy link

netlify bot commented Feb 4, 2022

❌ Deploy Preview for gui-staging-dandiarchive-org failed.

🔨 Explore the source changes: 4497b4e

🔍 Inspect the deploy log: https://app.netlify.com/sites/gui-staging-dandiarchive-org/deploys/61fd883f36c872000828f173

@djarecka djarecka marked this pull request as ready for review February 24, 2022 16:34
@djarecka djarecka changed the title [wip] adding license field to the create dandiset page adding license field to the create dandiset page Feb 24, 2022
@@ -75,6 +76,17 @@
:rules="awardNumberRules"
/>
</div>
<div v-if="embargoed===false">
<v-combobox
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are your thoughts on using a v-select instead of v-combobox here? IMO the extra autocomplete features v-combobox provides just confuse things, since there's only two license types to choose from. Also, fwiw the meditor uses a v-select for licenses.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, I missed the comments.... I'm not sure if I had any specific thoughts, will try to use v-select

@djarecka
Copy link
Contributor Author

@mvandenburgh - I came back to this old PR, I merged the current master, but have some errors, that I don't fully understand. Could you please help me with it

Copy link
Contributor

@mvandenburgh mvandenburgh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@djarecka See below suggestions, they should fix the type-checking errors. Let me know if you have any questions.

web/src/views/CreateDandisetView/CreateDandisetView.vue Outdated Show resolved Hide resolved
web/src/views/CreateDandisetView/CreateDandisetView.vue Outdated Show resolved Hide resolved
web/src/views/CreateDandisetView/CreateDandisetView.vue Outdated Show resolved Hide resolved
web/src/views/CreateDandisetView/CreateDandisetView.vue Outdated Show resolved Hide resolved
@@ -117,6 +134,7 @@ export default defineComponent({
setup(props, ctx) {
const name = ref('');
const description = ref('');
const license = ref('');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const license = ref('');
const license = ref<License>();

This is what is causing the type-check failures. license is implicitly defined as type Ref<string> here, but the schema dictates that it's an array of string literals, which is encapsulated in the License type.

Making this change will make license instead have a type of Ref<License | undefined>, which works as long as you also update saveDisabled to return true if the dandiset is not embargoed and has an undefined license (which we want to do anyways), i.e. add || (!embargoed.value && !license.value) to it (github code review unfortunately won't let me make that a formal suggestion b/c this PR doesn't modify that code yet).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you have in mind ref<LicenseType>()?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, ref<License>() (you would also have to add that to the import statement). LicenseType refers to a string, while License is an array of LicenseTypes that is populated by the v-select (see schema.ts for those type definitions)

djarecka and others added 7 commits June 30, 2022 15:15
Co-authored-by: Mike VanDenburgh <37340715+mvandenburgh@users.noreply.github.com>
Co-authored-by: Mike VanDenburgh <37340715+mvandenburgh@users.noreply.github.com>
Co-authored-by: Mike VanDenburgh <37340715+mvandenburgh@users.noreply.github.com>
Co-authored-by: Mike VanDenburgh <37340715+mvandenburgh@users.noreply.github.com>
Co-authored-by: Mike VanDenburgh <37340715+mvandenburgh@users.noreply.github.com>
@djarecka
Copy link
Contributor Author

@mvandenburgh - could you help me with the error, don't understand it

Copy link
Contributor

@mvandenburgh mvandenburgh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@djarecka I updated the tests as we discussed - this PR looks good to me after removing the redundant code I mentioned below.

web/src/views/CreateDandisetView/CreateDandisetView.vue Outdated Show resolved Hide resolved
djarecka and others added 2 commits July 5, 2022 22:37
Co-authored-by: Mike VanDenburgh <37340715+mvandenburgh@users.noreply.github.com>
@djarecka djarecka merged commit c621071 into master Jul 6, 2022
@djarecka djarecka deleted the create_license branch July 6, 2022 17:41
@dandibot
Copy link
Member

dandibot commented Jul 6, 2022

🚀 PR was released in v0.2.32 🚀

@dandibot dandibot added the released This issue/pull request has been released. label Jul 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Force choice of license at dandiset creation time
5 participants