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

doi: handle UI for optional DOI feature #1896

Merged

Conversation

anikachurilova
Copy link
Member

@anikachurilova anikachurilova commented Dec 5, 2024

If DOI is required:
Screenshot 2024-12-05 at 12 28 16

If DOI is not required:
Screenshot 2024-12-05 at 12 29 07

Different options overview:
Screenshot 2024-12-05 at 12 29 36
Screenshot 2024-12-05 at 12 29 45
Screenshot 2024-12-05 at 12 30 01

Errors displaying that DOI was needed, but was not reserved (on publish of the draft):
Screenshot 2024-12-06 at 10 35 35
Screenshot 2024-12-06 at 10 35 44

@zzacharo zzacharo force-pushed the optional-doi-feature branch 3 times, most recently from 33af9cd to 404339b Compare December 10, 2024 18:49
@zzacharo zzacharo force-pushed the optional-doi-feature branch 8 times, most recently from e77fb48 to b6287de Compare December 12, 2024 18:38
@zzacharo zzacharo force-pushed the optional-doi-feature branch 4 times, most recently from 0d0b336 to 57f5113 Compare December 13, 2024 09:04
@zzacharo
Copy link
Member

Current implementation

First version - no or external DOI

In any subsequent version, we check on the backend that you cannot ask for a locally managed DOI

Screenshot

Screenshot 2024-12-13 at 10 09 05

First version - locally managed DOI

In any subsequent version, we check on the backend that you cannot add an external or omit DOI

Screenshot

Screenshot 2024-12-13 at 10 07 29

@zzacharo zzacharo force-pushed the optional-doi-feature branch from 57f5113 to fdea96d Compare December 13, 2024 09:14
const errorData = error.response.data;
let errorData = error.response.data;
const errors = this.recordSerializer.deserializeErrors(
error.response.data.errors || []
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we need the empty array?

Comment on lines 385 to 391
isManagedSelected:
isDraft === true && value?.identifier && value?.provider !== PROVIDER_EXTERNAL
? true
: undefined,
isNoNeedSelected: undefined,
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
isManagedSelected:
isDraft === true && value?.identifier && value?.provider !== PROVIDER_EXTERNAL
? true
: undefined,
isNoNeedSelected: undefined,
const isInternalProvider = value?.provider !== PROVIDER_EXTERNAL;
const isDraft = record?.is_draft == true;
const hasIdentifier = value?.identifier;
const isManagedSelected = isDraft && hasIdentifier && isInternalProvider ? true : undefined;
this.state = {
isManagedSelected: isManagedSelected;
isNoNeedSelected: undefined,

also, why do we set isManagedSelected to undefined not false?

@@ -407,40 +442,72 @@ class CustomPIDField extends Component {
}

const hasManagedIdentifier = managedIdentifier !== "";
const hasUnmanagedIdentifier = unmanagedIdentifier !== "";
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we set empty string ?

Copy link
Member

Choose a reason for hiding this comment

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

The initialization happens above and here we check if the value is not empty string. I am confused about the question :)

@zzacharo zzacharo force-pushed the optional-doi-feature branch from fdea96d to 47712af Compare December 13, 2024 12:47
Copy link
Member

@slint slint left a comment

Choose a reason for hiding this comment

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

LGTM (reviewed IRL as well)

@zzacharo zzacharo force-pushed the optional-doi-feature branch from 47712af to 08f080b Compare December 13, 2024 16:32
* closes CERNDocumentServer/cds-rdm#163

Co-authored-by: Zacharias Zacharodimos <zacharias.zacharodimos@cern.ch>
@zzacharo zzacharo force-pushed the optional-doi-feature branch from 08f080b to 1c177e1 Compare December 13, 2024 16:58
@zzacharo zzacharo merged commit 4d5c649 into inveniosoftware:master Dec 13, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DOI: make default option selection configurable
4 participants