Skip to content

Commit

Permalink
Add next scheduled time for tag retention (goharbor#18223)
Browse files Browse the repository at this point in the history
1. Add next scheduled time UI
   2. Update font style

Signed-off-by: AllForNothing <[email protected]>
  • Loading branch information
AllForNothing authored and sebglon committed Mar 6, 2023
1 parent 9d09850 commit 571456e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export class Retention extends BaseRetention {
references: object;
settings: {
cron: string;
next_scheduled_time?: string;
};
};
constructor() {
Expand Down
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -168,18 +168,25 @@
</div>
<div class="cron-selection">
<cron-selection
class="w-100"
[labelWidth]="'150px'"
[disabled]="!(retention?.rules?.length > 0)"
#cronScheduleComponent
[labelCurrent]="label"
[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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down

0 comments on commit 571456e

Please sign in to comment.