From f1804f2fb27e58e13181471397618ec9a07eb174 Mon Sep 17 00:00:00 2001 From: Maksym Dudnik Date: Wed, 11 Oct 2023 13:02:51 +0300 Subject: [PATCH] command whitespaces hotfix --- .../widget/lib/gateway/gateway-configuration.component.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-configuration.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-configuration.component.ts index c4e1257e64..ef4e946579 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-configuration.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-configuration.component.ts @@ -409,9 +409,14 @@ export class GatewayConfigurationComponent implements OnInit { const commandsFormArray = this.commandFormArray(); const commandFormGroup = this.fb.group({ attributeOnGateway: [command.attributeOnGateway || null, [Validators.required, Validators.pattern(/^[^.\s]+$/)]], - command: [command.command || null, [Validators.required, Validators.pattern(/^[^.\s]+$/)]], + command: [command.command || null, [Validators.required]], timeout: [command.timeout || null, [Validators.required, Validators.min(1), Validators.pattern(/^-?[0-9]+$/), Validators.pattern(/^[^.\s]+$/)]], }); + commandFormGroup.get('command').valueChanges.subscribe(value=>{ + if (value && !(value as String).trim().length) { + commandFormGroup.get('command').setValue("", {emitEvent: false}); + } + }) commandsFormArray.push(commandFormGroup); }