From 93fe447c47c2dfc7892906f06a17715f258cd89b Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Wed, 1 Feb 2023 16:25:07 +0200 Subject: [PATCH] UI: Set max time for scheduling notification 7 days --- .../request-notification-dialog.component.html | 2 +- .../request-notification-dialog.componet.ts | 6 ++++++ .../rule-table/escalation-form.component.html | 4 +++- .../rule-notification-dialog.component.ts | 4 ++-- .../components/time/timeinterval.component.ts | 13 +++++++++++-- 5 files changed, 23 insertions(+), 6 deletions(-) diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/request-table/request-notification-dialog.component.html b/ui-ngx/src/app/modules/home/pages/notification-center/request-table/request-notification-dialog.component.html index cb3d14018f..48de10d5d1 100644 --- a/ui-ngx/src/app/modules/home/pages/notification-center/request-table/request-notification-dialog.component.html +++ b/ui-ngx/src/app/modules/home/pages/notification-center/request-table/request-notification-dialog.component.html @@ -63,7 +63,7 @@ notification.time - + diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/request-table/request-notification-dialog.componet.ts b/ui-ngx/src/app/modules/home/pages/notification-center/request-table/request-notification-dialog.componet.ts index c79cb8dc2a..ce8f7645d3 100644 --- a/ui-ngx/src/app/modules/home/pages/notification-center/request-table/request-notification-dialog.componet.ts +++ b/ui-ngx/src/app/modules/home/pages/notification-center/request-table/request-notification-dialog.componet.ts @@ -193,4 +193,10 @@ export class RequestNotificationDialogComponent extends minDate(): Date { return new Date(getCurrentTime(this.notificationRequestForm.get('additionalConfig.timezone').value).format('lll')); } + + maxDate(): Date { + const date = this.minDate(); + date.setDate(date.getDate() + 7); + return date; + } } diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/rule-table/escalation-form.component.html b/ui-ngx/src/app/modules/home/pages/notification-center/rule-table/escalation-form.component.html index 68dd4a9253..430e3a07d4 100644 --- a/ui-ngx/src/app/modules/home/pages/notification-center/rule-table/escalation-form.component.html +++ b/ui-ngx/src/app/modules/home/pages/notification-center/rule-table/escalation-form.component.html @@ -26,7 +26,9 @@ style="min-width: 100px;" ngStyle.xs="padding: 0 10px;" formControlName="delayInSec" - [disabledAdvanced]="true"> + min="{{ 0 }}" + max="{{ 604800000 }}" + disabledAdvanced> notification.notify diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/rule-table/rule-notification-dialog.component.ts b/ui-ngx/src/app/modules/home/pages/notification-center/rule-table/rule-notification-dialog.component.ts index cfc64144df..e8de97ab6c 100644 --- a/ui-ngx/src/app/modules/home/pages/notification-center/rule-table/rule-notification-dialog.component.ts +++ b/ui-ngx/src/app/modules/home/pages/notification-center/rule-table/rule-notification-dialog.component.ts @@ -143,8 +143,8 @@ export class RuleNotificationDialogComponent extends ); this.alarmTemplateForm = this.fb.group({ - alarmTypes: [[], Validators.required], - alarmSeverities: [[], Validators.required], + alarmTypes: [null], + alarmSeverities: [null, Validators.required], clearRule: this.fb.group({ alarmStatus: [] }), diff --git a/ui-ngx/src/app/shared/components/time/timeinterval.component.ts b/ui-ngx/src/app/shared/components/time/timeinterval.component.ts index 7a4f3d4153..2f06220fb3 100644 --- a/ui-ngx/src/app/shared/components/time/timeinterval.component.ts +++ b/ui-ngx/src/app/shared/components/time/timeinterval.component.ts @@ -75,10 +75,19 @@ export class TimeintervalComponent implements OnInit, ControlValueAccessor { } set hideFlag(val) { - this.hideFlagValue = val; + this.hideFlagValue = coerceBooleanProperty(val); } - @Input() disabledAdvanced = false; + private disabledAdvancedValue = false; + + get disabledAdvanced() { + return this.disabledAdvancedValue; + } + + @Input() + set disabledAdvanced(val) { + this.disabledAdvancedValue = coerceBooleanProperty(val); + } @Output() hideFlagChange = new EventEmitter();