diff --git a/src-ui/src/app/components/admin/settings/settings.component.html b/src-ui/src/app/components/admin/settings/settings.component.html
index d146b3657..5b554690e 100644
--- a/src-ui/src/app/components/admin/settings/settings.component.html
+++ b/src-ui/src/app/components/admin/settings/settings.component.html
@@ -332,7 +332,7 @@
-
+
Saved views
diff --git a/src-ui/src/app/components/app-frame/app-frame.component.spec.ts b/src-ui/src/app/components/app-frame/app-frame.component.spec.ts
index c1b53d63d..1354a187e 100644
--- a/src-ui/src/app/components/app-frame/app-frame.component.spec.ts
+++ b/src-ui/src/app/components/app-frame/app-frame.component.spec.ts
@@ -115,7 +115,7 @@ describe('AppFrameComponent', () => {
{
provide: SavedViewService,
useValue: {
- initialize: () => {},
+ reload: () => {},
listAll: () =>
of({
all: [saved_views.map((v) => v.id)],
@@ -170,7 +170,7 @@ describe('AppFrameComponent', () => {
.mockReturnValue('Hello World')
jest.spyOn(permissionsService, 'currentUserCan').mockReturnValue(true)
- savedViewSpy = jest.spyOn(savedViewService, 'initialize')
+ savedViewSpy = jest.spyOn(savedViewService, 'reload')
fixture = TestBed.createComponent(AppFrameComponent)
component = fixture.componentInstance
diff --git a/src-ui/src/app/components/app-frame/app-frame.component.ts b/src-ui/src/app/components/app-frame/app-frame.component.ts
index 4d4968ea4..df6ac65a2 100644
--- a/src-ui/src/app/components/app-frame/app-frame.component.ts
+++ b/src-ui/src/app/components/app-frame/app-frame.component.ts
@@ -73,7 +73,7 @@ export class AppFrameComponent
PermissionType.SavedView
)
) {
- this.savedViewService.initialize()
+ this.savedViewService.reload()
}
}
diff --git a/src-ui/src/app/services/rest/saved-view.service.spec.ts b/src-ui/src/app/services/rest/saved-view.service.spec.ts
index 44ee8c05c..fc2d996a5 100644
--- a/src-ui/src/app/services/rest/saved-view.service.spec.ts
+++ b/src-ui/src/app/services/rest/saved-view.service.spec.ts
@@ -57,7 +57,7 @@ describe(`Additional service tests for SavedViewService`, () => {
let settingsService
it('should retrieve saved views and sort them', () => {
- service.initialize()
+ service.reload()
const req = httpTestingController.expectOne(
`${environment.apiBaseUrl}${endpoint}/?page=1&page_size=100000`
)
@@ -70,7 +70,7 @@ describe(`Additional service tests for SavedViewService`, () => {
})
it('should gracefully handle errors', () => {
- service.initialize()
+ service.reload()
const req = httpTestingController.expectOne(
`${environment.apiBaseUrl}${endpoint}/?page=1&page_size=100000`
)
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..274522c71 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',
@@ -21,22 +22,31 @@ export class SavedViewService extends AbstractPaperlessService {
super(http, 'saved_views')
}
- public initialize() {
- 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
- },
- })
+ public reload() {
+ this.listAll().subscribe()
}
get allViews() {