Skip to content

Commit

Permalink
Handle journal not being present in metadata step
Browse files Browse the repository at this point in the history
  • Loading branch information
markpatton committed Oct 16, 2023
1 parent f07f492 commit 44f696a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
23 changes: 16 additions & 7 deletions app/components/workflow-metadata/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,22 @@
<h4 class="font-weight-light pull-right form-step-header">
{{concat "Form" " " this.displayFormStep " " "of" " " this.schemas.length}}
</h4>
{{#if this.currentSchema}}
<MetadataForm
@schema={{this.currentSchema}}
@nextForm={{this.nextForm}}
@previousForm={{this.previousForm}}
@cancel={{this.cancel}}
/>

{{#if this.missingRequiredJournal}}
<h2>Missing required journal</h2>
<p>
A repository requires information about the journal associated with the submission.
Please <LinkTo @route="submissions.new.basics">go back and enter a journal</LinkTo>.
</p>
{{else}}
{{#if this.currentSchema}}
<MetadataForm
@schema={{this.currentSchema}}
@nextForm={{this.nextForm}}
@previousForm={{this.previousForm}}
@cancel={{this.cancel}}
/>
{{/if}}
{{/if}}
</div>
{{yield}}
5 changes: 5 additions & 0 deletions app/components/workflow-metadata/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export default class WorkflowMetadata extends Component {
@tracked readOnlyProperties = [];
@tracked schemas = undefined;
@tracked metadata = {};
@tracked missingRequiredJournal = false;
@tracked currentFormStep = 0; // Current step #

/**
Expand Down Expand Up @@ -83,9 +84,13 @@ export default class WorkflowMetadata extends Component {
try {
const schemas = yield this.metadataSchema.getMetadataSchemas(repos);

const requiresJournal =
schemas.findIndex((schema) => 'required' in schema && schema.required.includes('journal-title')) != -1;
const doiInfo = this.doiInfo;
const journal = yield get(this, 'args.publication.journal');

set(this, 'missingRequiredJournal', requiresJournal && !journal);

// Add relevant fields from DOI data to submission metadata
const metadataFromDoi = this.doi.doiToMetadata(doiInfo, journal, this.metadataSchema.getFields(schemas));

Expand Down

0 comments on commit 44f696a

Please sign in to comment.