Merge pull request #13516 from vvlladd28/bug/notifiaction-template/max-length-validation
Add missing validation for notification length message.
This commit is contained in:
commit
e313b42114
@ -62,6 +62,12 @@
|
||||
*ngIf="actionButtonConfigForm.get('link').hasError('required')">
|
||||
{{ 'notification.link-required' | translate }}
|
||||
</mat-error>
|
||||
<mat-error
|
||||
*ngIf="actionButtonConfigForm.get('link').hasError('maxlength')">
|
||||
{{ 'notification.link-max-length' | translate :
|
||||
{length: actionButtonConfigForm.get('link').getError('maxlength').requiredLength}
|
||||
}}
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
<ng-template #dashboardSelector>
|
||||
<tb-dashboard-autocomplete
|
||||
|
||||
@ -84,7 +84,7 @@ export class NotificationActionButtonConfigurationComponent implements ControlVa
|
||||
enabled: [false],
|
||||
text: [{value: '', disabled: true}, [Validators.required, Validators.maxLength(50)]],
|
||||
linkType: [ActionButtonLinkType.LINK],
|
||||
link: [{value: '', disabled: true}, Validators.required],
|
||||
link: [{value: '', disabled: true}, [Validators.required, Validators.maxLength(300)]],
|
||||
dashboardId: [{value: null, disabled: true}, Validators.required],
|
||||
dashboardState: [{value: null, disabled: true}],
|
||||
setEntityIdInState: [{value: true, disabled: true}]
|
||||
|
||||
@ -44,6 +44,11 @@
|
||||
<mat-error *ngIf="templateConfigurationForm.get('WEB.subject').hasError('required')">
|
||||
{{ 'notification.subject-required' | translate }}
|
||||
</mat-error>
|
||||
<mat-error *ngIf="templateConfigurationForm.get('WEB.subject').hasError('maxlength')">
|
||||
{{'notification.subject-max-length' | translate :
|
||||
{length: templateConfigurationForm.get('WEB.subject').getError('maxlength').requiredLength}
|
||||
}}
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
<mat-form-field class="mat-block">
|
||||
<mat-label translate>notification.message</mat-label>
|
||||
@ -56,6 +61,11 @@
|
||||
<mat-error *ngIf="templateConfigurationForm.get('WEB.body').hasError('required')">
|
||||
{{ 'notification.message-required' | translate }}
|
||||
</mat-error>
|
||||
<mat-error *ngIf="templateConfigurationForm.get('WEB.body').hasError('maxlength')">
|
||||
{{ 'notification.message-max-length' | translate :
|
||||
{length: templateConfigurationForm.get('WEB.body').getError('maxlength').requiredLength}
|
||||
}}
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
<section formGroupName="additionalConfig" class="tb-form-panel no-padding no-border">
|
||||
<div class="tb-form-row space-between" formGroupName="icon">
|
||||
@ -194,6 +204,11 @@
|
||||
<mat-error *ngIf="templateConfigurationForm.get('EMAIL.subject').hasError('required')">
|
||||
{{ 'notification.subject-required' | translate }}
|
||||
</mat-error>
|
||||
<mat-error *ngIf="templateConfigurationForm.get('EMAIL.subject').hasError('maxlength')">
|
||||
{{'notification.subject-max-length' | translate :
|
||||
{length: templateConfigurationForm.get('EMAIL.subject').getError('maxlength').requiredLength}
|
||||
}}
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
<mat-label class="tb-title tb-required"
|
||||
[class.tb-error]="(interacted || templateConfigurationForm.get('EMAIL.body').touched) && templateConfigurationForm.get('EMAIL.body').hasError('required')"
|
||||
|
||||
@ -226,8 +226,8 @@ export class NotificationTemplateConfigurationComponent implements OnDestroy, Co
|
||||
switch (deliveryMethod) {
|
||||
case NotificationDeliveryMethod.WEB:
|
||||
deliveryMethodForm = this.fb.group({
|
||||
subject: ['', Validators.required],
|
||||
body: ['', Validators.required],
|
||||
subject: ['', [Validators.required, Validators.maxLength(150)]],
|
||||
body: ['', [Validators.required, Validators.maxLength(250)]],
|
||||
additionalConfig: this.fb.group({
|
||||
icon: this.fb.group({
|
||||
enabled: [false],
|
||||
@ -252,7 +252,7 @@ export class NotificationTemplateConfigurationComponent implements OnDestroy, Co
|
||||
break;
|
||||
case NotificationDeliveryMethod.EMAIL:
|
||||
deliveryMethodForm = this.fb.group({
|
||||
subject: ['', Validators.required],
|
||||
subject: ['', [Validators.required, Validators.maxLength(250)]],
|
||||
body: ['', Validators.required]
|
||||
});
|
||||
break;
|
||||
|
||||
@ -3963,6 +3963,7 @@
|
||||
"input-fields-support-templatization": "Input fields support templatization.",
|
||||
"link": "Link",
|
||||
"link-required": "Link is required",
|
||||
"link-max-length": "Link should be less than or equal to {{ length }} characters",
|
||||
"link-type": {
|
||||
"dashboard": "Open dashboard",
|
||||
"link": "Open URL link"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user