-
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
Improvements customisation submission sections #2971
base: main
Are you sure you want to change the base?
Improvements customisation submission sections #2971
Conversation
…2p-113996_Improvements-submission-sections-main
// When Upload section is disabled, add to submission only if there are files | ||
(!item.sections[sectionId].hasOwnProperty('files') || isNotEmpty((item.sections[sectionId] as any).files)))) { | ||
|
||
if (typeof item.sections[sectionId] === 'object' && (isNotEmpty(item.sections[sectionId]))) { |
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.
@atarix83 , your commit from a couple years back has been reverted here to allow metadata to be properly parsed from the section's data on specifically upload sections, otherwise you can't have any data on the upload section, other than "files", which limits customisability of these types of steps.
Now, my question is, what was the reason these checks were added in the first place, if you remember? Because I couldn't find the reason and reverting it doesn't seem to break any functionality of the upload step, both when uploads are mandatory or not.
We tried to test these changes, checked out the PR branches, brought over the changes from the example branches. One problem we had is that the renderSectionFor from sections-decorator.ts is marked as deprecated. |
@Atmire-Kristof Could you help us what can be wrong. |
References
Description
This PR aims to add better customisability of additional submission steps, mainly adding steps that should inherit functionality from other existing steps.
Instructions for Reviewers
We've added an attribute to the
type
tag of submission-steps initem-submission.xml
. This tag is labeled "extends" and can contain a string value that refers to the existing type of a step the new step should inherit from.From here-on out, it's up to the developer to decide which parts need extending or overwriting, but this approach avoids having to re-write entire sections when most of the functionality is the same as another existing step.
Details on how to add and customise a step
On the REST side:
item-submission.xml
withextends
attribute ontype
referring to an existing step to re-use functionality. e.g.<type extends="upload">custom-upload</type>
<processing-class>org.dspace.app.rest.submit.step.CustomUploadStep</processing-class>
uploadConfigurationService
bean inaccess-conditions.xml
with the key matching the ID of your new step. The value can refer to theuploadConfigurationDefault
or a new one if desired. e.g.<entry key="custom-upload" value-ref="uploadConfigurationDefault" />
AbstractValidation
(or the validation of the step you're extending) and configure it as a bean inspring-dspace-addon-validation-services.xml
. The name has to match your type. If no validation bean is configured for your step, but one exists for the step you're extending from, that one will be used instead.On the Angular side:
SectionsType
enum matching your custom step typeSectionModelComponent
and annotate it with@renderSectionFor(SectionsType.{your-custom-step-type})
Example
To make testing easier, I've created a separate branch starting from my PR, containing some custom code for a very basic example of a custom upload step that inherits all of the functionality of the existing upload step, to give you an idea on how and where everything's configured. Also added several comments explaining into more detail, in case something isn't clear yet.
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). 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.