From 2bf04b4e56b777b9307efebf0ac93d3d359eb047 Mon Sep 17 00:00:00 2001 From: Johannes Millan Date: Mon, 18 Dec 2023 17:41:01 +0100 Subject: [PATCH] feat(fileSync): auto update path with file name if none is given --- src/app/features/config/form-cfgs/sync-form.const.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/app/features/config/form-cfgs/sync-form.const.ts b/src/app/features/config/form-cfgs/sync-form.const.ts index eab3c16094..dda76b86f4 100644 --- a/src/app/features/config/form-cfgs/sync-form.const.ts +++ b/src/app/features/config/form-cfgs/sync-form.const.ts @@ -125,6 +125,15 @@ export const SYNC_FORM: ConfigFormSection = { required: true, label: T.F.SYNC.FORM.LOCAL_FILE.L_SYNC_FILE_PATH, description: T.F.SYNC.FORM.LOCAL_FILE.L_SYNC_FILE_PATH_DESCRIPTION, + change: (field) => { + const lastChar = field?.model.syncFilePath?.trim().slice(-1); + if (lastChar === '/' || lastChar === '\\') { + field.formControl?.setValue( + (field.model.syncFilePath += 'SP_SYNC_FILE.json'), + ); + field.formControl?.updateValueAndValidity(); + } + }, }, }, ],