diff --git a/src-ui/src/app/components/admin/config/config.component.html b/src-ui/src/app/components/admin/config/config.component.html index 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 @@
-
-
- {{option.title}} - - - +
+
+ {{option.title}}
+ + + + @if (isSet(option.key)) { + + }
@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.ts index 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.ts index 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) + } }