@@ -84,54 +84,54 @@
- @if (loading) {
+ @if (loading()) {
}
- @if (statistics?.tag_count > 0) {
+ @if (statistics()?.tag_count > 0) {
Tags:
- {{statistics?.tag_count | number}}
+ {{statistics()?.tag_count | number}}
}
- @if (loading) {
+ @if (loading()) {
}
- @if (statistics?.correspondent_count > 0) {
+ @if (statistics()?.correspondent_count > 0) {
Correspondents:
- {{statistics?.correspondent_count | number}}
+ {{statistics()?.correspondent_count | number}}
}
- @if (loading) {
+ @if (loading()) {
}
- @if (statistics?.document_type_count > 0) {
+ @if (statistics()?.document_type_count > 0) {
Document Types:
- {{statistics?.document_type_count | number}}
+ {{statistics()?.document_type_count | number}}
}
- @if (loading) {
+ @if (loading()) {
}
- @if (statistics?.storage_path_count > 0) {
+ @if (statistics()?.storage_path_count > 0) {
Storage Paths:
- {{statistics?.storage_path_count | number}}
+ {{statistics()?.storage_path_count | number}}
}
diff --git a/src-ui/src/app/components/dashboard/widgets/statistics-widget/statistics-widget.component.spec.ts b/src-ui/src/app/components/dashboard/widgets/statistics-widget/statistics-widget.component.spec.ts
index f5f930190..74ba2c8ab 100644
--- a/src-ui/src/app/components/dashboard/widgets/statistics-widget/statistics-widget.component.spec.ts
+++ b/src-ui/src/app/components/dashboard/widgets/statistics-widget/statistics-widget.component.spec.ts
@@ -74,7 +74,7 @@ describe('StatisticsWidgetComponent', () => {
it('should not call statistics endpoint on reload if already loading', () => {
httpTestingController.expectOne(`${environment.apiBaseUrl}statistics/`)
- component.loading = true
+ component.loading.set(true)
component.reload()
httpTestingController.expectNone(`${environment.apiBaseUrl}statistics/`)
})
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 b74ad1aec..a1e984061 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
@@ -55,36 +55,20 @@ export class StatisticsWidgetComponent
private websocketConnectionService = inject(WebsocketStatusService)
private documentListViewService = inject(DocumentListViewService)
- private loadingSignal = signal(false)
- private statisticsSignal = signal
({})
-
- get loading(): boolean {
- return this.loadingSignal()
- }
-
- set loading(value: boolean) {
- this.loadingSignal.set(value)
- }
-
- get statistics(): Statistics {
- return this.statisticsSignal()
- }
-
- set statistics(value: Statistics) {
- this.statisticsSignal.set(value)
- }
+ readonly loading = signal(false)
+ readonly statistics = signal({})
subscription: Subscription
private unsubscribeNotifer: Subject = new Subject()
reload() {
- if (this.loading) return
- this.loading = true
+ if (this.loading()) return
+ this.loading.set(true)
this.http
.get(`${environment.apiBaseUrl}statistics/`)
.pipe(takeUntil(this.unsubscribeNotifer), first())
.subscribe((statistics) => {
- this.loading = false
+ this.loading.set(false)
const fileTypeMax = 5
if (statistics.document_file_type_counts?.length > fileTypeMax) {
const others = statistics.document_file_type_counts.slice(fileTypeMax)
@@ -100,7 +84,7 @@ export class StatisticsWidgetComponent
),
})
}
- this.statistics = statistics
+ this.statistics.set(statistics)
})
}
@@ -116,11 +100,11 @@ export class StatisticsWidgetComponent
}
getFileTypePercent(filetype: DocumentFileType): number {
- return (filetype.mime_type_count / this.statistics?.documents_total) * 100
+ return (filetype.mime_type_count / this.statistics()?.documents_total) * 100
}
getItemOpacity(i: number): number {
- return 1 - i / this.statistics?.document_file_type_counts.length
+ return 1 - i / this.statistics()?.document_file_type_counts.length
}
ngOnInit(): void {
@@ -142,8 +126,8 @@ export class StatisticsWidgetComponent
this.documentListViewService.quickFilter([
{
rule_type: FILTER_HAS_TAGS_ANY,
- value: this.statistics.inbox_tags
- .map((tagID) => tagID.toString())
+ value: this.statistics()
+ .inbox_tags.map((tagID) => tagID.toString())
.join(','),
},
])
diff --git a/src-ui/src/app/components/dashboard/widgets/widget-frame/widget-frame.component.html b/src-ui/src/app/components/dashboard/widgets/widget-frame/widget-frame.component.html
index ff13d1050..6029e2167 100644
--- a/src-ui/src/app/components/dashboard/widgets/widget-frame/widget-frame.component.html
+++ b/src-ui/src/app/components/dashboard/widgets/widget-frame/widget-frame.component.html
@@ -1,5 +1,5 @@
@if (!cardless()) {
-