From 5a4cb5fe4a805b26301b039ce0f1d50625dc02be Mon Sep 17 00:00:00 2001 From: jonaswinkler Date: Wed, 27 Jan 2021 16:04:06 +0100 Subject: [PATCH] proper messages when uploading fails --- .../upload-file-widget/upload-file-widget.component.ts | 5 ++--- src-ui/src/app/services/consumer-status.service.ts | 8 +++++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src-ui/src/app/components/dashboard/widgets/upload-file-widget/upload-file-widget.component.ts b/src-ui/src/app/components/dashboard/widgets/upload-file-widget/upload-file-widget.component.ts index 8c2dfec07..1c5ed5438 100644 --- a/src-ui/src/app/components/dashboard/widgets/upload-file-widget/upload-file-widget.component.ts +++ b/src-ui/src/app/components/dashboard/widgets/upload-file-widget/upload-file-widget.component.ts @@ -99,14 +99,13 @@ export class UploadFileWidgetComponent implements OnInit { } }, error => { - status.updateProgress(FileStatusPhase.FAILED) switch (error.status) { case 400: { - status.message = error.error.document + this.consumerStatusService.fail(status, error.error.document) break; } default: { - status.message = `${error.status} ${error.statusText}` + this.consumerStatusService.fail(status, `${error.status} ${error.statusText}`) break; } } diff --git a/src-ui/src/app/services/consumer-status.service.ts b/src-ui/src/app/services/consumer-status.service.ts index 90ba4f0ef..a3c942499 100644 --- a/src-ui/src/app/services/consumer-status.service.ts +++ b/src-ui/src/app/services/consumer-status.service.ts @@ -117,6 +117,12 @@ export class ConsumerStatusService { } } + fail(status: FileStatus, message: string) { + status.message = message + status.phase = FileStatusPhase.FAILED + this.documentConsumptionFailedSubject.next(status) + } + disconnect() { if (this.statusWebSocked) { this.statusWebSocked.close() @@ -133,7 +139,7 @@ export class ConsumerStatusService { } dismissAll() { - this.consumerStatus = [] + this.consumerStatus = this.consumerStatus.filter(status => status.phase < FileStatusPhase.SUCCESS) } onDocumentConsumptionFinished() {