From fafe259e537b30301b604b6ec3ff8c6aef5cad36 Mon Sep 17 00:00:00 2001 From: jonaswinkler Date: Thu, 28 Jan 2021 10:54:56 +0100 Subject: [PATCH] added a status summary line --- src-ui/messages.xlf | 35 +++++++++++++++---- .../upload-file-widget.component.html | 9 ++--- .../upload-file-widget.component.ts | 27 +++++++++++++- .../app/services/consumer-status.service.ts | 6 +++- 4 files changed, 64 insertions(+), 13 deletions(-) diff --git a/src-ui/messages.xlf b/src-ui/messages.xlf index 84ca4888b..93f970d86 100644 --- a/src-ui/messages.xlf +++ b/src-ui/messages.xlf @@ -1414,25 +1414,46 @@ 4 + + Processing: + + src/app/components/dashboard/widgets/upload-file-widget/upload-file-widget.component.ts + 32 + + + + Failed: + + src/app/components/dashboard/widgets/upload-file-widget/upload-file-widget.component.ts + 35 + + + + Added: + + src/app/components/dashboard/widgets/upload-file-widget/upload-file-widget.component.ts + 38 + + Connecting... src/app/components/dashboard/widgets/upload-file-widget/upload-file-widget.component.ts - 93 + 118 Uploading... src/app/components/dashboard/widgets/upload-file-widget/upload-file-widget.component.ts - 98 + 123 Waiting for consumer... src/app/components/dashboard/widgets/upload-file-widget/upload-file-widget.component.ts - 101 + 126 @@ -1463,18 +1484,18 @@ 4 - - more hidden + + more hidden src/app/components/dashboard/widgets/upload-file-widget/upload-file-widget.component.html - 23 + 24 Open document src/app/components/dashboard/widgets/upload-file-widget/upload-file-widget.component.html - 40 + 41 diff --git a/src-ui/src/app/components/dashboard/widgets/upload-file-widget/upload-file-widget.component.html b/src-ui/src/app/components/dashboard/widgets/upload-file-widget/upload-file-widget.component.html index 5cabb3c85..3e2908b84 100644 --- a/src-ui/src/app/components/dashboard/widgets/upload-file-widget/upload-file-widget.component.html +++ b/src-ui/src/app/components/dashboard/widgets/upload-file-widget/upload-file-widget.component.html @@ -12,17 +12,18 @@
+

{{getStatusSummary()}}

-
-

{{getStatusesHidden().length}} more hidden

+
+

{{getStatusHidden().length}} more hidden

-
+
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 a6870e0e7..5ac68d42a 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 @@ -23,7 +23,24 @@ export class UploadFileWidgetComponent implements OnInit { return this.consumerStatusService.getConsumerStatus().slice(0, MAX_ALERTS) } - getStatusesHidden() { + getStatusSummary() { + let strings = [] + let countUploadingAndProcessing = this.consumerStatusService.getConsumerStatusNotCompleted().length + let countFailed = this.getStatusFailed().length + let countSuccess = this.getStatusSuccess().length + if (countUploadingAndProcessing > 0) { + strings.push($localize`Processing: ${countUploadingAndProcessing}`) + } + if (countFailed > 0) { + strings.push($localize`Failed: ${countFailed}`) + } + if (countSuccess > 0) { + strings.push($localize`Added: ${countSuccess}`) + } + return strings.join($localize`:this string is used to separate processing, failed and added on the file upload widget:, `) + } + + getStatusHidden() { if (this.consumerStatusService.getConsumerStatus().length < MAX_ALERTS) return [] else return this.consumerStatusService.getConsumerStatus().slice(MAX_ALERTS) } @@ -32,6 +49,14 @@ export class UploadFileWidgetComponent implements OnInit { return this.consumerStatusService.getConsumerStatus(FileStatusPhase.UPLOADING) } + getStatusFailed() { + return this.consumerStatusService.getConsumerStatus(FileStatusPhase.FAILED) + } + + getStatusSuccess() { + return this.consumerStatusService.getConsumerStatus(FileStatusPhase.SUCCESS) + } + getStatusCompleted() { return this.consumerStatusService.getConsumerStatusCompleted() } diff --git a/src-ui/src/app/services/consumer-status.service.ts b/src-ui/src/app/services/consumer-status.service.ts index c2169d51f..8151b1c18 100644 --- a/src-ui/src/app/services/consumer-status.service.ts +++ b/src-ui/src/app/services/consumer-status.service.ts @@ -90,13 +90,17 @@ export class ConsumerStatusService { } getConsumerStatus(phase?: FileStatusPhase) { - if (phase) { + if (phase != null) { return this.consumerStatus.filter(s => s.phase == phase) } else { return this.consumerStatus } } + getConsumerStatusNotCompleted() { + return this.consumerStatus.filter(s => s.phase < FileStatusPhase.SUCCESS) + } + getConsumerStatusCompleted() { return this.consumerStatus.filter(s => s.phase == FileStatusPhase.FAILED || s.phase == FileStatusPhase.SUCCESS) }