Skip to content

A community-supported supercharged document management system: scan, index and archive all your documents

Save slimsidebar settings to db on change

Michael Shamoon617055fca73a
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 6e758d262..9c415360c 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
@@ -24,6 +24,8 @@ import {
import { SettingsService } from 'src/app/services/settings.service'
import { TasksService } from 'src/app/services/tasks.service'
import { ComponentCanDeactivate } from 'src/app/guards/dirty-doc.guard'
+import { SETTINGS_KEYS } from 'src/app/data/paperless-uisettings'
+import { ToastService } from 'src/app/services/toast.service'
@Component({
selector: 'app-app-frame',
@@ -40,7 +42,8 @@ export class AppFrameComponent implements ComponentCanDeactivate {
private remoteVersionService: RemoteVersionService,
private list: DocumentListViewService,
public settingsService: SettingsService,
- public tasksService: TasksService
+ public tasksService: TasksService,
+ private toastService: ToastService
) {
this.remoteVersionService
.checkForUpdates()
@@ -55,6 +58,27 @@ export class AppFrameComponent implements ComponentCanDeactivate {
isMenuCollapsed: boolean = true
+ get slimSidebarEnabled(): boolean {
+ return this.settingsService.get(SETTINGS_KEYS.SLIM_SIDEBAR)
+ }
+
+ set slimSidebarEnabled(enabled: boolean) {
+ console.log('set slimSidebarEnabled', enabled)
+
+ this.settingsService.set(SETTINGS_KEYS.SLIM_SIDEBAR, enabled)
+ this.settingsService
+ .storeSettings()
+ .pipe(first())
+ .subscribe({
+ error: (error) => {
+ this.toastService.showError(
+ $localize`An error occurred while saving settings.`
+ )
+ console.log(error)
+ },
+ })
+ }
+
closeMenu() {
this.isMenuCollapsed = true
}
diff --git a/src-ui/src/app/data/paperless-uisettings.ts b/src-ui/src/app/data/paperless-uisettings.ts
index e3d977687..a5fdef51f 100644
--- a/src-ui/src/app/data/paperless-uisettings.ts
+++ b/src-ui/src/app/data/paperless-uisettings.ts
@@ -37,6 +37,7 @@ export const SETTINGS_KEYS = {
NOTIFICATIONS_CONSUMER_SUPPRESS_ON_DASHBOARD:
'general-settings:notifications:consumer-suppress-on-dashboard',
COMMENTS_ENABLED: 'general-settings:comments-enabled',
+ SLIM_SIDEBAR: 'general-settings:slim-sidebar',
}
export const SETTINGS: PaperlessUiSetting[] = [
@@ -55,6 +56,11 @@ export const SETTINGS: PaperlessUiSetting[] = [
type: 'boolean',
default: false,
},
+ {
+ key: SETTINGS_KEYS.SLIM_SIDEBAR,
+ type: 'boolean',
+ default: false,
+ },
{
key: SETTINGS_KEYS.DOCUMENT_LIST_SIZE,
type: 'number',