mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-27 20:59:10 +01:00
fix frontend issues
Signed-off-by: Meina Zhou <meinaz@vmware.com>
This commit is contained in:
parent
dc35be09c4
commit
0028dc0d62
@ -33,7 +33,7 @@
|
|||||||
<label class="form-group-label-override required">{{'REPLICATION.SOURCE_REGISTRY' | translate}}</label>
|
<label class="form-group-label-override required">{{'REPLICATION.SOURCE_REGISTRY' | translate}}</label>
|
||||||
<div class="form-select">
|
<div class="form-select">
|
||||||
<div class="select endpointSelect pull-left">
|
<div class="select endpointSelect pull-left">
|
||||||
<select id="src_registry_id" (change)="sourceChange($event)" formControlName="src_registry">
|
<select id="src_registry_id" (change)="sourceChange($event)" formControlName="src_registry" [compareWith]="equals" ngModel>
|
||||||
<option *ngFor="let source of sourceList" [ngValue]="source">{{source.name}}-{{source.url}}</option>
|
<option *ngFor="let source of sourceList" [ngValue]="source">{{source.name}}-{{source.url}}</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@ -59,7 +59,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<!--images/Filter-->
|
<!--images/Filter-->
|
||||||
<div class="form-group form-group-override">
|
<div class="form-group form-group-override">
|
||||||
<label class="form-group-label-override">{{'REPLICATION.SOURCE_IMAGES_FILTER' | translate}}</label>
|
<label class="form-group-label-override">{{'REPLICATION.SOURCE_RESOURCE_FILTER' | translate}}</label>
|
||||||
<div formArrayName="filters">
|
<div formArrayName="filters">
|
||||||
<div class="filterSelect" *ngFor="let filter of filters.controls; let i=index">
|
<div class="filterSelect" *ngFor="let filter of filters.controls; let i=index">
|
||||||
<div [formGroupName]="i">
|
<div [formGroupName]="i">
|
||||||
@ -88,7 +88,7 @@
|
|||||||
<label class="form-group-label-override required">{{'REPLICATION.DEST_REGISTRY' | translate}}</label>
|
<label class="form-group-label-override required">{{'REPLICATION.DEST_REGISTRY' | translate}}</label>
|
||||||
<div class="form-select">
|
<div class="form-select">
|
||||||
<div class="select endpointSelect pull-left">
|
<div class="select endpointSelect pull-left">
|
||||||
<select id="dest_registry_id" (change)="targetChange($event)" formControlName="dest_registry">
|
<select id="dest_registry" (change)="targetChange($event)" formControlName="dest_registry" [compareWith]="equals" ngModel>
|
||||||
<option *ngFor="let target of targetList" [ngValue]="target">{{target.name}}-{{target.url}}</option>
|
<option *ngFor="let target of targetList" [ngValue]="target">{{target.name}}-{{target.url}}</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@ -136,6 +136,12 @@
|
|||||||
<label for="ruleDeletion" class="clr-control-label">{{'REPLICATION.DELETE_REMOTE_IMAGES' | translate}}</label>
|
<label for="ruleDeletion" class="clr-control-label">{{'REPLICATION.DELETE_REMOTE_IMAGES' | translate}}</label>
|
||||||
</clr-checkbox-wrapper>
|
</clr-checkbox-wrapper>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="clr-form-control rule-width">
|
||||||
|
<clr-checkbox-wrapper>
|
||||||
|
<input type="checkbox" clrCheckbox [checked]="true" id="enablePolicy" formControlName="enabled" class="clr-checkbox">
|
||||||
|
<label for="enablePolicy" class="clr-control-label">{{'REPLICATION.ENABLED' | translate}}</label>
|
||||||
|
</clr-checkbox-wrapper>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="loading-center">
|
<div class="loading-center">
|
||||||
<span class="spinner spinner-inline" [hidden]="inProgress === false"></span>
|
<span class="spinner spinner-inline" [hidden]="inProgress === false"></span>
|
||||||
|
@ -46,14 +46,15 @@ describe("CreateEditRuleComponent (inline template)", () => {
|
|||||||
id: 1,
|
id: 1,
|
||||||
name: "sync_01",
|
name: "sync_01",
|
||||||
description: "",
|
description: "",
|
||||||
src_registry_id: 2,
|
src_registry: {id: 2},
|
||||||
src_namespaces: ["name1", "name2"],
|
src_namespaces: ["name1", "name2"],
|
||||||
trigger: {
|
trigger: {
|
||||||
kind: "Manual",
|
kind: "Manual",
|
||||||
schedule_param: {}
|
schedule_param: {}
|
||||||
},
|
},
|
||||||
filters: [],
|
filters: [],
|
||||||
deletion: false
|
deletion: false,
|
||||||
|
enabled: true
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
let mockJobs: ReplicationJobItem[] = [
|
let mockJobs: ReplicationJobItem[] = [
|
||||||
@ -157,13 +158,14 @@ describe("CreateEditRuleComponent (inline template)", () => {
|
|||||||
name: "sync_01",
|
name: "sync_01",
|
||||||
description: "",
|
description: "",
|
||||||
src_namespaces: ["namespace1", "namespace2"],
|
src_namespaces: ["namespace1", "namespace2"],
|
||||||
src_registry_id: 10,
|
src_registry: {id: 10 },
|
||||||
trigger: {
|
trigger: {
|
||||||
kind: "Manual",
|
kind: "Manual",
|
||||||
schedule_param: {}
|
schedule_param: {}
|
||||||
},
|
},
|
||||||
filters: [],
|
filters: [],
|
||||||
deletion: false
|
deletion: false,
|
||||||
|
enabled: true
|
||||||
};
|
};
|
||||||
|
|
||||||
let mockRegistryInfo = {
|
let mockRegistryInfo = {
|
||||||
@ -192,9 +194,9 @@ describe("CreateEditRuleComponent (inline template)", () => {
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"supported_triggers": [
|
"supported_triggers": [
|
||||||
"Manual",
|
"manual",
|
||||||
"Scheduled",
|
"scheduled",
|
||||||
"EventBased"
|
"event_based"
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ export class CreateEditRuleComponent implements OnInit, OnDestroy {
|
|||||||
TRIGGER_TYPES = {
|
TRIGGER_TYPES = {
|
||||||
MANUAL: "manual",
|
MANUAL: "manual",
|
||||||
SCHEDULED: "scheduled",
|
SCHEDULED: "scheduled",
|
||||||
EVENT_BASED: "eventBased"
|
EVENT_BASED: "event_based"
|
||||||
};
|
};
|
||||||
|
|
||||||
ruleNameTooltip = "REPLICATION.NAME_TOOLTIP";
|
ruleNameTooltip = "REPLICATION.NAME_TOOLTIP";
|
||||||
@ -132,6 +132,10 @@ export class CreateEditRuleComponent implements OnInit, OnDestroy {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
equals(c1: any, c2: any): boolean {
|
||||||
|
return c1 && c2 ? c1.id === c2.id : c1 === c2;
|
||||||
|
}
|
||||||
|
|
||||||
modeChange(): void {
|
modeChange(): void {
|
||||||
if (this.isPushMode) {
|
if (this.isPushMode) {
|
||||||
this.initRegistryInfo(0);
|
this.initRegistryInfo(0);
|
||||||
@ -178,7 +182,8 @@ export class CreateEditRuleComponent implements OnInit, OnDestroy {
|
|||||||
})
|
})
|
||||||
}),
|
}),
|
||||||
filters: this.fb.array([]),
|
filters: this.fb.array([]),
|
||||||
deletion: false
|
deletion: false,
|
||||||
|
enabled: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -204,7 +209,8 @@ export class CreateEditRuleComponent implements OnInit, OnDestroy {
|
|||||||
cron: ""
|
cron: ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
deletion: false
|
deletion: false,
|
||||||
|
enabled: true
|
||||||
});
|
});
|
||||||
this.setFilter([]);
|
this.setFilter([]);
|
||||||
this.initRegistryInfo(0);
|
this.initRegistryInfo(0);
|
||||||
@ -217,17 +223,17 @@ export class CreateEditRuleComponent implements OnInit, OnDestroy {
|
|||||||
description: rule.description,
|
description: rule.description,
|
||||||
src_namespaces: rule.src_namespaces,
|
src_namespaces: rule.src_namespaces,
|
||||||
dest_namespace: rule.dest_namespace,
|
dest_namespace: rule.dest_namespace,
|
||||||
|
src_registry: rule.src_registry,
|
||||||
|
dest_registry: rule.dest_registry,
|
||||||
trigger: rule.trigger,
|
trigger: rule.trigger,
|
||||||
deletion: rule.deletion
|
deletion: rule.deletion,
|
||||||
|
enabled: rule.enabled
|
||||||
});
|
});
|
||||||
|
|
||||||
this.noSelectedEndpoint = false;
|
this.noSelectedEndpoint = false;
|
||||||
|
|
||||||
if (rule.filters) {
|
if (rule.filters) {
|
||||||
this.setFilter(rule.filters);
|
this.setFilter(rule.filters);
|
||||||
this.updateFilter(rule.filters);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Force refresh view
|
// Force refresh view
|
||||||
let hnd = setInterval(() => this.ref.markForCheck(), 100);
|
let hnd = setInterval(() => this.ref.markForCheck(), 100);
|
||||||
setTimeout(() => clearInterval(hnd), 2000);
|
setTimeout(() => clearInterval(hnd), 2000);
|
||||||
@ -307,9 +313,6 @@ export class CreateEditRuleComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateFilter(filters: any) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public hasFormChange(): boolean {
|
public hasFormChange(): boolean {
|
||||||
return !isEmptyObject(this.hasChanges());
|
return !isEmptyObject(this.hasChanges());
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,8 @@ describe('ListReplicationRuleComponent (inline template)', () => {
|
|||||||
"error_job_count": 2,
|
"error_job_count": 2,
|
||||||
"deletion": false,
|
"deletion": false,
|
||||||
"src_namespaces": ["name1", "name2"],
|
"src_namespaces": ["name1", "name2"],
|
||||||
"src_registry_id": 3
|
"src_registry": {id: 3},
|
||||||
|
"enabled": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 2,
|
"id": 2,
|
||||||
@ -39,7 +40,8 @@ describe('ListReplicationRuleComponent (inline template)', () => {
|
|||||||
"error_job_count": 2,
|
"error_job_count": 2,
|
||||||
"deletion": false,
|
"deletion": false,
|
||||||
"src_namespaces": ["name1", "name2"],
|
"src_namespaces": ["name1", "name2"],
|
||||||
"dest_registry_id": 3
|
"dest_registry": {id: 3},
|
||||||
|
"enabled": true
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -37,8 +37,9 @@ describe('Replication Component (inline template)', () => {
|
|||||||
"trigger": {"kind": "Manual", "schedule_param": null},
|
"trigger": {"kind": "Manual", "schedule_param": null},
|
||||||
"error_job_count": 2,
|
"error_job_count": 2,
|
||||||
"deletion": false,
|
"deletion": false,
|
||||||
"src_registry_id": 3,
|
"src_registry": {id: 3},
|
||||||
"src_namespaces": ["name1"]
|
"src_namespaces": ["name1"],
|
||||||
|
"enabled": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 2,
|
"id": 2,
|
||||||
@ -48,8 +49,9 @@ describe('Replication Component (inline template)', () => {
|
|||||||
"trigger": {"kind": "Manual", "schedule_param": null},
|
"trigger": {"kind": "Manual", "schedule_param": null},
|
||||||
"error_job_count": 2,
|
"error_job_count": 2,
|
||||||
"deletion": false,
|
"deletion": false,
|
||||||
"dest_registry_id": 5,
|
"dest_registry": {id: 5},
|
||||||
"src_namespaces": ["name1"]
|
"src_namespaces": ["name1"],
|
||||||
|
"enabled": true
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -109,10 +109,11 @@ export interface ReplicationRule extends Base {
|
|||||||
trigger: Trigger;
|
trigger: Trigger;
|
||||||
filters: Filter[];
|
filters: Filter[];
|
||||||
deletion?: boolean;
|
deletion?: boolean;
|
||||||
src_registry_id?: number;
|
src_registry?: any;
|
||||||
dest_registry_id?: number;
|
dest_registry?: any;
|
||||||
src_namespaces: string [];
|
src_namespaces: string [];
|
||||||
dest_namespace?: string;
|
dest_namespace?: string;
|
||||||
|
enabled: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Filter {
|
export class Filter {
|
||||||
|
@ -431,7 +431,7 @@
|
|||||||
"JOB_LOG_VIEWER": "View Replication Job Log",
|
"JOB_LOG_VIEWER": "View Replication Job Log",
|
||||||
"NO_ENDPOINT_INFO": "Please add an endpoint first",
|
"NO_ENDPOINT_INFO": "Please add an endpoint first",
|
||||||
"NO_PROJECT_INFO": "This project is not exist",
|
"NO_PROJECT_INFO": "This project is not exist",
|
||||||
"SOURCE_IMAGES_FILTER": "Source images filter",
|
"SOURCE_RESOURCE_FILTER": "Source resource filter",
|
||||||
"SCHEDULED": "Scheduled",
|
"SCHEDULED": "Scheduled",
|
||||||
"MANUAL": "Manual",
|
"MANUAL": "Manual",
|
||||||
"EVENT_BASED":"Event Based",
|
"EVENT_BASED":"Event Based",
|
||||||
@ -445,6 +445,7 @@
|
|||||||
"SOURCE_PROJECT": "Source project",
|
"SOURCE_PROJECT": "Source project",
|
||||||
"REPLICATE": "Replicate",
|
"REPLICATE": "Replicate",
|
||||||
"DELETE_REMOTE_IMAGES": "Delete remote images when locally deleted",
|
"DELETE_REMOTE_IMAGES": "Delete remote images when locally deleted",
|
||||||
|
"DELETE_ENABLED": "Enabled this policy",
|
||||||
"REPLICATE_IMMEDIATE": "Replicate existing images immediately",
|
"REPLICATE_IMMEDIATE": "Replicate existing images immediately",
|
||||||
"NEW": "New",
|
"NEW": "New",
|
||||||
"NAME_TOOLTIP": "replication rule name should be at least 2 characters long with lower case characters, numbers and ._- and must be start with characters or numbers.",
|
"NAME_TOOLTIP": "replication rule name should be at least 2 characters long with lower case characters, numbers and ._- and must be start with characters or numbers.",
|
||||||
|
@ -432,7 +432,7 @@
|
|||||||
"JOB_LOG_VIEWER": "View Replication Job Log",
|
"JOB_LOG_VIEWER": "View Replication Job Log",
|
||||||
"NO_ENDPOINT_INFO": "Please add an endpoint first",
|
"NO_ENDPOINT_INFO": "Please add an endpoint first",
|
||||||
"NO_PROJECT_INFO": "This project is not exist",
|
"NO_PROJECT_INFO": "This project is not exist",
|
||||||
"SOURCE_IMAGES_FILTER": "Source images filter",
|
"SOURCE_RESOURCE_FILTER": "Source resource filter",
|
||||||
"SCHEDULED": "Scheduled",
|
"SCHEDULED": "Scheduled",
|
||||||
"MANUAL": "Manual",
|
"MANUAL": "Manual",
|
||||||
"EVENT_BASED":"Event Based",
|
"EVENT_BASED":"Event Based",
|
||||||
@ -446,6 +446,7 @@
|
|||||||
"SOURCE_PROJECT": "Source project",
|
"SOURCE_PROJECT": "Source project",
|
||||||
"REPLICATE": "Replicate",
|
"REPLICATE": "Replicate",
|
||||||
"DELETE_REMOTE_IMAGES": "Delete remote images when locally deleted",
|
"DELETE_REMOTE_IMAGES": "Delete remote images when locally deleted",
|
||||||
|
"DELETE_ENABLED": "Enabled this policy",
|
||||||
"REPLICATE_IMMEDIATE": "Replicate existing images immediately",
|
"REPLICATE_IMMEDIATE": "Replicate existing images immediately",
|
||||||
"NEW": "New",
|
"NEW": "New",
|
||||||
"NAME_TOOLTIP": "replication rule name should be at least 2 characters long with lower case characters, numbers and ._- and must be start with characters or numbers.",
|
"NAME_TOOLTIP": "replication rule name should be at least 2 characters long with lower case characters, numbers and ._- and must be start with characters or numbers.",
|
||||||
|
@ -413,7 +413,7 @@
|
|||||||
"JOB_LOG_VIEWER": "Afficher les logs des travaux de réplication",
|
"JOB_LOG_VIEWER": "Afficher les logs des travaux de réplication",
|
||||||
"NO_ENDPOINT_INFO": "Please add an endpoint first",
|
"NO_ENDPOINT_INFO": "Please add an endpoint first",
|
||||||
"NO_PROJECT_INFO": "This project is not exist",
|
"NO_PROJECT_INFO": "This project is not exist",
|
||||||
"SOURCE_IMAGES_FILTER": "Source images filter",
|
"SOURCE_RESOURCE_FILTER": "Source resource filter",
|
||||||
"SCHEDULED": "Scheduled",
|
"SCHEDULED": "Scheduled",
|
||||||
"MANUAL": "Manual",
|
"MANUAL": "Manual",
|
||||||
"EVENT_BASED":"Event Based",
|
"EVENT_BASED":"Event Based",
|
||||||
@ -427,6 +427,7 @@
|
|||||||
"SOURCE_PROJECT": "Source project",
|
"SOURCE_PROJECT": "Source project",
|
||||||
"REPLICATE": "Replicate",
|
"REPLICATE": "Replicate",
|
||||||
"DELETE_REMOTE_IMAGES": "Delete remote images when locally deleted",
|
"DELETE_REMOTE_IMAGES": "Delete remote images when locally deleted",
|
||||||
|
"DELETE_ENABLED": "Enabled this policy",
|
||||||
"REPLICATE_IMMEDIATE": "Replicate existing images immediately",
|
"REPLICATE_IMMEDIATE": "Replicate existing images immediately",
|
||||||
"NEW": "New",
|
"NEW": "New",
|
||||||
"NAME_TOOLTIP": "replication rule name should be at least 2 characters long with lower case characters, numbers and ._- and must be start with characters or numbers.",
|
"NAME_TOOLTIP": "replication rule name should be at least 2 characters long with lower case characters, numbers and ._- and must be start with characters or numbers.",
|
||||||
|
@ -431,7 +431,7 @@
|
|||||||
"JOB_LOG_VIEWER": "Ver log da tarefa de replicação",
|
"JOB_LOG_VIEWER": "Ver log da tarefa de replicação",
|
||||||
"NO_ENDPOINT_INFO": "Por favor adicione antes um endpoint",
|
"NO_ENDPOINT_INFO": "Por favor adicione antes um endpoint",
|
||||||
"NO_PROJECT_INFO": "Esse projeto não existe",
|
"NO_PROJECT_INFO": "Esse projeto não existe",
|
||||||
"SOURCE_IMAGES_FILTER": "Filtro de imagens de origem",
|
"SOURCE_RESOURCE_FILTER": "Source resource filter",
|
||||||
"SCHEDULED": "Agendado",
|
"SCHEDULED": "Agendado",
|
||||||
"MANUAL": "Manual",
|
"MANUAL": "Manual",
|
||||||
"EVENT_BASED":"Event Based",
|
"EVENT_BASED":"Event Based",
|
||||||
@ -445,6 +445,7 @@
|
|||||||
"SOURCE_PROJECT": "Projeto de origem",
|
"SOURCE_PROJECT": "Projeto de origem",
|
||||||
"REPLICATE": "Replicar",
|
"REPLICATE": "Replicar",
|
||||||
"DELETE_REMOTE_IMAGES":"Remover imagens remotas quando removido localmente",
|
"DELETE_REMOTE_IMAGES":"Remover imagens remotas quando removido localmente",
|
||||||
|
"DELETE_ENABLED": "Enabled this policy",
|
||||||
"REPLICATE_IMMEDIATE":"Replicar imagens existentes imediatamente",
|
"REPLICATE_IMMEDIATE":"Replicar imagens existentes imediatamente",
|
||||||
"NEW": "Novo",
|
"NEW": "Novo",
|
||||||
"NAME_TOOLTIP": "nome da regra de replicação deve conter ao menos 2 caracteres sendo caracteres minusculos, números e ._- e devem iniciar com letras e números.",
|
"NAME_TOOLTIP": "nome da regra de replicação deve conter ao menos 2 caracteres sendo caracteres minusculos, números e ._- e devem iniciar com letras e números.",
|
||||||
|
@ -432,7 +432,7 @@
|
|||||||
"JOB_LOG_VIEWER": "查看复制任务日志",
|
"JOB_LOG_VIEWER": "查看复制任务日志",
|
||||||
"NO_ENDPOINT_INFO": "请先添加一个目标",
|
"NO_ENDPOINT_INFO": "请先添加一个目标",
|
||||||
"NO_PROJECT_INFO": "此项目不存在",
|
"NO_PROJECT_INFO": "此项目不存在",
|
||||||
"SOURCE_IMAGES_FILTER": "源镜像过滤器",
|
"SOURCE_RESOURCE_FILTER": "源资源过滤器",
|
||||||
"SCHEDULED": "定时",
|
"SCHEDULED": "定时",
|
||||||
"MANUAL": "手动",
|
"MANUAL": "手动",
|
||||||
"EVENT_BASED":"事件驱动",
|
"EVENT_BASED":"事件驱动",
|
||||||
@ -446,6 +446,7 @@
|
|||||||
"SOURCE_PROJECT": "源项目",
|
"SOURCE_PROJECT": "源项目",
|
||||||
"REPLICATE": "复制",
|
"REPLICATE": "复制",
|
||||||
"DELETE_REMOTE_IMAGES": "删除本地镜像时同时也删除远程的镜像。",
|
"DELETE_REMOTE_IMAGES": "删除本地镜像时同时也删除远程的镜像。",
|
||||||
|
"DELETE_ENABLED": "默认启用该规则",
|
||||||
"REPLICATE_IMMEDIATE": "立即复制现有的镜像。",
|
"REPLICATE_IMMEDIATE": "立即复制现有的镜像。",
|
||||||
"NEW": "新增",
|
"NEW": "新增",
|
||||||
"NAME_TOOLTIP": "项目名称由小写字符、数字和._-组成且至少2个字符并以字符或者数字开头。",
|
"NAME_TOOLTIP": "项目名称由小写字符、数字和._-组成且至少2个字符并以字符或者数字开头。",
|
||||||
|
Loading…
Reference in New Issue
Block a user