From 893c05dfdc77fc3f53be93efc16b02185389d47b Mon Sep 17 00:00:00 2001
From: shamoon <4887959+shamoon@users.noreply.github.com>
Date: Wed, 22 Oct 2025 18:01:50 -0700
Subject: [PATCH] Fixhancement: display loading status for tags instead of
'Private' (#11140)
---
.../components/common/tag/tag.component.html | 6 +++
.../components/common/tag/tag.component.ts | 4 ++
.../rest/abstract-paperless-service.ts | 40 +++++++++++++++----
.../app/services/rest/mail-account.service.ts | 6 +--
.../app/services/rest/mail-rule.service.ts | 6 +--
.../app/services/rest/saved-view.service.ts | 5 +--
.../src/app/services/rest/workflow.service.ts | 6 +--
7 files changed, 50 insertions(+), 23 deletions(-)
diff --git a/src-ui/src/app/components/common/tag/tag.component.html b/src-ui/src/app/components/common/tag/tag.component.html
index ce2175eae5..ebf32d0b59 100644
--- a/src-ui/src/app/components/common/tag/tag.component.html
+++ b/src-ui/src/app/components/common/tag/tag.component.html
@@ -9,6 +9,12 @@
@if (clickable) {
{{tag.name}}
}
+} @else if (loading) {
+
+
+ Loading...
+
+
} @else {
@if (!clickable) {
Private
diff --git a/src-ui/src/app/components/common/tag/tag.component.ts b/src-ui/src/app/components/common/tag/tag.component.ts
index c2f97f2a8f..35fd80a002 100644
--- a/src-ui/src/app/components/common/tag/tag.component.ts
+++ b/src-ui/src/app/components/common/tag/tag.component.ts
@@ -53,4 +53,8 @@ export class TagComponent {
@Input()
showParents: boolean = false
+
+ public get loading(): boolean {
+ return this.tagService.loading
+ }
}
diff --git a/src-ui/src/app/services/rest/abstract-paperless-service.ts b/src-ui/src/app/services/rest/abstract-paperless-service.ts
index 34e2c8aead..60f91eb5fa 100644
--- a/src-ui/src/app/services/rest/abstract-paperless-service.ts
+++ b/src-ui/src/app/services/rest/abstract-paperless-service.ts
@@ -1,7 +1,7 @@
import { HttpClient, HttpParams } from '@angular/common/http'
import { inject, Injectable } from '@angular/core'
import { Observable } from 'rxjs'
-import { map, publishReplay, refCount } from 'rxjs/operators'
+import { map, publishReplay, refCount, tap } from 'rxjs/operators'
import { ObjectWithId } from 'src/app/data/object-with-id'
import { Results } from 'src/app/data/results'
import { environment } from 'src/environments/environment'
@@ -13,6 +13,11 @@ export abstract class AbstractPaperlessService {
protected http: HttpClient
protected resourceName: string
+ protected _loading: boolean = false
+ public get loading(): boolean {
+ return this._loading
+ }
+
constructor() {
this.http = inject(HttpClient)
}
@@ -43,6 +48,7 @@ export abstract class AbstractPaperlessService {
sortReverse?: boolean,
extraParams?
): Observable> {
+ this._loading = true
let httpParams = new HttpParams()
if (page) {
httpParams = httpParams.set('page', page.toString())
@@ -59,9 +65,15 @@ export abstract class AbstractPaperlessService {
httpParams = httpParams.set(extraParamKey, extraParams[extraParamKey])
}
}
- return this.http.get>(this.getResourceUrl(), {
- params: httpParams,
- })
+ return this.http
+ .get>(this.getResourceUrl(), {
+ params: httpParams,
+ })
+ .pipe(
+ tap(() => {
+ this._loading = false
+ })
+ )
}
private _listAll: Observable>
@@ -96,6 +108,7 @@ export abstract class AbstractPaperlessService {
}
getFew(ids: number[], extraParams?): Observable> {
+ this._loading = true
let httpParams = new HttpParams()
httpParams = httpParams.set('id__in', ids.join(','))
httpParams = httpParams.set('ordering', '-id')
@@ -105,9 +118,15 @@ export abstract class AbstractPaperlessService {
httpParams = httpParams.set(extraParamKey, extraParams[extraParamKey])
}
}
- return this.http.get>(this.getResourceUrl(), {
- params: httpParams,
- })
+ return this.http
+ .get>(this.getResourceUrl(), {
+ params: httpParams,
+ })
+ .pipe(
+ tap(() => {
+ this._loading = false
+ })
+ )
}
clearCache() {
@@ -115,7 +134,12 @@ export abstract class AbstractPaperlessService {
}
get(id: number): Observable {
- return this.http.get(this.getResourceUrl(id))
+ this._loading = true
+ return this.http.get(this.getResourceUrl(id)).pipe(
+ tap(() => {
+ this._loading = false
+ })
+ )
}
create(o: T): Observable {
diff --git a/src-ui/src/app/services/rest/mail-account.service.ts b/src-ui/src/app/services/rest/mail-account.service.ts
index d4511e2d6c..54f6051e25 100644
--- a/src-ui/src/app/services/rest/mail-account.service.ts
+++ b/src-ui/src/app/services/rest/mail-account.service.ts
@@ -7,18 +7,16 @@ import { AbstractPaperlessService } from './abstract-paperless-service'
providedIn: 'root',
})
export class MailAccountService extends AbstractPaperlessService {
- loading: boolean
-
constructor() {
super()
this.resourceName = 'mail_accounts'
}
private reload() {
- this.loading = true
+ this._loading = true
this.listAll().subscribe((r) => {
this.mailAccounts = r.results
- this.loading = false
+ this._loading = false
})
}
diff --git a/src-ui/src/app/services/rest/mail-rule.service.ts b/src-ui/src/app/services/rest/mail-rule.service.ts
index bb92107a9c..e9923e5700 100644
--- a/src-ui/src/app/services/rest/mail-rule.service.ts
+++ b/src-ui/src/app/services/rest/mail-rule.service.ts
@@ -7,18 +7,16 @@ import { AbstractPaperlessService } from './abstract-paperless-service'
providedIn: 'root',
})
export class MailRuleService extends AbstractPaperlessService {
- loading: boolean
-
constructor() {
super()
this.resourceName = 'mail_rules'
}
private reload() {
- this.loading = true
+ this._loading = true
this.listAll().subscribe((r) => {
this.mailRules = r.results
- this.loading = false
+ this._loading = false
})
}
diff --git a/src-ui/src/app/services/rest/saved-view.service.ts b/src-ui/src/app/services/rest/saved-view.service.ts
index 4ea2cef65f..7bdb890a0c 100644
--- a/src-ui/src/app/services/rest/saved-view.service.ts
+++ b/src-ui/src/app/services/rest/saved-view.service.ts
@@ -17,7 +17,6 @@ export class SavedViewService extends AbstractPaperlessService {
private settingsService = inject(SettingsService)
private documentService = inject(DocumentService)
- public loading: boolean = true
private savedViews: SavedView[] = []
private savedViewDocumentCounts: Map = new Map()
private unsubscribeNotifier: Subject = new Subject()
@@ -38,12 +37,12 @@ export class SavedViewService extends AbstractPaperlessService {
tap({
next: (r) => {
this.savedViews = r.results
- this.loading = false
+ this._loading = false
this.settingsService.dashboardIsEmpty =
this.dashboardViews.length === 0
},
error: () => {
- this.loading = false
+ this._loading = false
this.settingsService.dashboardIsEmpty = true
},
})
diff --git a/src-ui/src/app/services/rest/workflow.service.ts b/src-ui/src/app/services/rest/workflow.service.ts
index ecf564f064..5c037a8e37 100644
--- a/src-ui/src/app/services/rest/workflow.service.ts
+++ b/src-ui/src/app/services/rest/workflow.service.ts
@@ -7,18 +7,16 @@ import { AbstractPaperlessService } from './abstract-paperless-service'
providedIn: 'root',
})
export class WorkflowService extends AbstractPaperlessService {
- loading: boolean
-
constructor() {
super()
this.resourceName = 'workflows'
}
public reload() {
- this.loading = true
+ this._loading = true
this.listAll().subscribe((r) => {
this.workflows = r.results
- this.loading = false
+ this._loading = false
})
}
--
2.47.3