mirror of
https://github.com/goharbor/harbor.git
synced 2025-01-22 15:41:26 +01:00
Merge pull request #8890 from AllForNothing/imp-validator
fix UI bug for tag-retention and project-quota
This commit is contained in:
commit
33eaf37edf
@ -32,7 +32,7 @@
|
||||
<button class="action-item" (click)="editQuota(quota)">{{'QUOTA.EDIT' | translate}}</button>
|
||||
</clr-dg-action-overflow>
|
||||
<clr-dg-cell>
|
||||
<a href="javascript:void(0)" (click)="goToLink(quota.id)">{{quota?.ref?.name}}</a></clr-dg-cell>
|
||||
<a href="javascript:void(0)" (click)="goToLink(quota?.ref?.id)">{{quota?.ref?.name}}</a></clr-dg-cell>
|
||||
<clr-dg-cell>{{quota?.ref?.owner_name}}</clr-dg-cell>
|
||||
<clr-dg-cell>
|
||||
<div class="progress-block progress-min-width">
|
||||
@ -76,4 +76,4 @@
|
||||
</div>
|
||||
</div>
|
||||
<edit-project-quotas #editProjectQuotas (confirmAction)="confirmEdit($event)"></edit-project-quotas>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -4,11 +4,11 @@
|
||||
.default-quota-text {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
min-width: 13rem;
|
||||
min-width: 14rem;
|
||||
|
||||
.num-count {
|
||||
display: inline-block;
|
||||
min-width: 2rem;
|
||||
min-width: 3rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -39,4 +39,4 @@
|
||||
.refresh-div {
|
||||
margin-top: auto;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
@ -157,6 +157,7 @@ export class AddRuleComponent implements OnInit, OnDestroy {
|
||||
return !(this.rule.template
|
||||
&& this.rule.params[this.template]
|
||||
&& parseInt(this.rule.params[this.template], 10) >= 0
|
||||
&& parseInt(this.rule.params[this.template], 10) < MAX
|
||||
&& this.rule.scope_selectors.repository[0].pattern
|
||||
&& this.rule.scope_selectors.repository[0].pattern.replace(/[{}]/g, "")
|
||||
&& this.rule.tag_selectors[0].pattern
|
||||
@ -187,11 +188,6 @@ export class AddRuleComponent implements OnInit, OnDestroy {
|
||||
this.inlineAlert.showInlineError(INVALID_RULE);
|
||||
return;
|
||||
}
|
||||
if (this.hasParam()
|
||||
&& (this.rule.params[this.template] <= 0 || this.rule.params[this.template] > MAX)) {
|
||||
this.inlineAlert.showInlineError(ILLEGAL_RULE);
|
||||
return;
|
||||
}
|
||||
if (this.isExistingRule()) {
|
||||
this.inlineAlert.showInlineError(EXISTING_RULE);
|
||||
return;
|
||||
|
@ -95,6 +95,9 @@
|
||||
<clr-dg-column>
|
||||
{{'TAG_RETENTION.DRY_RUN' | translate}}
|
||||
</clr-dg-column>
|
||||
<clr-dg-column>
|
||||
{{'TAG_RETENTION.EXECUTION_TYPE' | translate}}
|
||||
</clr-dg-column>
|
||||
<clr-dg-column>
|
||||
{{'TAG_RETENTION.START_TIME' | translate}}
|
||||
</clr-dg-column>
|
||||
@ -113,7 +116,9 @@
|
||||
<clr-dg-cell class="hand"
|
||||
(click)="openDetail(i,execution.id)">{{execution.dry_run ? 'YES' : 'NO'}}</clr-dg-cell>
|
||||
<clr-dg-cell class="hand"
|
||||
(click)="openDetail(i,execution.id)">{{execution.start_time|date:'short'}}</clr-dg-cell>
|
||||
(click)="openDetail(i,execution.id)">{{execution.Trigger}}</clr-dg-cell>
|
||||
<clr-dg-cell class="hand"
|
||||
(click)="openDetail(i,execution.id)">{{execution.start_time|date:'medium'}}</clr-dg-cell>
|
||||
<clr-dg-cell class="hand" (click)="openDetail(i,execution.id)">{{execution.duration}}</clr-dg-cell>
|
||||
<clr-dg-row-detail *ngIf="index===i">
|
||||
<clr-datagrid [clrDgLoading]="loadingHistories" class="w-100">
|
||||
@ -130,7 +135,7 @@
|
||||
<clr-dg-cell>{{task.repository}}</clr-dg-cell>
|
||||
<clr-dg-cell>{{task.status}}</clr-dg-cell>
|
||||
<clr-dg-cell>{{task.retained}}/{{task.total}}</clr-dg-cell>
|
||||
<clr-dg-cell>{{task.start_time|date:'short'}}</clr-dg-cell>
|
||||
<clr-dg-cell>{{task.start_time|date:'medium'}}</clr-dg-cell>
|
||||
<clr-dg-cell>{{task.duration}}</clr-dg-cell>
|
||||
<clr-dg-cell><span (click)="seeLog(task.execution_id,task.id)"
|
||||
class="hand color-79b">{{'TAG_RETENTION.LOG' | translate}}</span>
|
||||
@ -215,4 +220,4 @@
|
||||
<button type="button" (click)="closeConfirm()" class="btn btn-primary">{{'BUTTON.OK' | translate}}</button>
|
||||
</div>
|
||||
</clr-modal>
|
||||
<div class="backdrop-transparent" (click)="ruleIndex = -1" *ngIf="ruleIndex !== -1"></div>
|
||||
<div class="backdrop-transparent" (click)="ruleIndex = -1" *ngIf="ruleIndex !== -1"></div>
|
||||
|
@ -268,19 +268,21 @@ export class TagRetentionComponent implements OnInit {
|
||||
static calculateDuration(arr: Array<any>) {
|
||||
if (arr && arr.length > 0) {
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
let duration = new Date(arr[i].end_time).getTime() - new Date(arr[i].start_time).getTime();
|
||||
let min = Math.floor(duration / MIN);
|
||||
let sec = Math.floor((duration % MIN) / SEC);
|
||||
arr[i]['duration'] = "";
|
||||
if ((min || sec) && duration > 0) {
|
||||
if (min) {
|
||||
arr[i]['duration'] += '' + min + MIN_STR;
|
||||
if (arr[i].end_time && arr[i].start_time) {
|
||||
let duration = new Date(arr[i].end_time).getTime() - new Date(arr[i].start_time).getTime();
|
||||
let min = Math.floor(duration / MIN);
|
||||
let sec = Math.floor((duration % MIN) / SEC);
|
||||
arr[i]['duration'] = "";
|
||||
if ((min || sec) && duration > 0) {
|
||||
if (min) {
|
||||
arr[i]['duration'] += '' + min + MIN_STR;
|
||||
}
|
||||
if (sec) {
|
||||
arr[i]['duration'] += '' + sec + SEC_STR;
|
||||
}
|
||||
} else {
|
||||
arr[i]['duration'] = "0";
|
||||
}
|
||||
if (sec) {
|
||||
arr[i]['duration'] += '' + sec + SEC_STR;
|
||||
}
|
||||
} else if ( min === 0 && sec === 0 && duration > 0) {
|
||||
arr[i]['duration'] = "0";
|
||||
} else {
|
||||
arr[i]['duration'] = "N/A";
|
||||
}
|
||||
@ -353,6 +355,9 @@ export class TagRetentionComponent implements OnInit {
|
||||
this.addRuleComponent.close();
|
||||
this.addRuleComponent.onGoing = false;
|
||||
}, error => {
|
||||
if (error && error.error && error.error.message) {
|
||||
error = this.tagRetentionService.getI18nKey(error.error.message);
|
||||
}
|
||||
this.addRuleComponent.inlineAlert.showInlineError(error);
|
||||
this.loadingRule = false;
|
||||
this.addRuleComponent.onGoing = false;
|
||||
@ -366,7 +371,10 @@ export class TagRetentionComponent implements OnInit {
|
||||
}, error => {
|
||||
this.loadingRule = false;
|
||||
this.addRuleComponent.onGoing = false;
|
||||
this.addRuleComponent.inlineAlert.showInlineError(error);
|
||||
if (error && error.error && error.error.message) {
|
||||
error = this.tagRetentionService.getI18nKey(error.error.message);
|
||||
}
|
||||
this.addRuleComponent.inlineAlert.showInlineError(error);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
@ -378,6 +386,9 @@ export class TagRetentionComponent implements OnInit {
|
||||
this.addRuleComponent.close();
|
||||
this.addRuleComponent.onGoing = false;
|
||||
}, error => {
|
||||
if (error && error.error && error.error.message) {
|
||||
error = this.tagRetentionService.getI18nKey(error.error.message);
|
||||
}
|
||||
this.addRuleComponent.inlineAlert.showInlineError(error);
|
||||
this.loadingRule = false;
|
||||
this.addRuleComponent.onGoing = false;
|
||||
|
@ -45,7 +45,11 @@ export class TagRetentionService {
|
||||
"COUNT": "UNIT_COUNT",
|
||||
"DAYS": "UNIT_DAY",
|
||||
"none": "NONE",
|
||||
"nothing": "NONE"
|
||||
"nothing": "NONE",
|
||||
"Parameters nDaysSinceLastPull is too large": "DAYS_LARGE",
|
||||
"Parameters nDaysSinceLastPush is too large": "DAYS_LARGE",
|
||||
"Parameters latestPushedK is too large": "COUNT_LARGE",
|
||||
"Parameters latestPulledN is too large": "COUNT_LARGE"
|
||||
};
|
||||
|
||||
constructor(
|
||||
|
@ -1210,10 +1210,13 @@
|
||||
"RULE_TEMPLATE_6": " the images pulled 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.",
|
||||
"SCHEDULE_WARNING": "Executing retention policy results in the irreversible effect of deleting images from the Harbor project. Please double check all policies before scheduling.",
|
||||
"EXISTING_RULE": "Existing rule",
|
||||
"ILLEGAL_RULE": "Illegal rule",
|
||||
"INVALID_RULE": "Invalid rule"
|
||||
"INVALID_RULE": "Invalid rule",
|
||||
"COUNT_LARGE": "Parameter \"COUNT\" is too large",
|
||||
"DAYS_LARGE": "Parameter \"DAYS\" is too large",
|
||||
"EXECUTION_TYPE": "Execution Type"
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1207,10 +1207,13 @@
|
||||
"RULE_TEMPLATE_6": " the images pulled 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.",
|
||||
"SCHEDULE_WARNING": "Executing retention policy results in the irreversible effect of deleting images from the Harbor project. Please double check all policies before scheduling.",
|
||||
"EXISTING_RULE": "Existing rule",
|
||||
"ILLEGAL_RULE": "Illegal rule",
|
||||
"INVALID_RULE": "Invalid rule"
|
||||
"INVALID_RULE": "Invalid rule",
|
||||
"COUNT_LARGE": "Parameter \"COUNT\" is too large",
|
||||
"DAYS_LARGE": "Parameter \"DAYS\" is too large",
|
||||
"EXECUTION_TYPE": "Execution Type"
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1179,10 +1179,13 @@
|
||||
"RULE_TEMPLATE_6": " the images pulled 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.",
|
||||
"SCHEDULE_WARNING": "Executing retention policy results in the irreversible effect of deleting images from the Harbor project. Please double check all policies before scheduling.",
|
||||
"EXISTING_RULE": "Existing rule",
|
||||
"ILLEGAL_RULE": "Illegal rule",
|
||||
"INVALID_RULE": "Invalid rule"
|
||||
"INVALID_RULE": "Invalid rule",
|
||||
"COUNT_LARGE": "Parameter \"COUNT\" is too large",
|
||||
"DAYS_LARGE": "Parameter \"DAYS\" is too large",
|
||||
"EXECUTION_TYPE": "Execution Type"
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1204,10 +1204,13 @@
|
||||
"RULE_TEMPLATE_6": " the images pulled 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.",
|
||||
"SCHEDULE_WARNING": "Executing retention policy results in the irreversible effect of deleting images from the Harbor project. Please double check all policies before scheduling.",
|
||||
"EXISTING_RULE": "Existing rule",
|
||||
"ILLEGAL_RULE": "Illegal rule",
|
||||
"INVALID_RULE": "Invalid rule"
|
||||
"INVALID_RULE": "Invalid rule",
|
||||
"COUNT_LARGE": "Parameter \"COUNT\" is too large",
|
||||
"DAYS_LARGE": "Parameter \"DAYS\" is too large",
|
||||
"EXECUTION_TYPE": "Execution Type"
|
||||
}
|
||||
|
||||
|
||||
|
@ -1210,10 +1210,13 @@
|
||||
"RULE_TEMPLATE_6": " imajlar son # gün içinde imdirilmiş",
|
||||
"RULE_TEMPLATE_7": " imajlar son # gün içinde yüklendi.",
|
||||
"SCHEDULE": "Program",
|
||||
"SCHEDULE_WARNING": "Tutma ilkesinin yürütülmesinin bu projedeki görüntüler üzerinde olumsuz etkileri olabilir ve etkilenen imajların etiketleri silinecektir.",
|
||||
"SCHEDULE_WARNING": "Executing retention policy results in the irreversible effect of deleting images from the Harbor project. Please double check all policies before scheduling.",
|
||||
"EXISTING_RULE": "Existing rule",
|
||||
"ILLEGAL_RULE": "Illegal rule",
|
||||
"INVALID_RULE": "Invalid rule"
|
||||
"INVALID_RULE": "Invalid rule",
|
||||
"COUNT_LARGE": "Parameter \"COUNT\" is too large",
|
||||
"DAYS_LARGE": "Parameter \"DAYS\" is too large",
|
||||
"EXECUTION_TYPE": "Execution Type"
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1206,10 +1206,13 @@
|
||||
"RULE_TEMPLATE_6": "最近#天被拉取过的镜像",
|
||||
"RULE_TEMPLATE_7": "最近#天被推送过的镜像",
|
||||
"SCHEDULE": "定时任务",
|
||||
"SCHEDULE_WARNING": "执行保留策略将对该项目中的镜像产生反向影响,受影响的镜像tags将会被删除。",
|
||||
"SCHEDULE_WARNING": "执行保留策略会将会删除受影响的镜像,且不可恢复。请在制定定时任务前仔细检查所有保留规则。",
|
||||
"EXISTING_RULE": "规则已存在",
|
||||
"ILLEGAL_RULE": "规则不合法",
|
||||
"INVALID_RULE": "无效规则"
|
||||
"INVALID_RULE": "无效规则",
|
||||
"COUNT_LARGE": "参数“个数”太大",
|
||||
"DAYS_LARGE": "参数“天数”太大",
|
||||
"EXECUTION_TYPE": "执行类型"
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user