Fix: cleanup saved view references on custom field deletion, auto-refresh views, show error on saved view save (#9225)

This commit is contained in:
shamoon
2025-02-26 10:09:41 -08:00
committed by GitHub
parent 61cb5103ed
commit edc0e6f859
7 changed files with 154 additions and 42 deletions

View File

@@ -376,7 +376,7 @@ describe('DocumentListComponent', () => {
expect(documentListService.selected.size).toEqual(3)
})
it('should support saving an edited view', () => {
it('should support saving a view', () => {
const view: SavedView = {
id: 10,
name: 'Saved View 10',
@@ -414,6 +414,30 @@ describe('DocumentListComponent', () => {
)
})
it('should handle error on view saving', () => {
component.list.activateSavedView({
id: 10,
name: 'Saved View 10',
sort_field: 'added',
sort_reverse: true,
filter_rules: [
{
rule_type: FILTER_HAS_TAGS_ANY,
value: '20',
},
],
})
const toastErrorSpy = jest.spyOn(toastService, 'showError')
jest
.spyOn(savedViewService, 'patch')
.mockReturnValueOnce(throwError(() => new Error('Error saving view')))
component.saveViewConfig()
expect(toastErrorSpy).toHaveBeenCalledWith(
'Failed to save view "Saved View 10".',
expect.any(Error)
)
})
it('should support edited view saving as', () => {
const view: SavedView = {
id: 10,