mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	fix code style issues
solve merge conflicts format code format code format code
This commit is contained in:
		
							
								
								
									
										3
									
								
								.github/workflows/project-actions.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.github/workflows/project-actions.yml
									
									
									
									
										vendored
									
									
								
							| @@ -8,9 +8,6 @@ on: | |||||||
|     types: |     types: | ||||||
|       - opened |       - opened | ||||||
|       - reopened |       - reopened | ||||||
|     branches: |  | ||||||
|       - main |  | ||||||
|       - dev |  | ||||||
|  |  | ||||||
| # map fields with customized labels | # map fields with customized labels | ||||||
| env: | env: | ||||||
|   | |||||||
| @@ -2,179 +2,176 @@ | |||||||
| 	"$schema": "./node_modules/@angular/cli/lib/config/schema.json", | 	"$schema": "./node_modules/@angular/cli/lib/config/schema.json", | ||||||
| 	"version": 1, | 	"version": 1, | ||||||
| 	"newProjectRoot": "projects", | 	"newProjectRoot": "projects", | ||||||
|   "projects": { | 	"projects": { | ||||||
|     "paperless-ui": { | 		"paperless-ui": { | ||||||
|       "projectType": "application", | 			"projectType": "application", | ||||||
|       "schematics": { | 			"schematics": { | ||||||
|         "@schematics/angular:component": { | 				"@schematics/angular:component": { | ||||||
|           "style": "scss" | 					"style": "scss" | ||||||
|         } | 				} | ||||||
|       }, | 			}, | ||||||
|       "root": "", | 			"root": "", | ||||||
|       "sourceRoot": "src", | 			"sourceRoot": "src", | ||||||
|       "prefix": "app", | 			"prefix": "app", | ||||||
|       "i18n": { | 			"i18n": { | ||||||
|         "sourceLocale": "en-US", | 				"sourceLocale": "en-US", | ||||||
|         "locales": { | 				"locales": { | ||||||
|           "cs-CZ": "src/locale/messages.cs_CZ.xlf", | 					"cs-CZ": "src/locale/messages.cs_CZ.xlf", | ||||||
|           "da-DK": "src/locale/messages.da_DK.xlf", | 					"da-DK": "src/locale/messages.da_DK.xlf", | ||||||
|           "de-DE": "src/locale/messages.de_DE.xlf", | 					"de-DE": "src/locale/messages.de_DE.xlf", | ||||||
|           "en-GB": "src/locale/messages.en_GB.xlf", | 					"en-GB": "src/locale/messages.en_GB.xlf", | ||||||
|           "es-ES": "src/locale/messages.es_ES.xlf", | 					"es-ES": "src/locale/messages.es_ES.xlf", | ||||||
|           "fr-FR": "src/locale/messages.fr_FR.xlf", | 					"fr-FR": "src/locale/messages.fr_FR.xlf", | ||||||
|           "it-IT": "src/locale/messages.it_IT.xlf", | 					"it-IT": "src/locale/messages.it_IT.xlf", | ||||||
|           "lb-LU": "src/locale/messages.lb_LU.xlf", | 					"lb-LU": "src/locale/messages.lb_LU.xlf", | ||||||
|           "nl-NL": "src/locale/messages.nl_NL.xlf", | 					"nl-NL": "src/locale/messages.nl_NL.xlf", | ||||||
|           "pl-PL": "src/locale/messages.pl_PL.xlf", | 					"pl-PL": "src/locale/messages.pl_PL.xlf", | ||||||
|           "pt-BR": "src/locale/messages.pt_BR.xlf", | 					"pt-BR": "src/locale/messages.pt_BR.xlf", | ||||||
|           "pt-PT": "src/locale/messages.pt_PT.xlf", | 					"pt-PT": "src/locale/messages.pt_PT.xlf", | ||||||
|           "ro-RO": "src/locale/messages.ro_RO.xlf", | 					"ro-RO": "src/locale/messages.ro_RO.xlf", | ||||||
|           "ru-RU": "src/locale/messages.ru_RU.xlf", | 					"ru-RU": "src/locale/messages.ru_RU.xlf", | ||||||
|           "sl-SI": "src/locale/messages.sl_SI.xlf", | 					"sl-SI": "src/locale/messages.sl_SI.xlf", | ||||||
|           "sr-CS": "src/locale/messages.sr_CS.xlf", | 					"sr-CS": "src/locale/messages.sr_CS.xlf", | ||||||
|           "sv-SE": "src/locale/messages.sv_SE.xlf", | 					"sv-SE": "src/locale/messages.sv_SE.xlf", | ||||||
|           "zh-CN": "src/locale/messages.zh_CN.xlf" | 					"zh-CN": "src/locale/messages.zh_CN.xlf" | ||||||
|         } | 				} | ||||||
|       }, | 			}, | ||||||
|       "architect": { | 			"architect": { | ||||||
|         "build": { | 				"build": { | ||||||
|           "builder": "@angular-devkit/build-angular:browser", | 					"builder": "@angular-devkit/build-angular:browser", | ||||||
|           "options": { | 					"options": { | ||||||
|             "outputPath": "dist/paperless-ui", | 						"outputPath": "dist/paperless-ui", | ||||||
|             "outputHashing": "none", | 						"outputHashing": "none", | ||||||
|             "index": "src/index.html", | 						"index": "src/index.html", | ||||||
|             "main": "src/main.ts", | 						"main": "src/main.ts", | ||||||
|             "polyfills": "src/polyfills.ts", | 						"polyfills": "src/polyfills.ts", | ||||||
|             "tsConfig": "tsconfig.app.json", | 						"tsConfig": "tsconfig.app.json", | ||||||
|             "localize": true, | 						"localize": true, | ||||||
|             "assets": [ | 						"assets": [ | ||||||
|               "src/favicon.ico", | 							"src/favicon.ico", | ||||||
|               "src/apple-touch-icon.png", | 							"src/apple-touch-icon.png", | ||||||
|               "src/assets", | 							"src/assets", | ||||||
|               "src/manifest.webmanifest", | 							"src/manifest.webmanifest", { | ||||||
|               { | 								"glob": "pdf.worker.min.js", | ||||||
|                 "glob": "pdf.worker.min.js", | 								"input": "node_modules/pdfjs-dist/build/", | ||||||
|                 "input": "node_modules/pdfjs-dist/build/", | 								"output": "/assets/js/" | ||||||
|                 "output": "/assets/js/" | 							} | ||||||
|               } | 						], | ||||||
|             ], | 						"styles": [ | ||||||
|             "styles": [ | 							"src/styles.scss" | ||||||
|               "src/styles.scss" | 						], | ||||||
|             ], | 						"scripts": [], | ||||||
|             "scripts": [], | 						"allowedCommonJsDependencies": [ | ||||||
|             "allowedCommonJsDependencies": [ | 							"ng2-pdf-viewer" | ||||||
|               "ng2-pdf-viewer" | 						], | ||||||
|             ], | 						"vendorChunk": true, | ||||||
|             "vendorChunk": true, | 						"extractLicenses": false, | ||||||
|             "extractLicenses": false, | 						"buildOptimizer": false, | ||||||
|             "buildOptimizer": false, | 						"sourceMap": true, | ||||||
|             "sourceMap": true, | 						"optimization": false, | ||||||
|             "optimization": false, | 						"namedChunks": true | ||||||
|             "namedChunks": true | 					}, | ||||||
|           }, | 					"configurations": { | ||||||
|           "configurations": { | 						"production": { | ||||||
|             "production": { | 							"fileReplacements": [ | ||||||
|               "fileReplacements": [ | 								{ | ||||||
|                 { | 									"replace": "src/environments/environment.ts", | ||||||
|                   "replace": "src/environments/environment.ts", | 									"with": "src/environments/environment.prod.ts" | ||||||
|                   "with": "src/environments/environment.prod.ts" | 								} | ||||||
|                 } | 							], | ||||||
|               ], | 							"outputPath": "../src/documents/static/frontend/", | ||||||
|               "outputPath": "../src/documents/static/frontend/", | 							"optimization": true, | ||||||
|               "optimization": true, | 							"outputHashing": "none", | ||||||
|               "outputHashing": "none", | 							"sourceMap": false, | ||||||
|               "sourceMap": false, | 							"namedChunks": false, | ||||||
|               "namedChunks": false, | 							"extractLicenses": true, | ||||||
|               "extractLicenses": true, | 							"vendorChunk": false, | ||||||
|               "vendorChunk": false, | 							"buildOptimizer": true, | ||||||
|               "buildOptimizer": true, | 							"budgets": [ | ||||||
|               "budgets": [ | 								{ | ||||||
|                 { | 									"type": "initial", | ||||||
|                   "type": "initial", | 									"maximumWarning": "2mb", | ||||||
|                   "maximumWarning": "2mb", | 									"maximumError": "5mb" | ||||||
|                   "maximumError": "5mb" | 								}, | ||||||
|                 }, | 								{ | ||||||
|                 { | 									"type": "anyComponentStyle", | ||||||
|                   "type": "anyComponentStyle", | 									"maximumWarning": "6kb", | ||||||
|                   "maximumWarning": "6kb", | 									"maximumError": "10kb" | ||||||
|                   "maximumError": "10kb" | 								} | ||||||
|                 } | 							] | ||||||
|               ] | 						}, | ||||||
|             }, | 						"en-US": { | ||||||
|             "en-US": { | 							"localize": ["en-US"] | ||||||
|               "localize": [ | 						} | ||||||
|                 "en-US" | 					}, | ||||||
|               ] | 					"defaultConfiguration": "" | ||||||
|             } | 				}, | ||||||
|           }, | 				"serve": { | ||||||
|           "defaultConfiguration": "" | 					"builder": "@angular-devkit/build-angular:dev-server", | ||||||
|         }, | 					"options": { | ||||||
|         "serve": { | 						"browserTarget": "paperless-ui:build:en-US" | ||||||
|           "builder": "@angular-devkit/build-angular:dev-server", | 					}, | ||||||
|           "options": { | 					"configurations": { | ||||||
|             "browserTarget": "paperless-ui:build:en-US" | 						"production": { | ||||||
|           }, | 							"browserTarget": "paperless-ui:build:production" | ||||||
|           "configurations": { | 						} | ||||||
|             "production": { | 					} | ||||||
|               "browserTarget": "paperless-ui:build:production" | 				}, | ||||||
|             } | 				"extract-i18n": { | ||||||
|           } | 					"builder": "@angular-devkit/build-angular:extract-i18n", | ||||||
|         }, | 					"options": { | ||||||
|         "extract-i18n": { | 						"browserTarget": "paperless-ui:build" | ||||||
|           "builder": "@angular-devkit/build-angular:extract-i18n", | 					} | ||||||
|           "options": { | 				}, | ||||||
|             "browserTarget": "paperless-ui:build" | 				"test": { | ||||||
|           } | 					"builder": "@angular-builders/jest:run", | ||||||
|         }, | 					"options": { | ||||||
|         "test": { | 						"tsConfig": "tsconfig.spec.json", | ||||||
|           "builder": "@angular-builders/jest:run", | 						"assets": [ | ||||||
|           "options": { | 							"src/favicon.ico", | ||||||
|             "tsConfig": "tsconfig.spec.json", | 							"src/apple-touch-icon.png", | ||||||
|             "assets": [ | 							"src/assets", | ||||||
|               "src/favicon.ico", | 							"src/manifest.webmanifest" | ||||||
|               "src/apple-touch-icon.png", | 						], | ||||||
|               "src/assets", | 						"styles": [ | ||||||
|               "src/manifest.webmanifest" | 							"src/styles.scss" | ||||||
|             ], | 						], | ||||||
|             "styles": [ | 						"scripts": [] | ||||||
|               "src/styles.scss" | 					} | ||||||
|             ], | 				}, | ||||||
|             "scripts": [] | 				"e2e": { | ||||||
|           } | 					"builder": "@cypress/schematic:cypress", | ||||||
|         }, | 					"options": { | ||||||
|         "e2e": { | 						"devServerTarget": "paperless-ui:serve", | ||||||
|           "builder": "@cypress/schematic:cypress", | 						"watch": true, | ||||||
|           "options": { | 						"headless": false | ||||||
|             "devServerTarget": "paperless-ui:serve", | 					}, | ||||||
|             "watch": true, | 					"configurations": { | ||||||
|             "headless": false | 						"production": { | ||||||
|           }, | 							"devServerTarget": "paperless-ui:serve:production" | ||||||
|           "configurations": { | 						} | ||||||
|             "production": { | 					} | ||||||
|               "devServerTarget": "paperless-ui:serve:production" | 				}, | ||||||
|             } | 				"cypress-run": { | ||||||
|           } | 					"builder": "@cypress/schematic:cypress", | ||||||
|         }, | 					"options": { | ||||||
|         "cypress-run": { | 						"devServerTarget": "paperless-ui:serve" | ||||||
|           "builder": "@cypress/schematic:cypress", | 					}, | ||||||
|           "options": { | 					"configurations": { | ||||||
|             "devServerTarget": "paperless-ui:serve" | 						"production": { | ||||||
|           }, | 							"devServerTarget": "paperless-ui:serve:production" | ||||||
|           "configurations": { | 						} | ||||||
|             "production": { | 					} | ||||||
|               "devServerTarget": "paperless-ui:serve:production" | 				}, | ||||||
|             } | 				"cypress-open": { | ||||||
|           } | 					"builder": "@cypress/schematic:cypress", | ||||||
|         }, | 					"options": { | ||||||
|         "cypress-open": { | 						"watch": true, | ||||||
|           "builder": "@cypress/schematic:cypress", | 						"headless": false | ||||||
|           "options": { | 					} | ||||||
|             "watch": true, | 				} | ||||||
|             "headless": false | 			} | ||||||
|           } | 		} | ||||||
|         } | 	}, | ||||||
|       } | 	"defaultProject": "paperless-ui" | ||||||
|     } |  | ||||||
|   }, |  | ||||||
|   "defaultProject": "paperless-ui" |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -1,8 +1,8 @@ | |||||||
| module.exports = { | module.exports = { | ||||||
|   moduleNameMapper: { |   moduleNameMapper: { | ||||||
|     "@core/(.*)": "<rootDir>/src/app/core/$1", |     '@core/(.*)': '<rootDir>/src/app/core/$1', | ||||||
|   }, |   }, | ||||||
|   preset: "jest-preset-angular", |   preset: 'jest-preset-angular', | ||||||
|   setupFilesAfterEnv: ["<rootDir>/setup-jest.ts"], |   setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'], | ||||||
|   testPathIgnorePatterns: ["/node_modules/", "/cypress/"], |   testPathIgnorePatterns: ['/node_modules/', '/cypress/'], | ||||||
| }; | } | ||||||
|   | |||||||
| @@ -9,7 +9,7 @@ | |||||||
|     "lint": "ng lint", |     "lint": "ng lint", | ||||||
|     "e2e": "ng e2e", |     "e2e": "ng e2e", | ||||||
|     "cy:run": "cypress run", |     "cy:run": "cypress run", | ||||||
|     "e2e:ci": "concurrently \"npm run start\" \"wait-on http-get://localhost:4200 && npm run cy:run\" --kill-others --success first" |     "e2e:ci": "concurrently 'npm run start' 'wait-on http-get://localhost:4200 && npm run cy:run' --kill-others --success first" | ||||||
|   }, |   }, | ||||||
|   "private": true, |   "private": true, | ||||||
|   "dependencies": { |   "dependencies": { | ||||||
|   | |||||||
| @@ -1,30 +1,30 @@ | |||||||
| import 'jest-preset-angular/setup-jest'; | import 'jest-preset-angular/setup-jest' | ||||||
|  |  | ||||||
| /* global mocks for jsdom */ | /* global mocks for jsdom */ | ||||||
| const mock = () => { | const mock = () => { | ||||||
|   let storage: { [key: string]: string } = {}; |   let storage: { [key: string]: string } = {} | ||||||
|   return { |   return { | ||||||
|     getItem: (key: string) => (key in storage ? storage[key] : null), |     getItem: (key: string) => (key in storage ? storage[key] : null), | ||||||
|     setItem: (key: string, value: string) => (storage[key] = value || ''), |     setItem: (key: string, value: string) => (storage[key] = value || ''), | ||||||
|     removeItem: (key: string) => delete storage[key], |     removeItem: (key: string) => delete storage[key], | ||||||
|     clear: () => (storage = {}), |     clear: () => (storage = {}), | ||||||
|   }; |   } | ||||||
| }; | } | ||||||
|  |  | ||||||
| Object.defineProperty(window, 'localStorage', { value: mock() }); | Object.defineProperty(window, 'localStorage', { value: mock() }) | ||||||
| Object.defineProperty(window, 'sessionStorage', { value: mock() }); | Object.defineProperty(window, 'sessionStorage', { value: mock() }) | ||||||
| Object.defineProperty(window, 'getComputedStyle', { | Object.defineProperty(window, 'getComputedStyle', { | ||||||
|   value: () => ['-webkit-appearance'], |   value: () => ['-webkit-appearance'], | ||||||
| }); | }) | ||||||
|  |  | ||||||
| Object.defineProperty(document.body.style, 'transform', { | Object.defineProperty(document.body.style, 'transform', { | ||||||
|   value: () => { |   value: () => { | ||||||
|     return { |     return { | ||||||
|       enumerable: true, |       enumerable: true, | ||||||
|       configurable: true, |       configurable: true, | ||||||
|     }; |     } | ||||||
|   }, |   }, | ||||||
| }); | }) | ||||||
|  |  | ||||||
| /* output shorter and more meaningful Zone error stack traces */ | /* output shorter and more meaningful Zone error stack traces */ | ||||||
| // Error.stackTraceLimit = 2; | // Error.stackTraceLimit = 2 | ||||||
|   | |||||||
| @@ -19,27 +19,27 @@ export abstract class EditDialogComponent<T extends ObjectWithId> | |||||||
|   ) {} |   ) {} | ||||||
|  |  | ||||||
|   @Input() |   @Input() | ||||||
|   dialogMode: string = 'create'; |   dialogMode: string = 'create' | ||||||
|  |  | ||||||
|   @Input() |   @Input() | ||||||
|   object: T; |   object: T | ||||||
|  |  | ||||||
|   @Output() |   @Output() | ||||||
|   success = new EventEmitter(); |   success = new EventEmitter() | ||||||
|  |  | ||||||
|   networkActive = false; |   networkActive = false | ||||||
|  |  | ||||||
|   closeEnabled = false; |   closeEnabled = false | ||||||
|  |  | ||||||
|   error = null; |   error = null | ||||||
|  |  | ||||||
|   abstract getForm(): FormGroup; |   abstract getForm(): FormGroup | ||||||
|  |  | ||||||
|   objectForm: FormGroup = this.getForm(); |   objectForm: FormGroup = this.getForm() | ||||||
|  |  | ||||||
|   ngOnInit(): void { |   ngOnInit(): void { | ||||||
|     if (this.object != null) { |     if (this.object != null) { | ||||||
|       this.objectForm.patchValue(this.object); |       this.objectForm.patchValue(this.object) | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     // wait to enable close button so it doesnt steal focus from input since its the first clickable element in the DOM |     // wait to enable close button so it doesnt steal focus from input since its the first clickable element in the DOM | ||||||
| @@ -49,34 +49,34 @@ export abstract class EditDialogComponent<T extends ObjectWithId> | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   getCreateTitle() { |   getCreateTitle() { | ||||||
|     return $localize`Create new item`; |     return $localize`Create new item` | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   getEditTitle() { |   getEditTitle() { | ||||||
|     return $localize`Edit item`; |     return $localize`Edit item` | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   getSaveErrorMessage(error: string) { |   getSaveErrorMessage(error: string) { | ||||||
|     return $localize`Could not save element: ${error}`; |     return $localize`Could not save element: ${error}` | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   getTitle() { |   getTitle() { | ||||||
|     switch (this.dialogMode) { |     switch (this.dialogMode) { | ||||||
|       case 'create': |       case 'create': | ||||||
|         return this.getCreateTitle(); |         return this.getCreateTitle() | ||||||
|       case 'edit': |       case 'edit': | ||||||
|         return this.getEditTitle(); |         return this.getEditTitle() | ||||||
|       default: |       default: | ||||||
|         break |         break | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   getMatchingAlgorithms() { |   getMatchingAlgorithms() { | ||||||
|     return MATCHING_ALGORITHMS; |     return MATCHING_ALGORITHMS | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   get patternRequired(): boolean { |   get patternRequired(): boolean { | ||||||
|     return this.objectForm?.value.matching_algorithm !== MATCH_AUTO; |     return this.objectForm?.value.matching_algorithm !== MATCH_AUTO | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   save() { |   save() { | ||||||
| @@ -90,7 +90,7 @@ export abstract class EditDialogComponent<T extends ObjectWithId> | |||||||
|         serverResponse = this.service.create(newObject) |         serverResponse = this.service.create(newObject) | ||||||
|         break |         break | ||||||
|       case 'edit': |       case 'edit': | ||||||
|         serverResponse = this.service.update(newObject); |         serverResponse = this.service.update(newObject) | ||||||
|       default: |       default: | ||||||
|         break |         break | ||||||
|     } |     } | ||||||
| @@ -108,6 +108,6 @@ export abstract class EditDialogComponent<T extends ObjectWithId> | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   cancel() { |   cancel() { | ||||||
|     this.activeModal.close(); |     this.activeModal.close() | ||||||
|   } |   } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -17,6 +17,6 @@ import { AbstractInputComponent } from '../abstract-input' | |||||||
| }) | }) | ||||||
| export class CheckComponent extends AbstractInputComponent<boolean> { | export class CheckComponent extends AbstractInputComponent<boolean> { | ||||||
|   constructor() { |   constructor() { | ||||||
|     super(); |     super() | ||||||
|   } |   } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -1,21 +1,24 @@ | |||||||
| import { TestBed } from '@angular/core/testing'; | import { TestBed } from '@angular/core/testing' | ||||||
|  |  | ||||||
| type CompilerOptions = Partial<{ | type CompilerOptions = Partial<{ | ||||||
|   providers: any[]; |   providers: any[] | ||||||
|   useJit: boolean; |   useJit: boolean | ||||||
|   preserveWhitespaces: boolean; |   preserveWhitespaces: boolean | ||||||
| }>; | }> | ||||||
| export type ConfigureFn = (testBed: typeof TestBed) => void; | export type ConfigureFn = (testBed: typeof TestBed) => void | ||||||
|  |  | ||||||
| export const configureTests = (configure: ConfigureFn, compilerOptions: CompilerOptions = {}) => { | export const configureTests = ( | ||||||
|  |   configure: ConfigureFn, | ||||||
|  |   compilerOptions: CompilerOptions = {} | ||||||
|  | ) => { | ||||||
|   const compilerConfig: CompilerOptions = { |   const compilerConfig: CompilerOptions = { | ||||||
|     preserveWhitespaces: false, |     preserveWhitespaces: false, | ||||||
|     ...compilerOptions, |     ...compilerOptions, | ||||||
|   }; |   } | ||||||
|  |  | ||||||
|   const configuredTestBed = TestBed.configureCompiler(compilerConfig); |   const configuredTestBed = TestBed.configureCompiler(compilerConfig) | ||||||
|  |  | ||||||
|   configure(configuredTestBed); |   configure(configuredTestBed) | ||||||
|  |  | ||||||
|   return configuredTestBed.compileComponents().then(() => configuredTestBed); |   return configuredTestBed.compileComponents().then(() => configuredTestBed) | ||||||
| }; | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Frank Strieter
					Frank Strieter