diff --git a/ui-ngx/src/app/modules/home/pages/notification/sent/sent-notification-dialog.component.html b/ui-ngx/src/app/modules/home/pages/notification/sent/sent-notification-dialog.component.html index 6aac94f03b..fe5211d024 100644 --- a/ui-ngx/src/app/modules/home/pages/notification/sent/sent-notification-dialog.component.html +++ b/ui-ngx/src/app/modules/home/pages/notification/sent/sent-notification-dialog.component.html @@ -59,9 +59,21 @@ - {{ "notification.delivery-methods" | translate }} - notification.at-least-one-should-be-selected + + + {{ "notification.delivery-methods" | translate }} + notification.at-least-one-should-be-selected + + + refresh + + , @@ -162,15 +164,7 @@ export class SentNotificationDialogComponent extends this.notificationRequestForm.get('useTemplate').setValue(useTemplate, {onlySelf : true}); } - this.notificationService.getAvailableDeliveryMethods({ignoreLoading: true}).subscribe(allowMethods => { - this.notificationDeliveryMethods.forEach(method => { - if (allowMethods.includes(method)) { - this.getDeliveryMethodsTemplatesControl(method).enable({emitEvent: true}); - } else { - this.getDeliveryMethodsTemplatesControl(method).setValue(false, {emitEvent: true}); //used for notify again - } - }); - }); + this.refreshAllowDeliveryMethod(); } ngOnDestroy() { @@ -340,4 +334,18 @@ export class SentNotificationDialogComponent extends return '/settings/notifications'; } } + + refreshAllowDeliveryMethod() { + this.notificationService.getAvailableDeliveryMethods({ignoreLoading: true}).subscribe(allowMethods => { + this.notificationDeliveryMethods.forEach(method => { + if (allowMethods.includes(method)) { + this.getDeliveryMethodsTemplatesControl(method).enable({emitEvent: true}); + } else { + this.getDeliveryMethodsTemplatesControl(method).disable({emitEvent: true}); + this.getDeliveryMethodsTemplatesControl(method).setValue(false, {emitEvent: true}); //used for notify again + } + }); + this.showRefresh = (this.notificationDeliveryMethods.length !== allowMethods.length); + }); + } }