Fix log rotation UI issues (#17220)

Signed-off-by: AllForNothing <sshijun@vmware.com>
This commit is contained in:
Shijun Sun 2022-07-21 16:49:26 +08:00 committed by GitHub
parent acc2872fa8
commit 56e669ebbc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 78 additions and 54 deletions

View File

@ -75,7 +75,7 @@
[class.clr-error]=" [class.clr-error]="
(retentionTimeNgModel.dirty || (retentionTimeNgModel.dirty ||
retentionTimeNgModel.touched) && retentionTimeNgModel.touched) &&
retentionTimeNgModel.invalid (retentionTimeNgModel.invalid || !isRetentionTimeValid())
"> ">
<div class="flex"> <div class="flex">
<div class="clr-input-wrapper"> <div class="clr-input-wrapper">
@ -95,15 +95,25 @@
class="clr-validate-icon" class="clr-validate-icon"
shape="exclamation-circle"></clr-icon> shape="exclamation-circle"></clr-icon>
<clr-control-error <clr-control-error
class="max-width-2rem"
*ngIf=" *ngIf="
(retentionTimeNgModel.dirty || (retentionTimeNgModel.dirty ||
retentionTimeNgModel.touched) && retentionTimeNgModel.touched) &&
retentionTimeNgModel.invalid (retentionTimeNgModel.invalid ||
!isRetentionTimeValid())
"> ">
{{ 'CLEARANCES.KEEP_IN_ERROR' | translate }} {{ 'CLEARANCES.KEEP_IN_ERROR' | translate }}
</clr-control-error> </clr-control-error>
</div> </div>
<div class="clr-select-wrapper unit-select"> <div
class="clr-select-wrapper unit-select"
[ngClass]="{
pt:
(retentionTimeNgModel.dirty ||
retentionTimeNgModel.touched) &&
(retentionTimeNgModel.invalid ||
!isRetentionTimeValid())
}">
<select <select
[(ngModel)]="retentionUnit" [(ngModel)]="retentionUnit"
[ngModelOptions]="{ standalone: true }" [ngModelOptions]="{ standalone: true }"

View File

@ -38,3 +38,11 @@
padding-top: 1px; padding-top: 1px;
margin-left: 2rem; margin-left: 2rem;
} }
.max-width-2rem {
max-width: 2rem;
}
.pt {
padding-right: 1rem;
}

View File

@ -20,6 +20,7 @@ import { NgForm } from '@angular/forms';
const ONE_MINUTE: number = 60000; const ONE_MINUTE: number = 60000;
const ONE_DAY: number = 24; const ONE_DAY: number = 24;
const MAX_RETENTION_DAYS: number = 10000;
@Component({ @Component({
selector: 'app-set-job', selector: 'app-set-job',
@ -313,4 +314,16 @@ export class SetJobComponent implements OnInit, OnDestroy {
this.purgeForm?.invalid || !(this.selectedOperations?.length > 0) this.purgeForm?.invalid || !(this.selectedOperations?.length > 0)
); );
} }
isRetentionTimeValid() {
if (this.retentionUnit === RetentionTimeUnit.DAYS) {
return (
this.retentionTime > 0 &&
this.retentionTime <= MAX_RETENTION_DAYS
);
}
return (
this.retentionTime > 0 &&
this.retentionTime <= MAX_RETENTION_DAYS * ONE_DAY
);
}
} }

View File

@ -134,9 +134,8 @@
'ROBOT_ACCOUNT.NUMBER_REQUIRED' | translate 'ROBOT_ACCOUNT.NUMBER_REQUIRED' | translate
}}</clr-control-error> }}</clr-control-error>
</clr-input-container> </clr-input-container>
<label <div *ngIf="canDownloadCert" class="clr-form-control">
*ngIf="canDownloadCert" <label class="clr-control-label"
class="clr-control-label cert-down-label mt-1"
>{{ 'CONFIG.ROOT_CERT' | translate }} >{{ 'CONFIG.ROOT_CERT' | translate }}
<clr-tooltip> <clr-tooltip>
<clr-icon <clr-icon
@ -152,15 +151,16 @@
}}</span> }}</span>
</clr-tooltip-content> </clr-tooltip-content>
</clr-tooltip> </clr-tooltip>
</label>
<div class="clr-control-container cert-down">
<a <a
rel="noopener noreferrer" rel="noopener noreferrer"
#certDownloadLink
class="cert-down"
[href]="downloadLink" [href]="downloadLink"
target="_blank" target="_blank"
>{{ 'CONFIG.ROOT_CERT_LINK' | translate }}</a >{{ 'CONFIG.ROOT_CERT_LINK' | translate }}</a
> >
</label> </div>
</div>
<clr-checkbox-container> <clr-checkbox-container>
<label id="repo_read_only_lbl" for="repoReadOnly" <label id="repo_read_only_lbl" for="repoReadOnly"
>{{ 'CONFIG.REPO_READ_ONLY' | translate }} >{{ 'CONFIG.REPO_READ_ONLY' | translate }}

View File

@ -112,15 +112,8 @@
margin: 0; margin: 0;
} }
.cert-down-label { .cert-down {
position: relative; margin-top: 0.15rem;
.cert-down {
position: absolute;
left: 240px;
top: 50%;
transform: translateY(-50%);
}
} }
.info-tips-icon { .info-tips-icon {

View File

@ -1737,7 +1737,7 @@
"SCHEDULE_TO_PURGE": "Schedule to purge", "SCHEDULE_TO_PURGE": "Schedule to purge",
"KEEP_IN": "Keep records in", "KEEP_IN": "Keep records in",
"KEEP_IN_TOOLTIP": "Keep the records in this interval", "KEEP_IN_TOOLTIP": "Keep the records in this interval",
"KEEP_IN_ERROR": "This filed is required", "KEEP_IN_ERROR": "The value of this item must be an integer, and the time value must be greater than 0 and less than 10000 days",
"DAYS": "Days", "DAYS": "Days",
"HOURS": "Hours", "HOURS": "Hours",
"INCLUDED_OPERATIONS": "Included operations", "INCLUDED_OPERATIONS": "Included operations",
@ -1747,7 +1747,7 @@
"PURGE_NOW_SUCCESS": "Purge triggered successfully", "PURGE_NOW_SUCCESS": "Purge triggered successfully",
"PURGE_SCHEDULE_RESET": "Purge schedule has been reset", "PURGE_SCHEDULE_RESET": "Purge schedule has been reset",
"PURGE_HISTORY": "Purge History", "PURGE_HISTORY": "Purge History",
"FORWARD_ENDPOINT": "Audit Log Forward Endpoint", "FORWARD_ENDPOINT": "Audit Log Forward Syslog Endpoint",
"FORWARD_ENDPOINT_TOOLTIP": "Forward audit logs to the syslog endpoint, for example: harbor-log:10514", "FORWARD_ENDPOINT_TOOLTIP": "Forward audit logs to the syslog endpoint, for example: harbor-log:10514",
"SKIP_DATABASE": "Skip Audit Log Database", "SKIP_DATABASE": "Skip Audit Log Database",
"SKIP_DATABASE_TOOLTIP": "Skip to log audit log in the database, only available when audit log forward endpoint is configured", "SKIP_DATABASE_TOOLTIP": "Skip to log audit log in the database, only available when audit log forward endpoint is configured",

View File

@ -1737,7 +1737,7 @@
"SCHEDULE_TO_PURGE": "Schedule to purge", "SCHEDULE_TO_PURGE": "Schedule to purge",
"KEEP_IN": "Keep records in", "KEEP_IN": "Keep records in",
"KEEP_IN_TOOLTIP": "Keep the records in this interval", "KEEP_IN_TOOLTIP": "Keep the records in this interval",
"KEEP_IN_ERROR": "This filed is required", "KEEP_IN_ERROR": "The value of this item must be an integer, and the time value must be greater than 0 and less than 10000 days",
"DAYS": "Days", "DAYS": "Days",
"HOURS": "Hours", "HOURS": "Hours",
"INCLUDED_OPERATIONS": "Included operations", "INCLUDED_OPERATIONS": "Included operations",
@ -1747,7 +1747,7 @@
"PURGE_NOW_SUCCESS": "Purge triggered successfully", "PURGE_NOW_SUCCESS": "Purge triggered successfully",
"PURGE_SCHEDULE_RESET": "Purge schedule has been reset", "PURGE_SCHEDULE_RESET": "Purge schedule has been reset",
"PURGE_HISTORY": "Purge History", "PURGE_HISTORY": "Purge History",
"FORWARD_ENDPOINT": "Audit Log Forward Endpoint", "FORWARD_ENDPOINT": "Audit Log Forward Syslog Endpoint",
"FORWARD_ENDPOINT_TOOLTIP": "Forward audit logs to the syslog endpoint, for example: harbor-log:10514", "FORWARD_ENDPOINT_TOOLTIP": "Forward audit logs to the syslog endpoint, for example: harbor-log:10514",
"SKIP_DATABASE": "Skip Audit Log Database", "SKIP_DATABASE": "Skip Audit Log Database",
"SKIP_DATABASE_TOOLTIP": "Skip to log audit log in the database, only available when audit log forward endpoint is configured", "SKIP_DATABASE_TOOLTIP": "Skip to log audit log in the database, only available when audit log forward endpoint is configured",

View File

@ -1736,7 +1736,7 @@
"SCHEDULE_TO_PURGE": "Schedule to purge", "SCHEDULE_TO_PURGE": "Schedule to purge",
"KEEP_IN": "Keep records in", "KEEP_IN": "Keep records in",
"KEEP_IN_TOOLTIP": "Keep the records in this interval", "KEEP_IN_TOOLTIP": "Keep the records in this interval",
"KEEP_IN_ERROR": "This filed is required", "KEEP_IN_ERROR": "The value of this item must be an integer, and the time value must be greater than 0 and less than 10000 days",
"DAYS": "Days", "DAYS": "Days",
"HOURS": "Hours", "HOURS": "Hours",
"INCLUDED_OPERATIONS": "Included operations", "INCLUDED_OPERATIONS": "Included operations",
@ -1746,7 +1746,7 @@
"PURGE_NOW_SUCCESS": "Purge triggered successfully", "PURGE_NOW_SUCCESS": "Purge triggered successfully",
"PURGE_SCHEDULE_RESET": "Purge schedule has been reset", "PURGE_SCHEDULE_RESET": "Purge schedule has been reset",
"PURGE_HISTORY": "Purge History", "PURGE_HISTORY": "Purge History",
"FORWARD_ENDPOINT": "Audit Log Forward Endpoint", "FORWARD_ENDPOINT": "Audit Log Forward Syslog Endpoint",
"FORWARD_ENDPOINT_TOOLTIP": "Forward audit logs to the syslog endpoint, for example: harbor-log:10514", "FORWARD_ENDPOINT_TOOLTIP": "Forward audit logs to the syslog endpoint, for example: harbor-log:10514",
"SKIP_DATABASE": "Skip Audit Log Database", "SKIP_DATABASE": "Skip Audit Log Database",
"SKIP_DATABASE_TOOLTIP": "Skip to log audit log in the database, only available when audit log forward endpoint is configured", "SKIP_DATABASE_TOOLTIP": "Skip to log audit log in the database, only available when audit log forward endpoint is configured",

View File

@ -1706,7 +1706,7 @@
"SCHEDULE_TO_PURGE": "Schedule to purge", "SCHEDULE_TO_PURGE": "Schedule to purge",
"KEEP_IN": "Keep records in", "KEEP_IN": "Keep records in",
"KEEP_IN_TOOLTIP": "Keep the records in this interval", "KEEP_IN_TOOLTIP": "Keep the records in this interval",
"KEEP_IN_ERROR": "This filed is required", "KEEP_IN_ERROR": "The value of this item must be an integer, and the time value must be greater than 0 and less than 10000 days",
"DAYS": "Days", "DAYS": "Days",
"HOURS": "Hours", "HOURS": "Hours",
"INCLUDED_OPERATIONS": "Included operations", "INCLUDED_OPERATIONS": "Included operations",
@ -1716,7 +1716,7 @@
"PURGE_NOW_SUCCESS": "Purge triggered successfully", "PURGE_NOW_SUCCESS": "Purge triggered successfully",
"PURGE_SCHEDULE_RESET": "Purge schedule has been reset", "PURGE_SCHEDULE_RESET": "Purge schedule has been reset",
"PURGE_HISTORY": "Purge History", "PURGE_HISTORY": "Purge History",
"FORWARD_ENDPOINT": "Audit Log Forward Endpoint", "FORWARD_ENDPOINT": "Audit Log Forward Syslog Endpoint",
"FORWARD_ENDPOINT_TOOLTIP": "Forward audit logs to the syslog endpoint, for example: harbor-log:10514", "FORWARD_ENDPOINT_TOOLTIP": "Forward audit logs to the syslog endpoint, for example: harbor-log:10514",
"SKIP_DATABASE": "Skip Audit Log Database", "SKIP_DATABASE": "Skip Audit Log Database",
"SKIP_DATABASE_TOOLTIP": "Skip to log audit log in the database, only available when audit log forward endpoint is configured", "SKIP_DATABASE_TOOLTIP": "Skip to log audit log in the database, only available when audit log forward endpoint is configured",

View File

@ -1733,7 +1733,7 @@
"SCHEDULE_TO_PURGE": "Schedule to purge", "SCHEDULE_TO_PURGE": "Schedule to purge",
"KEEP_IN": "Keep records in", "KEEP_IN": "Keep records in",
"KEEP_IN_TOOLTIP": "Keep the records in this interval", "KEEP_IN_TOOLTIP": "Keep the records in this interval",
"KEEP_IN_ERROR": "This filed is required", "KEEP_IN_ERROR": "The value of this item must be an integer, and the time value must be greater than 0 and less than 10000 days",
"DAYS": "Days", "DAYS": "Days",
"HOURS": "Hours", "HOURS": "Hours",
"INCLUDED_OPERATIONS": "Included operations", "INCLUDED_OPERATIONS": "Included operations",
@ -1743,7 +1743,7 @@
"PURGE_NOW_SUCCESS": "Purge triggered successfully", "PURGE_NOW_SUCCESS": "Purge triggered successfully",
"PURGE_SCHEDULE_RESET": "Purge schedule has been reset", "PURGE_SCHEDULE_RESET": "Purge schedule has been reset",
"PURGE_HISTORY": "Purge History", "PURGE_HISTORY": "Purge History",
"FORWARD_ENDPOINT": "Audit Log Forward Endpoint", "FORWARD_ENDPOINT": "Audit Log Forward Syslog Endpoint",
"FORWARD_ENDPOINT_TOOLTIP": "Forward audit logs to the syslog endpoint, for example: harbor-log:10514", "FORWARD_ENDPOINT_TOOLTIP": "Forward audit logs to the syslog endpoint, for example: harbor-log:10514",
"SKIP_DATABASE": "Skip Audit Log Database", "SKIP_DATABASE": "Skip Audit Log Database",
"SKIP_DATABASE_TOOLTIP": "Skip to log audit log in the database, only available when audit log forward endpoint is configured", "SKIP_DATABASE_TOOLTIP": "Skip to log audit log in the database, only available when audit log forward endpoint is configured",

View File

@ -1737,7 +1737,7 @@
"SCHEDULE_TO_PURGE": "Schedule to purge", "SCHEDULE_TO_PURGE": "Schedule to purge",
"KEEP_IN": "Keep records in", "KEEP_IN": "Keep records in",
"KEEP_IN_TOOLTIP": "Keep the records in this interval", "KEEP_IN_TOOLTIP": "Keep the records in this interval",
"KEEP_IN_ERROR": "This filed is required", "KEEP_IN_ERROR": "The value of this item must be an integer, and the time value must be greater than 0 and less than 10000 days",
"DAYS": "Days", "DAYS": "Days",
"HOURS": "Hours", "HOURS": "Hours",
"INCLUDED_OPERATIONS": "Included operations", "INCLUDED_OPERATIONS": "Included operations",
@ -1747,7 +1747,7 @@
"PURGE_NOW_SUCCESS": "Purge triggered successfully", "PURGE_NOW_SUCCESS": "Purge triggered successfully",
"PURGE_SCHEDULE_RESET": "Purge schedule has been reset", "PURGE_SCHEDULE_RESET": "Purge schedule has been reset",
"PURGE_HISTORY": "Purge History", "PURGE_HISTORY": "Purge History",
"FORWARD_ENDPOINT": "Audit Log Forward Endpoint", "FORWARD_ENDPOINT": "Audit Log Forward Syslog Endpoint",
"FORWARD_ENDPOINT_TOOLTIP": "Forward audit logs to the syslog endpoint, for example: harbor-log:10514", "FORWARD_ENDPOINT_TOOLTIP": "Forward audit logs to the syslog endpoint, for example: harbor-log:10514",
"SKIP_DATABASE": "Skip Audit Log Database", "SKIP_DATABASE": "Skip Audit Log Database",
"SKIP_DATABASE_TOOLTIP": "Skip to log audit log in the database, only available when audit log forward endpoint is configured", "SKIP_DATABASE_TOOLTIP": "Skip to log audit log in the database, only available when audit log forward endpoint is configured",

View File

@ -1735,7 +1735,7 @@
"SCHEDULE_TO_PURGE": "当前定时任务", "SCHEDULE_TO_PURGE": "当前定时任务",
"KEEP_IN": "保留记录", "KEEP_IN": "保留记录",
"KEEP_IN_TOOLTIP": "保留指定时间内的日志记录", "KEEP_IN_TOOLTIP": "保留指定时间内的日志记录",
"KEEP_IN_ERROR": "此项为必填项", "KEEP_IN_ERROR": "该项的数值需为整数且时间值必须大于0且小于10000天",
"DAYS": "天", "DAYS": "天",
"HOURS": "小时", "HOURS": "小时",
"INCLUDED_OPERATIONS": "包含操作", "INCLUDED_OPERATIONS": "包含操作",

View File

@ -1728,7 +1728,7 @@
"SCHEDULE_TO_PURGE": "Schedule to purge", "SCHEDULE_TO_PURGE": "Schedule to purge",
"KEEP_IN": "Keep records in", "KEEP_IN": "Keep records in",
"KEEP_IN_TOOLTIP": "Keep the records in this interval", "KEEP_IN_TOOLTIP": "Keep the records in this interval",
"KEEP_IN_ERROR": "This filed is required", "KEEP_IN_ERROR": "The value of this item must be an integer, and the time value must be greater than 0 and less than 10000 days",
"DAYS": "Days", "DAYS": "Days",
"HOURS": "Hours", "HOURS": "Hours",
"INCLUDED_OPERATIONS": "Included operations", "INCLUDED_OPERATIONS": "Included operations",
@ -1738,7 +1738,7 @@
"PURGE_NOW_SUCCESS": "Purge triggered successfully", "PURGE_NOW_SUCCESS": "Purge triggered successfully",
"PURGE_SCHEDULE_RESET": "Purge schedule has been reset", "PURGE_SCHEDULE_RESET": "Purge schedule has been reset",
"PURGE_HISTORY": "Purge History", "PURGE_HISTORY": "Purge History",
"FORWARD_ENDPOINT": "Audit Log Forward Endpoint", "FORWARD_ENDPOINT": "Audit Log Forward Syslog Endpoint",
"FORWARD_ENDPOINT_TOOLTIP": "Forward audit logs to the syslog endpoint, for example: harbor-log:10514", "FORWARD_ENDPOINT_TOOLTIP": "Forward audit logs to the syslog endpoint, for example: harbor-log:10514",
"SKIP_DATABASE": "Skip Audit Log Database", "SKIP_DATABASE": "Skip Audit Log Database",
"SKIP_DATABASE_TOOLTIP": "Skip to log audit log in the database, only available when audit log forward endpoint is configured", "SKIP_DATABASE_TOOLTIP": "Skip to log audit log in the database, only available when audit log forward endpoint is configured",