Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add deposit status message to deposit status tooltip #1290

Merged
merged 1 commit into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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',
);
});
});
Loading