A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
Fixhancement: config option reset (#12176)
shamoon9601b3d597f1
diff --git a/src-ui/src/app/components/admin/config/config.component.html b/src-ui/src/app/components/admin/config/config.component.htmlindex e1d7340a6..c103af166 100644--- a/src-ui/src/app/components/admin/config/config.component.html+++ b/src-ui/src/app/components/admin/config/config.component.html@@ -19,13 +19,18 @@<div class="col"><div class="card bg-light"><div class="card-body">- <div class="card-title">- <h6>- {{option.title}}- <a class="btn btn-sm btn-link" title="Read the documentation about this setting" i18n-title [href]="getDocsUrl(option.config_key)" target="_blank" referrerpolicy="no-referrer">- <i-bs name="info-circle"></i-bs>- </a>+ <div class="card-title d-flex align-items-center">+ <h6 class="mb-0">+ {{option.title}}</h6>+ <a class="btn btn-sm btn-link" title="Read the documentation about this setting" i18n-title [href]="getDocsUrl(option.config_key)" target="_blank" referrerpolicy="no-referrer">+ <i-bs name="info-circle"></i-bs>+ </a>+ @if (isSet(option.key)) {+ <button type="button" class="btn btn-sm btn-link text-danger ms-auto pe-0" title="Reset" i18n-title (click)="resetOption(option.key)">+ <i-bs class="me-1" name="x"></i-bs><ng-container i18n>Reset</ng-container>+ </button>+ }</div><div class="mb-n3">@switch (option.type) {diff --git a/src-ui/src/app/components/admin/config/config.component.spec.ts b/src-ui/src/app/components/admin/config/config.component.spec.tsindex 079bd1420..f4f4799a6 100644--- a/src-ui/src/app/components/admin/config/config.component.spec.ts+++ b/src-ui/src/app/components/admin/config/config.component.spec.ts@@ -144,4 +144,18 @@ describe('ConfigComponent', () => {component.uploadFile(new File([], 'test.png'), 'app_logo')expect(initSpy).toHaveBeenCalled()})++ it('should reset option to null', () => {+ component.configForm.patchValue({ output_type: OutputTypeConfig.PDF_A })+ expect(component.isSet('output_type')).toBeTruthy()+ component.resetOption('output_type')+ expect(component.configForm.get('output_type').value).toBeNull()+ expect(component.isSet('output_type')).toBeFalsy()+ component.configForm.patchValue({ app_title: 'Test Title' })+ component.resetOption('app_title')+ expect(component.configForm.get('app_title').value).toBeNull()+ component.configForm.patchValue({ barcodes_enabled: true })+ component.resetOption('barcodes_enabled')+ expect(component.configForm.get('barcodes_enabled').value).toBeNull()+ })})diff --git a/src-ui/src/app/components/admin/config/config.component.ts b/src-ui/src/app/components/admin/config/config.component.tsindex eee617310..44e482e75 100644--- a/src-ui/src/app/components/admin/config/config.component.ts+++ b/src-ui/src/app/components/admin/config/config.component.ts@@ -208,4 +208,12 @@ export class ConfigComponent},})}++ public isSet(key: string): boolean {+ return this.configForm.get(key).value != null+ }++ public resetOption(key: string) {+ this.configForm.get(key).setValue(null)+ }}