From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Sat, 18 Mar 2023 21:25:37 +0000 (-0700) Subject: truncate long mime types + limit total types displayed X-Git-Tag: v1.14.0-beta.rc1~32^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2bc7f0b8e0fa1c7b44d4e184feb9dd365aa072a2;p=thirdparty%2Fpaperless-ngx.git truncate long mime types + limit total types displayed --- diff --git a/src-ui/messages.xlf b/src-ui/messages.xlf index 284beceb2f..1be4f94fe2 100644 --- a/src-ui/messages.xlf +++ b/src-ui/messages.xlf @@ -2244,6 +2244,13 @@ 17 + + other + + src/app/components/dashboard/widgets/statistics-widget/statistics-widget.component.ts + 56 + + Upload new documents diff --git a/src-ui/src/app/components/dashboard/widgets/statistics-widget/statistics-widget.component.html b/src-ui/src/app/components/dashboard/widgets/statistics-widget/statistics-widget.component.html index ad971b4918..f85176fded 100644 --- a/src-ui/src/app/components/dashboard/widgets/statistics-widget/statistics-widget.component.html +++ b/src-ui/src/app/components/dashboard/widgets/statistics-widget/statistics-widget.component.html @@ -15,32 +15,13 @@
File types:
-
+
- {{filetype.mime_type}} + {{filetype.mime_type}} {{getFileTypePercent(filetype) | number: '1.0-1'}}%
-
diff --git a/src-ui/src/app/components/dashboard/widgets/statistics-widget/statistics-widget.component.scss b/src-ui/src/app/components/dashboard/widgets/statistics-widget/statistics-widget.component.scss index 74f88314ca..6b26f8f008 100644 --- a/src-ui/src/app/components/dashboard/widgets/statistics-widget/statistics-widget.component.scss +++ b/src-ui/src/app/components/dashboard/widgets/statistics-widget/statistics-widget.component.scss @@ -1,3 +1,7 @@ .flex-column { row-gap: 0.2rem; } + +.filetypes-list { + max-width: 75%; +} diff --git a/src-ui/src/app/components/dashboard/widgets/statistics-widget/statistics-widget.component.ts b/src-ui/src/app/components/dashboard/widgets/statistics-widget/statistics-widget.component.ts index 1b4daa3008..0daecd91fa 100644 --- a/src-ui/src/app/components/dashboard/widgets/statistics-widget/statistics-widget.component.ts +++ b/src-ui/src/app/components/dashboard/widgets/statistics-widget/statistics-widget.component.ts @@ -48,6 +48,20 @@ export class StatisticsWidgetComponent implements OnInit, OnDestroy { this.loading = true this.getStatistics().subscribe((statistics) => { this.loading = false + // truncate the list and sum others + if (statistics.document_file_type_counts?.length > 4) { + let others = statistics.document_file_type_counts.slice(4) + statistics.document_file_type_counts = + statistics.document_file_type_counts.slice(0, 4) + statistics.document_file_type_counts.push({ + mime_type: $localize`other`, + mime_type_count: others.reduce( + (currentValue, documentFileType) => + documentFileType.mime_type_count + currentValue, + 0 + ), + }) + } this.statistics = statistics }) }