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

View File

@ -38,3 +38,11 @@
padding-top: 1px;
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_DAY: number = 24;
const MAX_RETENTION_DAYS: number = 10000;
@Component({
selector: 'app-set-job',
@ -313,4 +314,16 @@ export class SetJobComponent implements OnInit, OnDestroy {
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,33 +134,33 @@
'ROBOT_ACCOUNT.NUMBER_REQUIRED' | translate
}}</clr-control-error>
</clr-input-container>
<label
*ngIf="canDownloadCert"
class="clr-control-label cert-down-label mt-1"
>{{ 'CONFIG.ROOT_CERT' | translate }}
<clr-tooltip>
<clr-icon
clrTooltipTrigger
shape="info-circle"
size="24"></clr-icon>
<clr-tooltip-content
clrPosition="top-right"
clrSize="lg"
*clrIfOpen>
<span>{{
'CONFIG.TOOLTIP.ROOT_CERT_DOWNLOAD' | translate
}}</span>
</clr-tooltip-content>
</clr-tooltip>
<a
rel="noopener noreferrer"
#certDownloadLink
class="cert-down"
[href]="downloadLink"
target="_blank"
>{{ 'CONFIG.ROOT_CERT_LINK' | translate }}</a
>
</label>
<div *ngIf="canDownloadCert" class="clr-form-control">
<label class="clr-control-label"
>{{ 'CONFIG.ROOT_CERT' | translate }}
<clr-tooltip>
<clr-icon
clrTooltipTrigger
shape="info-circle"
size="24"></clr-icon>
<clr-tooltip-content
clrPosition="top-right"
clrSize="lg"
*clrIfOpen>
<span>{{
'CONFIG.TOOLTIP.ROOT_CERT_DOWNLOAD' | translate
}}</span>
</clr-tooltip-content>
</clr-tooltip>
</label>
<div class="clr-control-container cert-down">
<a
rel="noopener noreferrer"
[href]="downloadLink"
target="_blank"
>{{ 'CONFIG.ROOT_CERT_LINK' | translate }}</a
>
</div>
</div>
<clr-checkbox-container>
<label id="repo_read_only_lbl" for="repoReadOnly"
>{{ 'CONFIG.REPO_READ_ONLY' | translate }}

View File

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

View File

@ -1737,7 +1737,7 @@
"SCHEDULE_TO_PURGE": "Schedule to purge",
"KEEP_IN": "Keep records in",
"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",
"HOURS": "Hours",
"INCLUDED_OPERATIONS": "Included operations",
@ -1747,7 +1747,7 @@
"PURGE_NOW_SUCCESS": "Purge triggered successfully",
"PURGE_SCHEDULE_RESET": "Purge schedule has been reset",
"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",
"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",

View File

@ -1737,7 +1737,7 @@
"SCHEDULE_TO_PURGE": "Schedule to purge",
"KEEP_IN": "Keep records in",
"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",
"HOURS": "Hours",
"INCLUDED_OPERATIONS": "Included operations",
@ -1747,7 +1747,7 @@
"PURGE_NOW_SUCCESS": "Purge triggered successfully",
"PURGE_SCHEDULE_RESET": "Purge schedule has been reset",
"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",
"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",

View File

@ -1736,7 +1736,7 @@
"SCHEDULE_TO_PURGE": "Schedule to purge",
"KEEP_IN": "Keep records in",
"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",
"HOURS": "Hours",
"INCLUDED_OPERATIONS": "Included operations",
@ -1746,7 +1746,7 @@
"PURGE_NOW_SUCCESS": "Purge triggered successfully",
"PURGE_SCHEDULE_RESET": "Purge schedule has been reset",
"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",
"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",

View File

@ -1706,7 +1706,7 @@
"SCHEDULE_TO_PURGE": "Schedule to purge",
"KEEP_IN": "Keep records in",
"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",
"HOURS": "Hours",
"INCLUDED_OPERATIONS": "Included operations",
@ -1716,7 +1716,7 @@
"PURGE_NOW_SUCCESS": "Purge triggered successfully",
"PURGE_SCHEDULE_RESET": "Purge schedule has been reset",
"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",
"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",

View File

@ -1733,7 +1733,7 @@
"SCHEDULE_TO_PURGE": "Schedule to purge",
"KEEP_IN": "Keep records in",
"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",
"HOURS": "Hours",
"INCLUDED_OPERATIONS": "Included operations",
@ -1743,7 +1743,7 @@
"PURGE_NOW_SUCCESS": "Purge triggered successfully",
"PURGE_SCHEDULE_RESET": "Purge schedule has been reset",
"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",
"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",

View File

@ -1737,7 +1737,7 @@
"SCHEDULE_TO_PURGE": "Schedule to purge",
"KEEP_IN": "Keep records in",
"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",
"HOURS": "Hours",
"INCLUDED_OPERATIONS": "Included operations",
@ -1747,7 +1747,7 @@
"PURGE_NOW_SUCCESS": "Purge triggered successfully",
"PURGE_SCHEDULE_RESET": "Purge schedule has been reset",
"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",
"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",

View File

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

View File

@ -1728,7 +1728,7 @@
"SCHEDULE_TO_PURGE": "Schedule to purge",
"KEEP_IN": "Keep records in",
"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",
"HOURS": "Hours",
"INCLUDED_OPERATIONS": "Included operations",
@ -1738,7 +1738,7 @@
"PURGE_NOW_SUCCESS": "Purge triggered successfully",
"PURGE_SCHEDULE_RESET": "Purge schedule has been reset",
"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",
"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",