Fix: complete dashboard loading if insufficient saved view permissions

This commit is contained in:
shamoon 2024-09-10 12:56:53 -07:00
parent f1559b7108
commit 898ef5bc39

View File

@ -6,6 +6,7 @@ import { SavedView } from 'src/app/data/saved-view'
import { AbstractPaperlessService } from './abstract-paperless-service' import { AbstractPaperlessService } from './abstract-paperless-service'
import { SettingsService } from '../settings.service' import { SettingsService } from '../settings.service'
import { SETTINGS_KEYS } from 'src/app/data/ui-settings' import { SETTINGS_KEYS } from 'src/app/data/ui-settings'
import { Results } from 'src/app/data/results'
@Injectable({ @Injectable({
providedIn: 'root', providedIn: 'root',
@ -25,18 +26,31 @@ export class SavedViewService extends AbstractPaperlessService<SavedView> {
this.reload() this.reload()
} }
private reload() { public list(
this.listAll().subscribe({ page?: number,
pageSize?: number,
sortField?: string,
sortReverse?: boolean,
extraParams?: any
): Observable<Results<SavedView>> {
return super.list(page, pageSize, sortField, sortReverse, extraParams).pipe(
tap({
next: (r) => { next: (r) => {
this.savedViews = r.results this.savedViews = r.results
this.loading = false this.loading = false
this.settingsService.dashboardIsEmpty = this.dashboardViews.length === 0 this.settingsService.dashboardIsEmpty =
this.dashboardViews.length === 0
}, },
error: () => { error: () => {
this.loading = false this.loading = false
this.settingsService.dashboardIsEmpty = true this.settingsService.dashboardIsEmpty = true
}, },
}) })
)
}
private reload() {
this.listAll().subscribe()
} }
get allViews() { get allViews() {