From 898ef5bc399fa9ee19fe6b88b02cee444e4d218b Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Tue, 10 Sep 2024 12:56:53 -0700 Subject: [PATCH] Fix: complete dashboard loading if insufficient saved view permissions --- .../app/services/rest/saved-view.service.ts | 36 +++++++++++++------ 1 file changed, 25 insertions(+), 11 deletions(-) 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 1b81f2054..fd64af4b5 100644 --- a/src-ui/src/app/services/rest/saved-view.service.ts +++ b/src-ui/src/app/services/rest/saved-view.service.ts @@ -6,6 +6,7 @@ import { SavedView } from 'src/app/data/saved-view' import { AbstractPaperlessService } from './abstract-paperless-service' import { SettingsService } from '../settings.service' import { SETTINGS_KEYS } from 'src/app/data/ui-settings' +import { Results } from 'src/app/data/results' @Injectable({ providedIn: 'root', @@ -25,18 +26,31 @@ export class SavedViewService extends AbstractPaperlessService { this.reload() } + public list( + page?: number, + pageSize?: number, + sortField?: string, + sortReverse?: boolean, + extraParams?: any + ): Observable> { + return super.list(page, pageSize, sortField, sortReverse, extraParams).pipe( + tap({ + next: (r) => { + this.savedViews = r.results + this.loading = false + this.settingsService.dashboardIsEmpty = + this.dashboardViews.length === 0 + }, + error: () => { + this.loading = false + this.settingsService.dashboardIsEmpty = true + }, + }) + ) + } + private reload() { - this.listAll().subscribe({ - next: (r) => { - this.savedViews = r.results - this.loading = false - this.settingsService.dashboardIsEmpty = this.dashboardViews.length === 0 - }, - error: () => { - this.loading = false - this.settingsService.dashboardIsEmpty = true - }, - }) + this.listAll().subscribe() } get allViews() {