Fix: complete dashboard loading if insufficient saved view permissions
This commit is contained in:
parent
f1559b7108
commit
898ef5bc39
@ -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()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public list(
|
||||||
|
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) => {
|
||||||
|
this.savedViews = r.results
|
||||||
|
this.loading = false
|
||||||
|
this.settingsService.dashboardIsEmpty =
|
||||||
|
this.dashboardViews.length === 0
|
||||||
|
},
|
||||||
|
error: () => {
|
||||||
|
this.loading = false
|
||||||
|
this.settingsService.dashboardIsEmpty = true
|
||||||
|
},
|
||||||
|
})
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
private reload() {
|
private reload() {
|
||||||
this.listAll().subscribe({
|
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
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get allViews() {
|
get allViews() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user