mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-19 16:55:16 +01:00
Merge pull request #8591 from AllForNothing/translate
fix issue and add new templats for tag-retention
This commit is contained in:
commit
b364ad89ae
@ -41,16 +41,16 @@
|
||||
<div class="clr-select-wrapper w-100">
|
||||
<select [(ngModel)]="template" class="clr-select w-100">
|
||||
<option *ngFor="let t of metadata?.templates"
|
||||
value="{{t?.rule_template}}">{{getI18nKey(t?.display_text)|translate}}</option>
|
||||
value="{{t?.rule_template}}">{{getI18nKey(t?.action)|translate}}{{getI18nKey(t?.display_text)|translate}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clr-col-3">
|
||||
<div class="over-line">
|
||||
<span *ngIf="template !=='always' && template !=='none'">{{getI18nKey(unit)|translate}}</span>
|
||||
<span *ngIf="hasParam()">{{getI18nKey(unit)|translate}}</span>
|
||||
</div>
|
||||
<div class="w-100 disabled">
|
||||
<input *ngIf="template !=='always'&& template !=='none'" [(ngModel)]="num" class="clr-input w-100">
|
||||
<input *ngIf="hasParam()" [(ngModel)]="num" class="clr-input w-100">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -128,28 +128,20 @@ export class AddRuleComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
canNotAdd(): boolean {
|
||||
if (this.rule.template === 'always'
|
||||
&& this.rule.scope_selectors.repository[0].pattern
|
||||
&& this.rule.tag_selectors[0].pattern) {
|
||||
return false;
|
||||
if (!this.isAdd) {
|
||||
return compareValue(this.editRuleOrigin, this.rule);
|
||||
}
|
||||
if (this.isAdd) {
|
||||
if (this.rule.template
|
||||
&& this.rule.params[this.template]
|
||||
if (!this.hasParam()) {
|
||||
return !(this.rule.template
|
||||
&& this.rule.scope_selectors.repository[0].pattern
|
||||
&& this.rule.tag_selectors[0].pattern) {
|
||||
return false;
|
||||
}
|
||||
&& this.rule.tag_selectors[0].pattern);
|
||||
} else {
|
||||
if (this.rule.template
|
||||
return !(this.rule.template
|
||||
&& this.rule.params[this.template]
|
||||
&& this.rule.scope_selectors.repository[0].pattern
|
||||
&& this.rule.tag_selectors[0].pattern && !compareValue(this.editRuleOrigin, this.rule)) {
|
||||
return false;
|
||||
&& this.rule.tag_selectors[0].pattern);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
open() {
|
||||
this.addRuleOpened = true;
|
||||
@ -171,4 +163,18 @@ export class AddRuleComponent implements OnInit, OnDestroy {
|
||||
getI18nKey(str: string) {
|
||||
return this.tagRetentionService.getI18nKey(str);
|
||||
}
|
||||
hasParam(): boolean {
|
||||
if (this.metadata && this.metadata.templates) {
|
||||
let flag: boolean = false;
|
||||
this.metadata.templates.forEach(t => {
|
||||
if (t.rule_template === this.template) {
|
||||
if ( t.params && t.params.length > 0) {
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
return flag;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -28,10 +28,14 @@ export class TagRetentionService {
|
||||
"latestPushedK": "RULE_NAME_3",
|
||||
"latestPulledN": "RULE_NAME_4",
|
||||
"always": "RULE_NAME_5",
|
||||
"dayspl": "RULE_NAME_6",
|
||||
"daysps": "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",
|
||||
"the most recently pulled # images": "RULE_TEMPLATE_4",
|
||||
"pulled within the last # days": "RULE_TEMPLATE_6",
|
||||
"pushed within the last # days": "RULE_TEMPLATE_7",
|
||||
"repoMatches": "MAT",
|
||||
"repoExcludes": "EXC",
|
||||
"matches": "MAT",
|
||||
@ -40,7 +44,8 @@ export class TagRetentionService {
|
||||
"withoutLabels": "WITHOUT",
|
||||
"COUNT": "UNIT_COUNT",
|
||||
"DAYS": "UNIT_DAY",
|
||||
"none": "NONE"
|
||||
"none": "NONE",
|
||||
"nothing": "NONE"
|
||||
};
|
||||
|
||||
constructor(
|
||||
|
@ -1123,11 +1123,11 @@
|
||||
"ADD_TITLE": "Add Tag Retention Rule",
|
||||
"ADD_SUBTITLE": "Specify a tag retention rule for this project. All tag retention rules are independently calculated and each rule can be applied to a selected list of repositories.",
|
||||
"BY_WHAT": "By image count or number of days",
|
||||
"RULE_TEMPLATE_1": "the images from the last # days",
|
||||
"RULE_TEMPLATE_2": "the most recent active # images",
|
||||
"RULE_TEMPLATE_3": "the most recently pushed # images",
|
||||
"RULE_TEMPLATE_4": "the most recently pulled # images",
|
||||
"RULE_TEMPLATE_5": "always",
|
||||
"RULE_TEMPLATE_1": " the images from the last # days",
|
||||
"RULE_TEMPLATE_2": " the most recent active # images",
|
||||
"RULE_TEMPLATE_3": " the most recently pushed # images",
|
||||
"RULE_TEMPLATE_4": " the most recently pulled # images",
|
||||
"RULE_TEMPLATE_5": " always",
|
||||
"ACTION_RETAIN": " retain",
|
||||
"UNIT_DAY": "DAYS",
|
||||
"UNIT_COUNT": "COUNT",
|
||||
@ -1166,7 +1166,11 @@
|
||||
"TRIGGER": "Schedule",
|
||||
"RETAINED": "Retained",
|
||||
"TOTAL": "Total",
|
||||
"NONE": "none"
|
||||
"NONE": " none",
|
||||
"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"
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1164,7 +1164,11 @@
|
||||
"TRIGGER": "Schedule",
|
||||
"RETAINED": "Retained",
|
||||
"TOTAL": "Total",
|
||||
"NONE": "none"
|
||||
"NONE": "none",
|
||||
"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"
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1136,7 +1136,11 @@
|
||||
"TRIGGER": "Schedule",
|
||||
"RETAINED": "Retained",
|
||||
"TOTAL": "Total",
|
||||
"NONE": "none"
|
||||
"NONE": "none",
|
||||
"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"
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1161,7 +1161,11 @@
|
||||
"TRIGGER": "Schedule",
|
||||
"RETAINED": "Retained",
|
||||
"TOTAL": "Total",
|
||||
"NONE": "none"
|
||||
"NONE": "none",
|
||||
"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"
|
||||
}
|
||||
|
||||
|
||||
|
@ -1128,15 +1128,15 @@
|
||||
"UNIT_DAY": "天数",
|
||||
"UNIT_COUNT": "个数",
|
||||
"NUMBER": "数量",
|
||||
"IN_REPOSITORIES": "适用于仓库",
|
||||
"IN_REPOSITORIES": "应用到仓库",
|
||||
"REP_SEPARATOR": "使用逗号分隔repos,repo*和**",
|
||||
"TAGS": "Tags",
|
||||
"MATCHES_TAGS": "匹配tags",
|
||||
"MATCHES_EXCEPT_TAGS": "反匹配tags",
|
||||
"MATCHES_EXCEPT_TAGS": "排除tags",
|
||||
"TAG_SEPARATOR": "使用逗号分割tags,tag*,**,or regex",
|
||||
"LABELS": "标签",
|
||||
"MATCHES_LABELS": "匹配标签",
|
||||
"MATCHES_EXCEPT_LABELS": "反匹配标签",
|
||||
"MATCHES_EXCEPT_LABELS": "排除标签",
|
||||
"REP_LABELS": "使用逗号分割标签",
|
||||
"RETENTION_RUN": "运行保留策略",
|
||||
"RETENTION_RUN_EXPLAIN": "执行保留策略将对该项目中的镜像产生反向影响,受影响的镜像tags将会被删除。您可选择取消或者使用模拟运行,或者点击运行以继续。",
|
||||
@ -1151,7 +1151,7 @@
|
||||
"EXCLUDES": "排除",
|
||||
"MATCHES": "匹配",
|
||||
"REPO": "仓库",
|
||||
"EXC": "反匹配",
|
||||
"EXC": "排除",
|
||||
"MAT": "匹配",
|
||||
"AND": "且",
|
||||
"WITH": "有",
|
||||
@ -1162,7 +1162,11 @@
|
||||
"TRIGGER": "定时执行",
|
||||
"RETAINED": "保留数",
|
||||
"TOTAL": "总数",
|
||||
"NONE": "空"
|
||||
"NONE": "空",
|
||||
"RULE_NAME_6": "最近{{number}}天被拉取过的镜像",
|
||||
"RULE_NAME_7": "最近{{number}}天被推送过的镜像",
|
||||
"RULE_TEMPLATE_6": "最近#天被拉取过的镜像",
|
||||
"RULE_TEMPLATE_7": "最近#天被推送过的镜像"
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user