diff --git a/src-ui/src/app/components/manage/settings/settings.component.ts b/src-ui/src/app/components/manage/settings/settings.component.ts
index 21b066fbb..e1575a831 100644
--- a/src-ui/src/app/components/manage/settings/settings.component.ts
+++ b/src-ui/src/app/components/manage/settings/settings.component.ts
@@ -84,6 +84,7 @@ export class SettingsComponent
notificationsConsumerFailed: new FormControl(null),
notificationsConsumerSuppressOnDashboard: new FormControl(null),
+ savedViewsWarnOnUnsavedChange: new FormControl(null),
savedViews: this.savedViewGroup,
mailAccounts: this.mailAccountGroup,
@@ -194,6 +195,9 @@ export class SettingsComponent
notificationsConsumerSuppressOnDashboard: this.settings.get(
SETTINGS_KEYS.NOTIFICATIONS_CONSUMER_SUPPRESS_ON_DASHBOARD
),
+ savedViewsWarnOnUnsavedChange: this.settings.get(
+ SETTINGS_KEYS.SAVED_VIEWS_WARN_ON_UNSAVED_CHANGE
+ ),
savedViews: {},
mailAccounts: {},
mailRules: {},
@@ -462,6 +466,10 @@ export class SettingsComponent
SETTINGS_KEYS.UPDATE_CHECKING_ENABLED,
this.settingsForm.value.updateCheckingEnabled
)
+ this.settings.set(
+ SETTINGS_KEYS.SAVED_VIEWS_WARN_ON_UNSAVED_CHANGE,
+ this.settingsForm.value.savedViewsWarnOnUnsavedChange
+ )
this.settings.setLanguage(this.settingsForm.value.displayLanguage)
this.settings
.storeSettings()
diff --git a/src-ui/src/app/data/paperless-uisettings.ts b/src-ui/src/app/data/paperless-uisettings.ts
index 403d11f08..07ce00c78 100644
--- a/src-ui/src/app/data/paperless-uisettings.ts
+++ b/src-ui/src/app/data/paperless-uisettings.ts
@@ -41,6 +41,8 @@ export const SETTINGS_KEYS = {
UPDATE_CHECKING_ENABLED: 'general-settings:update-checking:enabled',
UPDATE_CHECKING_BACKEND_SETTING:
'general-settings:update-checking:backend-setting',
+ SAVED_VIEWS_WARN_ON_UNSAVED_CHANGE:
+ 'general-settings:saved-views:warn-on-unsaved-change',
}
export const SETTINGS: PaperlessUiSetting[] = [
@@ -139,4 +141,9 @@ export const SETTINGS: PaperlessUiSetting[] = [
type: 'string',
default: '',
},
+ {
+ key: SETTINGS_KEYS.SAVED_VIEWS_WARN_ON_UNSAVED_CHANGE,
+ type: 'boolean',
+ default: true,
+ },
]
diff --git a/src-ui/src/app/guards/dirty-saved-view.guard.ts b/src-ui/src/app/guards/dirty-saved-view.guard.ts
index 0044a2e78..d33976eb1 100644
--- a/src-ui/src/app/guards/dirty-saved-view.guard.ts
+++ b/src-ui/src/app/guards/dirty-saved-view.guard.ts
@@ -4,17 +4,25 @@ import { first, Observable, Subject } from 'rxjs'
import { DocumentListComponent } from '../components/document-list/document-list.component'
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
import { ConfirmDialogComponent } from '../components/common/confirm-dialog/confirm-dialog.component'
+import { SettingsService } from '../services/settings.service'
+import { SETTINGS_KEYS } from '../data/paperless-uisettings'
@Injectable()
export class DirtySavedViewGuard
implements CanDeactivate
{
- constructor(private modalService: NgbModal) {}
+ constructor(
+ private modalService: NgbModal,
+ private settings: SettingsService
+ ) {}
canDeactivate(
component: DocumentListComponent
): boolean | Observable {
- return component.savedViewIsModified ? this.warn(component) : true
+ return component.savedViewIsModified &&
+ this.settings.get(SETTINGS_KEYS.SAVED_VIEWS_WARN_ON_UNSAVED_CHANGE)
+ ? this.warn(component)
+ : true
}
warn(component: DocumentListComponent) {