mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-25 15:52:35 -04:00 
			
		
		
		
	Save slimsidebar settings to db on change
This commit is contained in:
		
							parent
							
								
									d003d26a67
								
							
						
					
					
						commit
						617055fca7
					
				| @ -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 | ||||
|   } | ||||
|  | ||||
| @ -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', | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user