From bc97b0b09881e3bcf332e7d25050b18fcc9b13c0 Mon Sep 17 00:00:00 2001 From: Russ Poetker Date: Tue, 17 Sep 2024 10:04:09 -0400 Subject: [PATCH] Add deposit status message to deposit status tooltip --- .../submission-repo-details/index.js | 3 ++- app/models/deposit.js | 1 + .../submission-repo-details-test.js | 27 +++++++++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/app/components/submission-repo-details/index.js b/app/components/submission-repo-details/index.js index 7cdf2e601..c2fd25933 100644 --- a/app/components/submission-repo-details/index.js +++ b/app/components/submission-repo-details/index.js @@ -39,6 +39,7 @@ export default class SubmissionRepoDetails extends Component { * Return a tooltip based on the current status. */ get tooltip() { + const depositStatusMsg = this.args.deposit?.statusMessage ? ` Message: ${this.args.deposit.statusMessage}.` : ''; switch (this.status) { case 'complete': return 'Submission was accepted and processed by the repository. ID(s) have been assigned to the submitted manuscript.'; @@ -49,7 +50,7 @@ export default class SubmissionRepoDetails extends Component { case 'manuscript-required': return 'Your funder is aware of this publication and is expecting the deposit of your manuscript.'; case 'failed': - return 'The system failed to receive the files for this submission. Please try again by starting a new submission'; + return `The system failed to receive the files for this submission.${depositStatusMsg} Please try again by starting a new submission`; case 'rejected': return 'This target repository has rejected your submission. Please contact us for more details or try to submit your manuscript again.'; case 'not-submitted': diff --git a/app/models/deposit.js b/app/models/deposit.js index 5778657ce..72e373586 100644 --- a/app/models/deposit.js +++ b/app/models/deposit.js @@ -3,6 +3,7 @@ import Model, { attr, belongsTo } from '@ember-data/model'; export default class DepositModel extends Model { @attr('string') depositStatusRef; @attr('string') depositStatus; + @attr('string') statusMessage; @belongsTo('repositoryCopy', { async: false, inverse: null }) repositoryCopy; @belongsTo('submission', { async: false, inverse: null }) submission; diff --git a/tests/integration/components/submission-repo-details-test.js b/tests/integration/components/submission-repo-details-test.js index eef86acdc..65556561b 100644 --- a/tests/integration/components/submission-repo-details-test.js +++ b/tests/integration/components/submission-repo-details-test.js @@ -1,3 +1,4 @@ +import EmberObject from '@ember/object'; import { setupRenderingTest } from 'ember-qunit'; import hbs from 'htmlbars-inline-precompile'; import { module, test } from 'qunit'; @@ -14,4 +15,30 @@ module('Integration | Component | submission repo details', (hooks) => { await render(hbs``); assert.ok(true); }); + + test('renders deposit status message when present on failed', async function (assert) { + this.set('submission', EmberObject.create({ submitted: true })); + this.set('deposit', EmberObject.create({ depositStatus: 'failed', statusMessage: 'test-status-message' })); + + await render(hbs``); + assert + .dom('span.failed') + .hasAttribute( + 'tooltip', + 'The system failed to receive the files for this submission. Message: test-status-message. Please try again by starting a new submission', + ); + }); + + test('does not render deposit status message when not present on failed', async function (assert) { + this.set('submission', EmberObject.create({ submitted: true })); + this.set('deposit', EmberObject.create({ depositStatus: 'failed' })); + + await render(hbs``); + assert + .dom('span.failed') + .hasAttribute( + 'tooltip', + 'The system failed to receive the files for this submission. Please try again by starting a new submission', + ); + }); });