mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-22 10:15:35 +01:00
Add validator for duration of banner message (#19057)
1.Fixes #19049 Signed-off-by: AllForNothing <sshijun@vmware.com>
This commit is contained in:
parent
b496edf304
commit
39ec1e4b1f
@ -434,17 +434,22 @@
|
||||
!messageText
|
||||
}">
|
||||
<label>{{ 'BANNER_MESSAGE.FROM' | translate }}</label>
|
||||
<input
|
||||
class="date"
|
||||
type="date"
|
||||
id="from"
|
||||
clrDate
|
||||
[(ngModel)]="messageFromDate"
|
||||
[ngModelOptions]="{ standalone: true }"
|
||||
[disabled]="
|
||||
!currentConfig.banner_message.editable ||
|
||||
!messageText
|
||||
" />
|
||||
<clr-date-container>
|
||||
<input
|
||||
class="date"
|
||||
type="date"
|
||||
id="from"
|
||||
autocomplete="off"
|
||||
min="{{ currentDate | date : 'yyyy-MM-dd' }}"
|
||||
max="{{ messageToDate | date : 'yyyy-MM-dd' }}"
|
||||
clrDate
|
||||
[(ngModel)]="messageFromDate"
|
||||
[ngModelOptions]="{ standalone: true }"
|
||||
[disabled]="
|
||||
!currentConfig.banner_message.editable ||
|
||||
!messageText
|
||||
" />
|
||||
</clr-date-container>
|
||||
</div>
|
||||
<div
|
||||
class="clr-checkbox-wrapper flex ml-1"
|
||||
@ -454,17 +459,21 @@
|
||||
!messageText
|
||||
}">
|
||||
<label>{{ 'BANNER_MESSAGE.TO' | translate }}</label>
|
||||
<input
|
||||
class="date"
|
||||
clrDate
|
||||
type="date"
|
||||
id="to"
|
||||
[(ngModel)]="messageToDate"
|
||||
[disabled]="
|
||||
!currentConfig.banner_message.editable ||
|
||||
!messageText
|
||||
"
|
||||
[ngModelOptions]="{ standalone: true }" />
|
||||
<clr-date-container>
|
||||
<input
|
||||
class="date"
|
||||
clrDate
|
||||
type="date"
|
||||
id="to"
|
||||
min="{{ minDateForEndDay | date : 'yyyy-MM-dd' }}"
|
||||
autocomplete="off"
|
||||
[(ngModel)]="messageToDate"
|
||||
[disabled]="
|
||||
!currentConfig.banner_message.editable ||
|
||||
!messageText
|
||||
"
|
||||
[ngModelOptions]="{ standalone: true }" />
|
||||
</clr-date-container>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -50,6 +50,8 @@ export class SystemSettingsComponent implements OnInit, OnDestroy {
|
||||
messageFromDateCopy: Date;
|
||||
messageToDateCopy: Date;
|
||||
bannerRefreshSub: Subscription;
|
||||
currentDate: Date = new Date();
|
||||
minDateForEndDay: Date;
|
||||
|
||||
@ViewChild('systemConfigFrom') systemSettingsForm: NgForm;
|
||||
|
||||
@ -60,6 +62,9 @@ export class SystemSettingsComponent implements OnInit, OnDestroy {
|
||||
private event: EventService
|
||||
) {
|
||||
this.downloadLink = CURRENT_BASE_HREF + '/systeminfo/getcert';
|
||||
this.minDateForEndDay = this.messageFromDate
|
||||
? this.messageFromDate
|
||||
: this.currentDate;
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
Loading…
Reference in New Issue
Block a user