From 9710c98a522f33752ab3a9506fe66d0499503baa Mon Sep 17 00:00:00 2001 From: Mark Patton Date: Mon, 16 Oct 2023 09:49:52 -0400 Subject: [PATCH] Handle journal not being present in metadata step --- app/components/workflow-metadata/index.hbs | 23 +++++++++++++++------- app/components/workflow-metadata/index.js | 5 +++++ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/app/components/workflow-metadata/index.hbs b/app/components/workflow-metadata/index.hbs index e0306055..ac146dd9 100644 --- a/app/components/workflow-metadata/index.hbs +++ b/app/components/workflow-metadata/index.hbs @@ -4,13 +4,22 @@

{{concat "Form" " " this.displayFormStep " " "of" " " this.schemas.length}}

- {{#if this.currentSchema}} - + + {{#if this.missingRequiredJournal}} +

Missing required journal

+

+ A repository requires information about the journal associated with the submission. + Please go back and enter a journal. +

+ {{else}} + {{#if this.currentSchema}} + + {{/if}} {{/if}} {{yield}} \ No newline at end of file diff --git a/app/components/workflow-metadata/index.js b/app/components/workflow-metadata/index.js index b1f3a887..eb894b27 100644 --- a/app/components/workflow-metadata/index.js +++ b/app/components/workflow-metadata/index.js @@ -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 # /** @@ -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));