-
Notifications
You must be signed in to change notification settings - Fork 433
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
Make the CC license field component configurable in DSpace 8.0 #3165
base: main
Are you sure you want to change the base?
Conversation
It doesn't work on Publication, it only works on item. Why? |
The
Thus, it is not related to this PR. IMHO, whether publications should (or should not) use |
Thinking about the licensing of untyped items and publications... maybe you're right, and it should be added to the default templates. To be fair, it seems a bit arbitrary that it is only shown for untyped items and only when selecting a CC license. Feel free to post a new issue. If the community thinks it's worth implementing, I volunteer to do so. |
Dear Abelgomez, thank you very much for reply. I added the relevant values in the untyped-item.component.html and .ts file to the publication.component.hmtl and .ts file and ran the build, but it resulted in an error. (not: version DSpace 8.0) publication.component.ts
publication.component.html yarn start:dev Result:
104 <ds-item-page-cc-license-field [item]="object" [variant]="'full'"> |
Again, the error you have posted is unrelated to this PR (you would get the same error with the unmodified DSpace 8.0 code base). It is caused because the file Thus, you must also add It also took me a couple of minutes to notice that the error was coming from the "custom" theme, rather than from the "base" app 😉 |
Dear @abelgomez thank you very much. |
Hi @abelgomez, |
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.
@abelgomez : Thanks for this work! Apologies for the delayed response, but we did a team code review of this PR in today's Developer Meeting. Overall, the feedback was positive & this PR seems like a nice improvement. Just a few things we noticed:
- First, this PR has code conflicts which need to be resolved so that it's mergeable again.
- Second, the new configs are really useful. But, for
uriField
andnameField
, you could just read these values from the REST API (if you enable them to be read as I describe below). This would make this improvement even easier to use, as you can configure these fields in one place (on the backend) instead of in two places.
Overall though, only a rebase (to fix merge conflicts) is required. But, we'd still recommend considering reading these two settings from the backend as it will make this much easier to use.
config/config.example.yml
Outdated
# Field name containing the CC license URI, as configured in the back-end, in the 'dspace.cfg' file, property 'cc.license.uri' | ||
# Defaults to 'dc.rights.uri' | ||
uriField: dc.rights.uri | ||
# Field name containing the CC license name, as configured in the back-end, in the 'dspace.cfg' file, property 'cc.license' |
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.
This line should say cc.license.name
as that's the property in dspace.cfg that it should match
config/config.example.yml
Outdated
variant: small | ||
# Field name containing the CC license URI, as configured in the back-end, in the 'dspace.cfg' file, property 'cc.license.uri' | ||
# Defaults to 'dc.rights.uri' | ||
uriField: dc.rights.uri |
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.
Because this setting should always match the cc.license.uri
setting in dspace.cfg
, it'd be better to just have the backend share that setting with the user interface. This is what we do in other areas of the application as well.
For example, the backend already does this with cc.license.jurisdiction
setting in dspace.cfg
. In order to tell the backend to make that setting available, you just need to add it to the list of rest.properties.exposed
in rest.cfg
like this: https://github.com/DSpace/DSpace/blob/main/dspace/config/modules/rest.cfg#L54
Then, the UI code is able to request that setting from the REST API, like this:
https://github.com/DSpace/dspace-angular/blob/main/src/app/submission/sections/cc-license/submission-section-cc-licenses.component.ts#L310
So, this PR could be simplified if you removed the uriField
setting here, and instead made a call to:
this.configService.findByPropertyName('cc.license.uri')
In general, this PR does seem like a step in the right direction. So, if you feel you cannot update it to read these values from the REST API, we still can move this forward. But, I wanted to point out how easy it is to just read these settings from the REST API instead of duplicating them to the UI configs.
config/config.example.yml
Outdated
uriField: dc.rights.uri | ||
# Field name containing the CC license name, as configured in the back-end, in the 'dspace.cfg' file, property 'cc.license' | ||
# Defaults to 'dc.rights' | ||
nameField: dc.rights |
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.
Similar to the note above, we also could remove this config and instead configure the REST API to expose cc.license.name
and then call ``
this.configService.findByPropertyName('cc.license.name')
Again, your approach here will work too...but it would require users to make sure these two settings are duplicated into both dspace.cfg and config.yml.
Hi @tdonohue , thanks for the feedback. Reading the configuration from the backend seems the way to go. Sorry for not noticing it could be done 🤦♂️🤦♂️ I still need to learn a lot about the codebase... I'll work on the rebase, and I'll implement the improvements (since they also affect the implementation of other PRs I'm working on. Unfortunately, as I said some weeks ago in another PR, I'm a bit busy this season so that fixes will take some weeks. Cheers! |
@abelgomez : No worries on your timelines. We expect that not all developers are able to get back to PRs immediately at all times. But, whenever you are able to get back to this, please feel free to ping me for another (hopefully final) review. Overall, the idea here is very good though & we appreciate your effort in making CC licenses more configurable. |
... rather than from a frontend configuration
They were deleted by mistake
* Restore the Input properties that allow configuring the license URI and name fields from a template * Update test cases using a stub configuration data service * Fix lint issues
1c75ed2
to
d199871
Compare
* Move all properties dependent of the CC URI field and CC name field to asyncs (since this configuration must be retrieved also asynchronously from the backend) * Refactor the regex, and create a public static method (that may be used to externally check if a license is a CC license). * Update test cases
Hi @tdonohue , I think that the code is ready. It now retrieves the Since these two properties do not hold any sensitive information, I'll open a PR in the backend to expose both of them by default. I acknowledge that I have introduced a bit of confusion in the commits, but, in the end, the final code didn't change too much w.r.t. my previous proposal, so I hope it's easy to review. The thing is that I initially removed all the configuration options (because I forgot about I also initially decided to remove the Sorry for the indecisiveness. On a side note, it's also noteworthy to mention that I wrapped part of the properties inside Observables, since now their values depend on the back-end configuration that is retrieved when the component is initialized. Now, since the URI and license name are retrieved from the backend, the initial description and title of the PR are not fully accurate. Here is an updated version: DescriptionThe Two configuration properties are configurable in the back end (license URI field and license name field), and other are only specific to the front-end (icon variant, show name, and show disclaimer). This PR:
In any case, the component can still be used in angular templates as before. If a developer explicitly sets the Instructions for Reviewers
The properties that may be read from the back-end are:
The properties that can be configured in the front-end are:
|
This PR relates to DSpace#3165 and DSpace/DSpace#9882.
This PR relates to DSpace#3165 and DSpace/DSpace#9882.
References
This PR does not directly address an open issue, but improves PR #3010 that addressed #3002.
Requires: DSpace/DSpace#9882
Description
The
ItemPageCcLicenseFieldComponent
implemented in #3010 has some configuration properties that, however, are hardcoded in the component itself and require manual modifications of the typescript code.Since at least two configuration properties are indeed easily configurable in the back end (license URI field and license name field), makes sense that the front-end allows to configure them too.
This PR adds these configuration options (and some others) to the application config, so that no more modifications are required at the code level.
Instructions for Reviewers
dc.rights.uri
anddc.rights
to a valid value (e.g.,https://creativecommons.org/licenses/by-nc-nd/4.0/
andCC BY-NC-ND 4.0
respectively) and see the Creative Commons badge to appear.dc.rights
metadata value and refresh the item. The CC badge will not show (theItemPageCcLicenseFieldComponent
requires both the CC uri and CC name to be set).dc.rights.license
metadata value with the valueCC BY-NC-ND 4.0
. Refresh the item, and the badge will still not be shown (since onlydc.right.uri
will be found with the default configuration).Other properties that ca be configured are:
Checklist
This checklist provides a reminder of what we are going to look for when reviewing your PR. You need not complete this checklist prior to creating your PR (draft PRs are always welcome).
However, reviewers may request that you complete any actions in this list if you have not done so. If you are unsure about an item in the checklist, don't hesitate to ask. We're here to help!
yarn lint
yarn check-circ-deps
)package.json
), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.