Skip to content

Commit

Permalink
Add deposit status message to deposit status tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
rpoet-jh committed Sep 17, 2024
1 parent a9ee9e3 commit bc97b0b
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/components/submission-repo-details/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.';
Expand All @@ -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':
Expand Down
1 change: 1 addition & 0 deletions app/models/deposit.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
27 changes: 27 additions & 0 deletions tests/integration/components/submission-repo-details-test.js
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -14,4 +15,30 @@ module('Integration | Component | submission repo details', (hooks) => {
await render(hbs`<SubmissionRepoDetails />`);
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`<SubmissionRepoDetails @deposit={{this.deposit}} @submission={{this.submission}} />`);
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`<SubmissionRepoDetails @deposit={{this.deposit}} @submission={{this.submission}} />`);
assert
.dom('span.failed')
.hasAttribute(
'tooltip',
'The system failed to receive the files for this submission. Please try again by starting a new submission',
);
});
});

0 comments on commit bc97b0b

Please sign in to comment.