mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	Save slimsidebar settings to db on change
This commit is contained in:
		| @@ -24,6 +24,8 @@ import { | |||||||
| import { SettingsService } from 'src/app/services/settings.service' | import { SettingsService } from 'src/app/services/settings.service' | ||||||
| import { TasksService } from 'src/app/services/tasks.service' | import { TasksService } from 'src/app/services/tasks.service' | ||||||
| import { ComponentCanDeactivate } from 'src/app/guards/dirty-doc.guard' | 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({ | @Component({ | ||||||
|   selector: 'app-app-frame', |   selector: 'app-app-frame', | ||||||
| @@ -40,7 +42,8 @@ export class AppFrameComponent implements ComponentCanDeactivate { | |||||||
|     private remoteVersionService: RemoteVersionService, |     private remoteVersionService: RemoteVersionService, | ||||||
|     private list: DocumentListViewService, |     private list: DocumentListViewService, | ||||||
|     public settingsService: SettingsService, |     public settingsService: SettingsService, | ||||||
|     public tasksService: TasksService |     public tasksService: TasksService, | ||||||
|  |     private toastService: ToastService | ||||||
|   ) { |   ) { | ||||||
|     this.remoteVersionService |     this.remoteVersionService | ||||||
|       .checkForUpdates() |       .checkForUpdates() | ||||||
| @@ -55,6 +58,27 @@ export class AppFrameComponent implements ComponentCanDeactivate { | |||||||
|  |  | ||||||
|   isMenuCollapsed: boolean = true |   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() { |   closeMenu() { | ||||||
|     this.isMenuCollapsed = true |     this.isMenuCollapsed = true | ||||||
|   } |   } | ||||||
|   | |||||||
| @@ -37,6 +37,7 @@ export const SETTINGS_KEYS = { | |||||||
|   NOTIFICATIONS_CONSUMER_SUPPRESS_ON_DASHBOARD: |   NOTIFICATIONS_CONSUMER_SUPPRESS_ON_DASHBOARD: | ||||||
|     'general-settings:notifications:consumer-suppress-on-dashboard', |     'general-settings:notifications:consumer-suppress-on-dashboard', | ||||||
|   COMMENTS_ENABLED: 'general-settings:comments-enabled', |   COMMENTS_ENABLED: 'general-settings:comments-enabled', | ||||||
|  |   SLIM_SIDEBAR: 'general-settings:slim-sidebar', | ||||||
| } | } | ||||||
|  |  | ||||||
| export const SETTINGS: PaperlessUiSetting[] = [ | export const SETTINGS: PaperlessUiSetting[] = [ | ||||||
| @@ -55,6 +56,11 @@ export const SETTINGS: PaperlessUiSetting[] = [ | |||||||
|     type: 'boolean', |     type: 'boolean', | ||||||
|     default: false, |     default: false, | ||||||
|   }, |   }, | ||||||
|  |   { | ||||||
|  |     key: SETTINGS_KEYS.SLIM_SIDEBAR, | ||||||
|  |     type: 'boolean', | ||||||
|  |     default: false, | ||||||
|  |   }, | ||||||
|   { |   { | ||||||
|     key: SETTINGS_KEYS.DOCUMENT_LIST_SIZE, |     key: SETTINGS_KEYS.DOCUMENT_LIST_SIZE, | ||||||
|     type: 'number', |     type: 'number', | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Michael Shamoon
					Michael Shamoon