Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add next scheduled time for tag retention #18223

Merged
merged 1 commit into from
Feb 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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