Skip to content

Commit 836c911

Browse files
[UXP-198] Add error state and remove refresh option from state imported
1 parent 41afc4e commit 836c911

4 files changed

Lines changed: 9 additions & 1 deletion

File tree

src/app/submission/sections/unpaywall/models/unpaywall-section-status.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ export enum UnpaywallSectionStatus {
44
SUCCESSFUL = 'SUCCESSFUL',
55
NO_FILE = 'NO_FILE',
66
IMPORTED = 'IMPORTED',
7+
ERROR = 'ERROR',
78
}

src/app/submission/sections/unpaywall/submission-section-unpaywall.component.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
<ds-alert [type]="AlertType.Error"
2323
[content]="'submission.sections.unpaywall.status.not-found' | translate"></ds-alert>
2424
</ng-container>
25+
<ng-container *ngSwitchCase="UnpaywallSectionStatus.ERROR">
26+
<ds-alert [type]="AlertType.Error"
27+
[content]="'submission.sections.unpaywall.status.error' | translate"></ds-alert>
28+
</ng-container>
2529
</div>
2630
</div>
2731
</div>
@@ -31,6 +35,7 @@
3135
<ds-themed-loading *ngSwitchCase="true" class="ds-themed-loading"></ds-themed-loading>
3236
<ng-container *ngSwitchCase="false">
3337
<button type="button" class="btn btn-secondary mr-2" aria-label="refresh"
38+
*ngIf="(status$ | async) !== UnpaywallSectionStatus.IMPORTED"
3439
(click)="refreshApiCheck()">
3540
<span aria-hidden="true">{{'submission.sections.unpaywall.refresh' | translate}}</span>
3641
</button>

src/app/submission/sections/unpaywall/submission-section-unpaywall.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ export class SubmissionSectionUnpaywallComponent extends SectionModelComponent i
289289
this.notificationsService.error(err?.message);
290290
return of(Object.assign({}, {
291291
...this.unpaywallSection$.getValue(),
292-
status: UnpaywallSectionStatus.NO_FILE
292+
status: UnpaywallSectionStatus.ERROR
293293
}));
294294
}),
295295
).subscribe((unpaywall) => {

src/assets/i18n/en.json5

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6831,6 +6831,8 @@
68316831

68326832
"submission.sections.unpaywall.import": "Import from Unpaywall",
68336833

6834+
"submission.sections.unpaywall.status.error": "An unexpected error has occurred.",
6835+
68346836
"submission.sections.unpaywall.status.successful": "There are available files to import from Unpaywall.",
68356837

68366838
"submission.sections.unpaywall.status.not-found": "Cannot find record using Unpaywall API.",

0 commit comments

Comments
 (0)