diff --git a/ui-ngx/src/app/modules/home/pages/notification/template/configuration/notification-template-configuration.component.html b/ui-ngx/src/app/modules/home/pages/notification/template/configuration/notification-template-configuration.component.html index 21b660010d..88d31996ca 100644 --- a/ui-ngx/src/app/modules/home/pages/notification/template/configuration/notification-template-configuration.component.html +++ b/ui-ngx/src/app/modules/home/pages/notification/template/configuration/notification-template-configuration.component.html @@ -30,7 +30,7 @@
- + {{ NotificationDeliveryMethodInfoMap.get(NotificationDeliveryMethod.WEB).icon }} @@ -83,7 +83,7 @@
- + {{ NotificationDeliveryMethodInfoMap.get(NotificationDeliveryMethod.MOBILE_APP).icon }} @@ -138,7 +138,7 @@ @@ -148,7 +148,7 @@
- + {{ NotificationDeliveryMethodInfoMap.get(NotificationDeliveryMethod.SMS).icon }} @@ -180,7 +180,7 @@
- + {{ NotificationDeliveryMethodInfoMap.get(NotificationDeliveryMethod.EMAIL).icon }} @@ -210,7 +210,7 @@
- + {{ NotificationDeliveryMethodInfoMap.get(NotificationDeliveryMethod.SLACK).icon }} @@ -236,7 +236,7 @@
- + {{ NotificationDeliveryMethodInfoMap.get(NotificationDeliveryMethod.MICROSOFT_TEAMS).icon }} diff --git a/ui-ngx/src/app/modules/home/pages/notification/template/configuration/notification-template-configuration.component.ts b/ui-ngx/src/app/modules/home/pages/notification/template/configuration/notification-template-configuration.component.ts index 0adb1a557f..eac2dc5a7e 100644 --- a/ui-ngx/src/app/modules/home/pages/notification/template/configuration/notification-template-configuration.component.ts +++ b/ui-ngx/src/app/modules/home/pages/notification/template/configuration/notification-template-configuration.component.ts @@ -66,6 +66,7 @@ export class NotificationTemplateConfigurationComponent implements OnDestroy, Co if (isDefinedAndNotNull(value)) { this.templateConfigurationForm.patchValue(value, {emitEvent: false}); this.updateDisabledForms(); + this.updateExpandedForm(); this.templateConfigurationForm.updateValueAndValidity(); } } @@ -96,6 +97,7 @@ export class NotificationTemplateConfigurationComponent implements OnDestroy, Co private propagateChange = (v: any) => { }; private readonly destroy$ = new Subject(); + private expendedBlocks: NotificationDeliveryMethod[]; constructor(private fb: FormBuilder, private translate: TranslateService) { @@ -122,6 +124,7 @@ export class NotificationTemplateConfigurationComponent implements OnDestroy, Co } } this.templateConfigurationForm.patchValue(settings, {emitEvent: false}); + this.updateExpandedForm(); } registerOnChange(fn: any): void { @@ -147,7 +150,7 @@ export class NotificationTemplateConfigurationComponent implements OnDestroy, Co }; } - get hotificationTapActionHint(): string { + get notificationTapActionHint(): string { switch (this.notificationType) { case NotificationType.ALARM: case NotificationType.ALARM_ASSIGNMENT: @@ -157,6 +160,19 @@ export class NotificationTemplateConfigurationComponent implements OnDestroy, Co return ''; } + expandedForm(name: NotificationDeliveryMethod): boolean { + return this.expendedBlocks.includes(name); + } + + private updateExpandedForm() { + this.expendedBlocks = []; + Object.keys(this.templateConfigurationForm.controls).forEach((name: NotificationDeliveryMethod) => { + if (this.templateConfigurationForm.get(name).invalid) { + this.expendedBlocks.push(name); + } + }); + } + private updateDisabledForms(){ Object.values(NotificationDeliveryMethod).forEach((method) => { const form = this.templateConfigurationForm.get(method);