Skip to content

Fix human-readable publication relation type labels - #1048

Open
youseihuayu-wonderful wants to merge 4 commits into
IQSS:developfrom
youseihuayu-wonderful:fix/1041-relation-type-labels
Open

Fix human-readable publication relation type labels#1048
youseihuayu-wonderful wants to merge 4 commits into
IQSS:developfrom
youseihuayu-wonderful:fix/1041-relation-type-labels

Conversation

@youseihuayu-wonderful

Copy link
Copy Markdown
Contributor

Problem

The modern UI uses raw controlled-vocabulary values as display labels for
publicationRelationType. This causes values such as IsSupplementedBy to
appear instead of the human-readable Is Supplemented By.

Implementation

  • Add an explicit, field-scoped label mapping for all six publication relation
    types.
  • Use separate { value, label } options in the dataset metadata edit form.
  • Apply the same labels when formatting relation types in the dataset metadata
    view.
  • Fall back to the original value when an unknown relation type is encountered.
  • Leave all other controlled-vocabulary fields unchanged.

Backward compatibility

This is a presentation-only change. Form submissions, stored metadata, API
values, and DataCite-compatible values continue to use the original raw values
such as IsSupplementedBy.

Existing datasets receive the corrected labels at render time without migration,
reindexing, or resaving.

Validation

  • Added coverage for all six relation type mappings.
  • Verified unknown-value fallback.
  • Verified unrelated controlled vocabularies remain unchanged.
  • Verified the edit dropdown displays labels while submitting raw values.
  • Verified dataset metadata rendering displays human-readable labels.
  • Ran 80 relevant Cypress component and regression tests.
  • TypeScript typecheck, ESLint, Prettier, and production build passed.

Closes #1041

@ChengShi-1 ChengShi-1 added SPA Size: 0.5 A percentage of a sprint. 0.35 hours bug Something isn't working labels Aug 20, 2026
@ChengShi-1 ChengShi-1 self-assigned this Aug 20, 2026

@ChengShi-1 ChengShi-1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi Sy, thanks for your contribution! I left some comments here. The main concern is the hard-coded string, which could be made dynamic to support internationalization.

Comment thread src/metadata-block-info/domain/models/ControlledVocabularyValueLabel.ts Outdated
Comment thread src/metadata-block-info/domain/models/ControlledVocabularyValueLabel.ts Outdated
Comment thread src/metadata-block-info/domain/models/ControlledVocabularyValueLabel.ts Outdated
@youseihuayu-wonderful

youseihuayu-wonderful commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

@ChengShi-1 Thanks for the review. I addressed all comments which passed on immediate isolated rerun (38/38). Could you please take another look?

@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 97.356% (-0.05%) from 97.405% — youseihuayu-wonderful:fix/1041-relation-type-labels into IQSS:develop

@ChengShi-1 ChengShi-1 moved this from Ready for Review ⏩ to In Review 🔎 in IQSS Dataverse Project Aug 21, 2026
'References'
] as const

export function getPublicationRelationLabel(value: string, t: TFunction): string {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sorry I didn't mention it from last review. After another look, I think the way we get the label is not to create a helper like this. The usual pattern in this codebase is to translate the value directly in the component.

We could remove this function by adding the follwing to Vocabulary.tsx, so we wouldn't need to pass the helper function through multiple files.

label: name === PUBLICATION_RELATION_TYPE_FIELD_NAME && PUBLICATION_RELATION_TYPE_VALUES.some((value) => value === option) ? t(publicationRelationTypes.${option}) : option

MetadataBlockInfo.spec.ts and some related tests should be removed as well.
Before you push the commit, don't forget to run npx prettier --write . to automatically fix format error

@cmbz cmbz added FY27 Sprint 4 FY27 Sprint 4 (2026-08-12 - 2026-08-26) FY27 Sprint 5 FY27 Sprint 5 (2026-08-26 - 2026-09-09) labels Aug 26, 2026
@cmbz cmbz added the FY27 Sprint 6 FY27 Sprint 6 (2026-09-09 - 2026-09-23) label Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working FY27 Sprint 4 FY27 Sprint 4 (2026-08-12 - 2026-08-26) FY27 Sprint 5 FY27 Sprint 5 (2026-08-26 - 2026-09-09) FY27 Sprint 6 FY27 Sprint 6 (2026-09-09 - 2026-09-23) Size: 0.5 A percentage of a sprint. 0.35 hours SPA

Projects

Status: In Review 🔎

Development

Successfully merging this pull request may close these issues.

Relation Type menu options text in the Related Publication not displaying properly; no spaces between words

5 participants