-
- {{'TAG_RETENTION.RETENTION_RUN_EXPLAIN' | translate}}
-
+
+
+
+
+
+
+
+
+ {{'TAG_RETENTION.RETENTION_RUN_EXPLAIN' | translate}}
+
+
+
+
+
+ [clrModalStaticBackdrop]="true" [clrModalClosable]="true">
{{'TAG_RETENTION.RETENTION_RUN_ABORTED' | translate}}
{{'TAG_RETENTION.RETENTION_RUN_ABORTED_EXPLAIN' | translate}}
@@ -184,4 +194,25 @@
(click)="abortRetention()">{{'BUTTON.OK' | translate}}
+
+ {{'TAG_RETENTION.SCHEDULE' | translate}}
+
+
+
+
+
+
+
+
+ {{'TAG_RETENTION.SCHEDULE_WARNING' | translate}}
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/portal/src/app/project/tag-retention/tag-retention.component.scss b/src/portal/src/app/project/tag-retention/tag-retention.component.scss
index abab3d670..1a0a4ce41 100644
--- a/src/portal/src/app/project/tag-retention/tag-retention.component.scss
+++ b/src/portal/src/app/project/tag-retention/tag-retention.component.scss
@@ -57,4 +57,7 @@
}
.font-size-54 {
font-size: .541667rem;
+}
+.padding-left-4 {
+ padding-left: 4px;
}
\ No newline at end of file
diff --git a/src/portal/src/app/project/tag-retention/tag-retention.component.ts b/src/portal/src/app/project/tag-retention/tag-retention.component.ts
index f5fa9a10f..a39ec13c6 100644
--- a/src/portal/src/app/project/tag-retention/tag-retention.component.ts
+++ b/src/portal/src/app/project/tag-retention/tag-retention.component.ts
@@ -58,6 +58,8 @@ export class TagRetentionComponent implements OnInit {
projectId: number;
isRetentionRunOpened: boolean = false;
isAbortedOpened: boolean = false;
+ isConfirmOpened: boolean = false;
+ cron: string;
selectedItem: any = null;
ruleIndex: number = -1;
index: number = -1;
@@ -84,8 +86,8 @@ export class TagRetentionComponent implements OnInit {
}
originCron(): OriginCron {
let originCron: OriginCron = {
- type: SCHEDULE_TYPE.DAILY,
- cron: "0 0 0 * * *"
+ type: SCHEDULE_TYPE.NONE,
+ cron: ""
};
originCron.cron = this.retention.trigger.settings.cron;
if (originCron.cron === "") {
@@ -118,6 +120,18 @@ export class TagRetentionComponent implements OnInit {
this.getRetention();
this.getMetadata();
}
+ openConfirm(cron: string) {
+ if (cron) {
+ this.isConfirmOpened = true;
+ this.cron = cron;
+ } else {
+ this.updateCron(cron);
+ }
+ }
+ closeConfirm() {
+ this.isConfirmOpened = false;
+ this.updateCron(this.cron);
+ }
updateCron(cron: string) {
let retention: Retention = clone(this.retention);
retention.trigger.settings.cron = cron;
@@ -133,7 +147,7 @@ export class TagRetentionComponent implements OnInit {
this.tagRetentionService.updateRetention(this.retentionId, retention).subscribe(
response => {
this.cronScheduleComponent.isEditMode = false;
- this.retention = retention;
+ this.getRetention();
}, error => {
this.errorHandler.error(error);
});
@@ -169,15 +183,14 @@ export class TagRetentionComponent implements OnInit {
this.addRuleComponent.isAdd = false;
this.ruleIndex = -1;
}
- toggleDisable(index, isActionDisable) {
+ toggleDisable(index, isActionDisable) {
let retention: Retention = clone(this.retention);
retention.rules[index].disabled = isActionDisable;
this.ruleIndex = -1;
this.loadingRule = true;
this.tagRetentionService.updateRetention(this.retentionId, retention).subscribe(
response => {
- this.loadingRule = false;
- this.retention = retention;
+ this.getRetention();
}, error => {
this.loadingRule = false;
this.errorHandler.error(error);
@@ -186,12 +199,15 @@ export class TagRetentionComponent implements OnInit {
deleteRule(index) {
let retention: Retention = clone(this.retention);
retention.rules.splice(index, 1);
+ // if rules is empty, clear schedule.
+ if (retention.rules && retention.rules.length === 0) {
+ retention.trigger.settings.cron = "";
+ }
this.ruleIndex = -1;
this.loadingRule = true;
this.tagRetentionService.updateRetention(this.retentionId, retention).subscribe(
response => {
- this.loadingRule = false;
- this.retention = retention;
+ this.getRetention();
}, error => {
this.loadingRule = false;
this.errorHandler.error(error);
@@ -340,8 +356,7 @@ export class TagRetentionComponent implements OnInit {
} else {
this.tagRetentionService.updateRetention(this.retentionId, retention).subscribe(
response => {
- this.loadingRule = false;
- this.retention = retention;
+ this.getRetention();
}, error => {
this.loadingRule = false;
this.errorHandler.error(error);
@@ -352,8 +367,7 @@ export class TagRetentionComponent implements OnInit {
retention.rules[this.editIndex] = rule;
this.tagRetentionService.updateRetention(this.retentionId, retention).subscribe(
response => {
- this.retention = retention;
- this.loadingRule = false;
+ this.getRetention();
}, error => {
this.errorHandler.error(error);
this.loadingRule = false;
diff --git a/src/portal/src/app/project/tag-retention/tag-retention.service.ts b/src/portal/src/app/project/tag-retention/tag-retention.service.ts
index 0792fb622..76940c324 100644
--- a/src/portal/src/app/project/tag-retention/tag-retention.service.ts
+++ b/src/portal/src/app/project/tag-retention/tag-retention.service.ts
@@ -28,8 +28,8 @@ export class TagRetentionService {
"latestPushedK": "RULE_NAME_3",
"latestPulledN": "RULE_NAME_4",
"always": "RULE_NAME_5",
- "dayspl": "RULE_NAME_6",
- "daysps": "RULE_NAME_7",
+ "nDaysSinceLastPull": "RULE_NAME_6",
+ "nDaysSinceLastPush": "RULE_NAME_7",
"the images from the last # days": "RULE_TEMPLATE_1",
"the most recent active # images": "RULE_TEMPLATE_2",
"the most recently pushed # images": "RULE_TEMPLATE_3",
diff --git a/src/portal/src/i18n/lang/en-us-lang.json b/src/portal/src/i18n/lang/en-us-lang.json
index ae060f0f8..82eb7df78 100644
--- a/src/portal/src/i18n/lang/en-us-lang.json
+++ b/src/portal/src/i18n/lang/en-us-lang.json
@@ -1206,7 +1206,9 @@
"RULE_NAME_6": " the images pulled within the last {{number}} days",
"RULE_NAME_7": " the images pushed within the last {{number}} days",
"RULE_TEMPLATE_6": " the images pulled within the last # days",
- "RULE_TEMPLATE_7": " the images pushed within the last # days"
+ "RULE_TEMPLATE_7": " the images pushed within the last # days",
+ "SCHEDULE": "Schedule",
+ "SCHEDULE_WARNING": "Executing the retention policy can have adverse effects to the images in this project and affected image tags will be deleted."
}
}
diff --git a/src/portal/src/i18n/lang/es-es-lang.json b/src/portal/src/i18n/lang/es-es-lang.json
index df102d442..2c9c5e02e 100644
--- a/src/portal/src/i18n/lang/es-es-lang.json
+++ b/src/portal/src/i18n/lang/es-es-lang.json
@@ -1203,7 +1203,9 @@
"RULE_NAME_6": " the images pulled within the last {{number}} days",
"RULE_NAME_7": " the images pushed within the last {{number}} days",
"RULE_TEMPLATE_6": " the images pulled within the last # days",
- "RULE_TEMPLATE_7": " the images pushed within the last # days"
+ "RULE_TEMPLATE_7": " the images pushed within the last # days",
+ "SCHEDULE": "Schedule",
+ "SCHEDULE_WARNING": "Executing the retention policy can have adverse effects to the images in this project and affected image tags will be deleted."
}
}
diff --git a/src/portal/src/i18n/lang/fr-fr-lang.json b/src/portal/src/i18n/lang/fr-fr-lang.json
index ae3d5faa3..bd948d912 100644
--- a/src/portal/src/i18n/lang/fr-fr-lang.json
+++ b/src/portal/src/i18n/lang/fr-fr-lang.json
@@ -1175,7 +1175,9 @@
"RULE_NAME_6": " the images pulled within the last {{number}} days",
"RULE_NAME_7": " the images pushed within the last {{number}} days",
"RULE_TEMPLATE_6": " the images pulled within the last # days",
- "RULE_TEMPLATE_7": " the images pushed within the last # days"
+ "RULE_TEMPLATE_7": " the images pushed within the last # days",
+ "SCHEDULE": "Schedule",
+ "SCHEDULE_WARNING": "Executing the retention policy can have adverse effects to the images in this project and affected image tags will be deleted."
}
}
diff --git a/src/portal/src/i18n/lang/pt-br-lang.json b/src/portal/src/i18n/lang/pt-br-lang.json
index 13e36487d..3ecec7b91 100644
--- a/src/portal/src/i18n/lang/pt-br-lang.json
+++ b/src/portal/src/i18n/lang/pt-br-lang.json
@@ -1200,7 +1200,9 @@
"RULE_NAME_6": " the images pulled within the last {{number}} days",
"RULE_NAME_7": " the images pushed within the last {{number}} days",
"RULE_TEMPLATE_6": " the images pulled within the last # days",
- "RULE_TEMPLATE_7": " the images pushed within the last # days"
+ "RULE_TEMPLATE_7": " the images pushed within the last # days",
+ "SCHEDULE": "Schedule",
+ "SCHEDULE_WARNING": "Executing the retention policy can have adverse effects to the images in this project and affected image tags will be deleted."
}
diff --git a/src/portal/src/i18n/lang/zh-cn-lang.json b/src/portal/src/i18n/lang/zh-cn-lang.json
index 2f4606fe9..313b23703 100644
--- a/src/portal/src/i18n/lang/zh-cn-lang.json
+++ b/src/portal/src/i18n/lang/zh-cn-lang.json
@@ -1202,7 +1202,9 @@
"RULE_NAME_6": "最近{{number}}天被拉取过的镜像",
"RULE_NAME_7": "最近{{number}}天被推送过的镜像",
"RULE_TEMPLATE_6": "最近#天被拉取过的镜像",
- "RULE_TEMPLATE_7": "最近#天被推送过的镜像"
+ "RULE_TEMPLATE_7": "最近#天被推送过的镜像",
+ "SCHEDULE": "定时任务",
+ "SCHEDULE_WARNING": "执行保留策略将对该项目中的镜像产生反向影响,受影响的镜像tags将会被删除。"
}
}