Add next scheduled time for tag retention (#18223)

1. Add next scheduled time UI
   2. Update font style

Signed-off-by: AllForNothing <sshijun@vmware.com>
This commit is contained in:
Shijun Sun 2023-02-22 12:26:58 +08:00 committed by GitHub
parent c5640acd7b
commit a79c0ad496
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 4 deletions

View File

@ -1,6 +1,6 @@
<div class="clr-row pt-1 fw8">
<div class="clr-col">
<label class="label-left font-size-54">{{
<label class="label-left font-style">{{
'IMMUTABLE_TAG.IMMUTABLE_RULES' | translate
}}</label
><span class="badge badge-3 ml-5"

View File

@ -30,6 +30,7 @@ export class Retention extends BaseRetention {
references: object;
settings: {
cron: string;
next_scheduled_time?: string;
};
};
constructor() {

View File

@ -1,6 +1,6 @@
<div class="clr-row pt-1 fw8">
<div class="clr-col">
<label class="label-left font-size-54">{{
<label class="label-left font-style">{{
'TAG_RETENTION.RETENTION_RULES' | translate
}}</label
><span class="badge badge-3 ml-5"
@ -168,7 +168,6 @@
</div>
<div class="cron-selection">
<cron-selection
class="w-100"
[labelWidth]="'150px'"
[disabled]="!(retention?.rules?.length > 0)"
#cronScheduleComponent
@ -176,10 +175,18 @@
[labelEdit]="label"
[originCron]="originCron()"
(inputvalue)="openConfirm($event)"></cron-selection>
<ng-container *ngIf="retention?.trigger?.settings?.next_scheduled_time">
<span class="ml-1 mr-1 font-style">{{
'CLEARANCES.NEXT_SCHEDULED_TIME' | translate
}}</span>
<span>{{
retention?.trigger?.settings?.next_scheduled_time | harborDatetime
}}</span>
</ng-container>
</div>
<div class="clr-row pt-1">
<div class="clr-col-2 pt-2 flex-150">
<label class="label-left font-size-54">{{
<label class="label-left font-style">{{
'TAG_RETENTION.RETENTION_RUNS' | translate
}}</label>
</div>

View File

@ -143,6 +143,10 @@ export class TagRetentionComponent implements OnInit, OnDestroy {
updateCron(cron: string) {
let retention: RetentionPolicy = clone(this.retention);
retention.trigger.settings['cron'] = cron;
if (retention?.trigger?.settings['next_scheduled_time']) {
// should not have next_scheduled_time for updating
delete retention?.trigger?.settings['next_scheduled_time'];
}
if (!this.retentionId) {
this.retentionService
.createRetention({