Skip to content
13 changes: 13 additions & 0 deletions app/components/doi-related-identifier.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,19 @@
</@form.element>
</div>

<div>
<label for="relationTypeInformation" class="subtitle">Relation Type Information</label>
</div>
<div doi-relation-type-information data-test-relation-type-information-field>
<input type="text" class="form-control relation-type-information-field" value={{this.fragment.relationTypeInformation}} placeholder="Relation Type Information"
oninput={{action "updateRelationTypeInformationAction" value="target.value"}} data-test-relation-type-information />
</div>
<div
class="help-block help-block-fragment relation-type-information-field">
Text to support the Relation Type.
</div>
Comment on lines +40 to +50
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Minor accessibility gap: <label for="relationTypeInformation"> has no matching id on the <input>.

The for attribute on the label won't associate with the input because the input lacks id="relationTypeInformation". Clicking the label won't focus the input field, which is a minor accessibility gap. This is easily fixable for a plain <input> (unlike the power-select labels elsewhere in this file where the pattern is inherited).

🔧 Proposed fix
-  <input type="text" class="form-control relation-type-information-field" value={{this.fragment.relationTypeInformation}} placeholder="Relation Type Information"
+  <input type="text" id="relationTypeInformation" class="form-control relation-type-information-field" value={{this.fragment.relationTypeInformation}} placeholder="Relation Type Information"
     oninput={{action "updateRelationTypeInformationAction" value="target.value"}} data-test-relation-type-information />
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<div>
<label for="relationTypeInformation" class="subtitle">Relation Type Information</label>
</div>
<div doi-relation-type-information data-test-relation-type-information-field>
<input type="text" class="form-control relation-type-information-field" value={{this.fragment.relationTypeInformation}} placeholder="Relation Type Information"
oninput={{action "updateRelationTypeInformationAction" value="target.value"}} data-test-relation-type-information />
</div>
<div
class="help-block help-block-fragment relation-type-information-field">
Text to support the Relation Type.
</div>
<div>
<label for="relationTypeInformation" class="subtitle">Relation Type Information</label>
</div>
<div doi-relation-type-information data-test-relation-type-information-field>
<input type="text" id="relationTypeInformation" class="form-control relation-type-information-field" value={{this.fragment.relationTypeInformation}} placeholder="Relation Type Information"
oninput={{action "updateRelationTypeInformationAction" value="target.value"}} data-test-relation-type-information />
</div>
<div
class="help-block help-block-fragment relation-type-information-field">
Text to support the Relation Type.
</div>
🤖 Prompt for AI Agents
In `@app/components/doi-related-identifier.hbs` around lines 40 - 50, The label's
for="relationTypeInformation" doesn't match any input id, so add
id="relationTypeInformation" to the corresponding input element (the <input>
with class "form-control relation-type-information-field" that binds
value={{this.fragment.relationTypeInformation}} and uses oninput={{action
"updateRelationTypeInformationAction" value="target.value"}}) so the label
correctly associates and clicking the label focuses the input.



<div class="power-select-label">
<label for="relatedResourceType" class="subtitle">Resource Type General</label>
</div>
Expand Down
12 changes: 11 additions & 1 deletion app/components/doi-related-identifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ const relationTypeList = [
'Is collected by',
'Collects',
'Is translation of',
'Has translation'
'Has translation',
'Other'
];

const relatedIdentifierTypeList = [
Expand All @@ -65,7 +66,9 @@ const relatedIdentifierTypeList = [
'LSID',
'PMID',
'PURL',
'RAiD',
'RRID',
'SWHID',
'UPC',
'URL',
'URN',
Expand Down Expand Up @@ -94,7 +97,9 @@ const resourceTypeGeneralList = [
'OutputManagementPlan',
'PeerReview',
'PhysicalObject',
'Poster',
'Preprint',
'Presentation',
'Project',
'Report',
'Service',
Expand Down Expand Up @@ -299,6 +304,11 @@ export default class DoiRelatedIdentifier extends Component {
this.selectRelationType(relationType);
}

@action
updateRelationTypeInformationAction(value) {
this.fragment.set('relationTypeInformation', value);
}

@action
selectRelatedIdentifierTypeAction(relatedIdentifierType) {
this.selectRelatedIdentifierType(relatedIdentifierType);
Expand Down
2 changes: 1 addition & 1 deletion app/components/doi-related-identifiers.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="form-group">
<div class="form-group" data-test-related-identifiers-form-group>
<label class="control-label col-md-3" data-test-related-identifiers>Related Identifiers</label>
<div class="col-md-9">
<div class="label-vertical">Identifiers of related resources.</div>
Expand Down
2 changes: 2 additions & 0 deletions app/components/doi-related-item-identifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ const relatedItemIdentifierTypeList = [
'LSID',
'PMID',
'PURL',
'RAiD',
'RRID',
'SWHID',
'UPC',
'URL',
'URN',
Expand Down
12 changes: 12 additions & 0 deletions app/components/doi-related-item.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,18 @@
</@form.element>
</div>

<div>
<label for="relationTypeInformation" class="subtitle">Relation Type Information</label>
</div>
<div doi-relation-type-information data-test-relation-type-information-field>
<input type="text" class="form-control relation-type-information-field" value={{this.fragment.relationTypeInformation}} placeholder="Relation Type Information"
oninput={{action "updateRelationTypeInformationAction" value="target.value"}} data-test-relation-type-information />
</div>
<div
class="help-block help-block-fragment relation-type-information-field">
Text to support the Relation Type.
</div>

<DoiRelatedItemIdentifier @model={{this.model}} @form={{this.form}} @fragment={{this.fragment.relatedItemIdentifier}} />

<div class="power-select-label">
Expand Down
10 changes: 9 additions & 1 deletion app/components/doi-related-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ const relationTypeList = [
'Is collected by',
'Collects',
'Is translation of',
'Has translation'
'Has translation',
'Other'
];

const relatedItemTypeList = [
Expand All @@ -68,7 +69,9 @@ const relatedItemTypeList = [
'OutputManagementPlan',
'PeerReview',
'PhysicalObject',
'Poster',
'Preprint',
'Presentation',
'Project',
'Report',
'Service',
Expand Down Expand Up @@ -182,6 +185,11 @@ export default class DoiRelatedItem extends Component {
this.selectRelationType(relationType);
}

@action
updateRelationTypeInformationAction(value) {
this.fragment.set('relationTypeInformation', value);
}

@action
selectRelatedItemTypeAction(relatedItemType) {
this.selectRelatedItemType(relatedItemType);
Expand Down
2 changes: 1 addition & 1 deletion app/components/doi-related-items.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="form-group">
<div class="form-group" data-test-related-items-form-group>
<label class="control-label col-md-3" data-test-related-items>Related Items</label>
<div class="col-md-9">
<div class="label-vertical">Related Items.</div>
Expand Down
2 changes: 2 additions & 0 deletions app/components/doi-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ const resourceTypeGeneralList = [
'OutputManagementPlan',
'PeerReview',
'PhysicalObject',
'Poster',
'Preprint',
'Presentation',
'Project',
'Report',
'Service',
Expand Down
15 changes: 15 additions & 0 deletions app/models/related-identifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,18 @@ const Validations = buildValidations({
})
})
],
relationTypeInformation: [
validator('presence', {
presence: true,
message: 'Please enter text to support the Relation Type.',
disabled: computed('model.{relatedIdentifier,state}', function () {
return (
this.model.get('state') === 'draft' ||
isBlank(this.model.get('relatedIdentifier'))
);
})
})
],
Comment on lines +61 to +72
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Same concern: presence validation may be too strict for an optional field.

Same issue as flagged in related-item.js — this presence validator will require relationTypeInformation for every related identifier that has a relatedIdentifier value and is not in draft state. If the Metadata 4.7 spec treats this as optional, this will block publishing for existing records that lack this field.

🤖 Prompt for AI Agents
In `@app/models/related-identifier.js` around lines 61 - 72, The presence
validator on relationTypeInformation is too strict for an optional field; remove
the validator('presence', ...) for relationTypeInformation (or replace it with a
non-blocking/optional check) so records with a relatedIdentifier but no
relationTypeInformation can still be published; if you need any validation, use
a conditional validator that only runs when the Metadata 4.7 spec requires the
field (e.g., swap the presence validator for a validator that allows blank
values such as validator('length', { allowBlank: true }) or gate the presence
check with the existing computed disabled condition on
model.{relatedIdentifier,state}).

resourceTypeGeneral: [
validator('presence', {
presence: true,
Expand Down Expand Up @@ -86,6 +98,9 @@ export default class RelatedIdentifier extends Fragment.extend(Validations) {
@attr('string', { defaultValue: null })
relationType;

@attr('string', { defaultValue: null })
relationTypeInformation;

@attr('string', { defaultValue: null })
relatedMetadataScheme;

Expand Down
15 changes: 15 additions & 0 deletions app/models/related-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@ const Validations = buildValidations({
})
})
],
relationTypeInformation: [
validator('presence', {
presence: true,
message: 'Please enter text to support the Relation Type.',
disabled: computed('model.{title,state}', function () {
return (
this.model.get('state') === 'draft' ||
isBlank(this.model.get('title'))
);
})
})
],
Comment on lines +36 to +47
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# First, find the relevant files mentioned in the review
find . -type f -name "related-item.js" -o -name "doi-related-item.hbs" -o -name "related-identifier.js" 2>/dev/null | head -20

Repository: datacite/bracco

Length of output: 194


🏁 Script executed:

#!/bin/bash
# Explore the structure of app/models
ls -la app/models/ 2>/dev/null | head -30

Repository: datacite/bracco

Length of output: 1996


🏁 Script executed:

#!/bin/bash
# Search for relationTypeInformation across the codebase
rg "relationTypeInformation" -n --type=js --type=hbs -B2 -A2

Repository: datacite/bracco

Length of output: 3434


🏁 Script executed:

#!/bin/bash
# Look at the full validation block for relationTypeInformation in both files
# Get lines 36-47 from related-item.js
sed -n '36,47p' app/models/related-item.js

Repository: datacite/bracco

Length of output: 406


🏁 Script executed:

#!/bin/bash
# Get the full validation block from related-identifier.js
sed -n '61,72p' app/models/related-identifier.js

Repository: datacite/bracco

Length of output: 430


🏁 Script executed:

#!/bin/bash
# Check what "required-label" is used for in templates
rg "required-label" --type=hbs -B2 -A2 | head -40

Repository: datacite/bracco

Length of output: 3278


🏁 Script executed:

#!/bin/bash
# Look at other validators with presence to see the pattern
rg "validator\('presence'" -B2 -A10 --type=js app/models/related-item.js

Repository: datacite/bracco

Length of output: 1584


🏁 Script executed:

#!/bin/bash
# Check if relatedItemType and relationType have required-label in the template
rg -n "relatedItemType|relationType" app/components/doi-related-item.hbs -B1 -A1 | head -40

Repository: datacite/bracco

Length of output: 1613


🏁 Script executed:

#!/bin/bash
# Check the Metadata 4.7 schema or any documentation about relationTypeInformation
find . -type f \( -name "*.md" -o -name "*.txt" \) -exec grep -l "relationTypeInformation\|RelationTypeInformation" {} \; 2>/dev/null

Repository: datacite/bracco

Length of output: 41


🏁 Script executed:

#!/bin/bash
# Look for any schema definitions or constants that document field requirements
rg "relationTypeInformation" --type=ts --type=js -B3 -A3 | grep -i "schema\|required\|optional" | head -20

Repository: datacite/bracco

Length of output: 41


🏁 Script executed:

#!/bin/bash
# Check if there are any comments or documentation about this field being optional/required
rg -n "relation.*type.*information" -i --type=js -B5 -A5 app/models/related-item.js

Repository: datacite/bracco

Length of output: 659


🏁 Script executed:

#!/bin/bash
# Check if there are tests or comments that clarify the intended optionality
rg "relationTypeInformation" --type=js -B5 -A5 app/ | grep -i "test\|optional\|required" | head -20

Repository: datacite/bracco

Length of output: 41


🏁 Script executed:

#!/bin/bash
# Look at the broader context - check if there's a README or docs about the related-item structure
find . -type f \( -name "README*" -o -name "SCHEMA*" -o -name "*.md" \) | xargs grep -l "related.item\|relationTypeInformation" 2>/dev/null | head -5

Repository: datacite/bracco

Length of output: 41


Presence validation inconsistency for relationTypeInformation.

The template (doi-related-item.hbs line 44) labels this field with class "subtitle" only, while required fields like relatedItemType and relationType use "required-label subtitle". However, the validator (lines 36-47) enforces presence: true, making this field mandatory whenever the state is not draft and title is not blank.

This creates an inconsistency: the UI signals the field is optional, but validation enforces it as required. Either add "required-label" to the template to match the mandatory validation, or remove the presence requirement if the field should be optional per the Metadata 4.7 schema. The same issue exists in related-identifier.js.

🤖 Prompt for AI Agents
In `@app/models/related-item.js` around lines 36 - 47, The presence validator on
relationTypeInformation (validator key relationTypeInformation in
app/models/related-item.js) currently sets presence: true when not draft and
title is present, which conflicts with the template that omits the
"required-label" CSS; either make the UI match the validation or relax the
validator: (A) add "required-label" to the field label in doi-related-item.hbs
so the UI shows it as required, or (B) remove or conditionalize presence: true
in relationTypeInformation so the field is optional per Metadata 4.7; apply the
same change to the analogous presence validator in related-identifier.js to keep
behavior consistent.

title: [
validator('presence', {
presence: true,
Expand Down Expand Up @@ -96,6 +108,9 @@ export default class RelatedItem extends Fragment.extend(Validations) {
@attr('string', { defaultValue: null })
relationType;

@attr('string', { defaultValue: null })
relationTypeInformation;

@fragment('related-item-identifier', {
defaultValue: {}
})
Expand Down
2 changes: 2 additions & 0 deletions app/validators/resource-type.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ class ResourceType extends BaseValidator {
'OutputManagementPlan',
'PeerReview',
'PhysicalObject',
'Poster',
'Preprint',
'Presentation',
'Project',
'Report',
'Service',
Expand Down
Loading
Loading