diff --git a/src/portal/lib/src/create-edit-rule/create-edit-rule.component.html b/src/portal/lib/src/create-edit-rule/create-edit-rule.component.html index 101780dc9..e5df496fb 100644 --- a/src/portal/lib/src/create-edit-rule/create-edit-rule.component.html +++ b/src/portal/lib/src/create-edit-rule/create-edit-rule.component.html @@ -33,7 +33,7 @@
-
@@ -59,7 +59,7 @@
- +
@@ -88,7 +88,7 @@
-
@@ -136,6 +136,12 @@
+
+ + + + +
diff --git a/src/portal/lib/src/create-edit-rule/create-edit-rule.component.spec.ts b/src/portal/lib/src/create-edit-rule/create-edit-rule.component.spec.ts index 1e861ee9c..e9050bd0f 100644 --- a/src/portal/lib/src/create-edit-rule/create-edit-rule.component.spec.ts +++ b/src/portal/lib/src/create-edit-rule/create-edit-rule.component.spec.ts @@ -46,14 +46,15 @@ describe("CreateEditRuleComponent (inline template)", () => { id: 1, name: "sync_01", description: "", - src_registry_id: 2, + src_registry: {id: 2}, src_namespaces: ["name1", "name2"], trigger: { kind: "Manual", schedule_param: {} }, filters: [], - deletion: false + deletion: false, + enabled: true } ]; let mockJobs: ReplicationJobItem[] = [ @@ -157,13 +158,14 @@ describe("CreateEditRuleComponent (inline template)", () => { name: "sync_01", description: "", src_namespaces: ["namespace1", "namespace2"], - src_registry_id: 10, + src_registry: {id: 10 }, trigger: { kind: "Manual", schedule_param: {} }, filters: [], - deletion: false + deletion: false, + enabled: true }; let mockRegistryInfo = { @@ -192,9 +194,9 @@ describe("CreateEditRuleComponent (inline template)", () => { } ], "supported_triggers": [ - "Manual", - "Scheduled", - "EventBased" + "manual", + "scheduled", + "event_based" ] }; diff --git a/src/portal/lib/src/create-edit-rule/create-edit-rule.component.ts b/src/portal/lib/src/create-edit-rule/create-edit-rule.component.ts index e620ce439..5ae452293 100644 --- a/src/portal/lib/src/create-edit-rule/create-edit-rule.component.ts +++ b/src/portal/lib/src/create-edit-rule/create-edit-rule.component.ts @@ -54,7 +54,7 @@ export class CreateEditRuleComponent implements OnInit, OnDestroy { TRIGGER_TYPES = { MANUAL: "manual", SCHEDULED: "scheduled", - EVENT_BASED: "eventBased" + EVENT_BASED: "event_based" }; 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 { if (this.isPushMode) { this.initRegistryInfo(0); @@ -178,7 +182,8 @@ export class CreateEditRuleComponent implements OnInit, OnDestroy { }) }), filters: this.fb.array([]), - deletion: false + deletion: false, + enabled: true }); } @@ -204,7 +209,8 @@ export class CreateEditRuleComponent implements OnInit, OnDestroy { cron: "" } }, - deletion: false + deletion: false, + enabled: true }); this.setFilter([]); this.initRegistryInfo(0); @@ -217,17 +223,17 @@ export class CreateEditRuleComponent implements OnInit, OnDestroy { description: rule.description, src_namespaces: rule.src_namespaces, dest_namespace: rule.dest_namespace, + src_registry: rule.src_registry, + dest_registry: rule.dest_registry, trigger: rule.trigger, - deletion: rule.deletion + deletion: rule.deletion, + enabled: rule.enabled }); this.noSelectedEndpoint = false; - if (rule.filters) { this.setFilter(rule.filters); - this.updateFilter(rule.filters); } - // Force refresh view let hnd = setInterval(() => this.ref.markForCheck(), 100); setTimeout(() => clearInterval(hnd), 2000); @@ -307,9 +313,6 @@ export class CreateEditRuleComponent implements OnInit, OnDestroy { } } - updateFilter(filters: any) { - } - public hasFormChange(): boolean { return !isEmptyObject(this.hasChanges()); } diff --git a/src/portal/lib/src/list-replication-rule/list-replication-rule.component.spec.ts b/src/portal/lib/src/list-replication-rule/list-replication-rule.component.spec.ts index 16f1ecd17..2e82de417 100644 --- a/src/portal/lib/src/list-replication-rule/list-replication-rule.component.spec.ts +++ b/src/portal/lib/src/list-replication-rule/list-replication-rule.component.spec.ts @@ -28,7 +28,8 @@ describe('ListReplicationRuleComponent (inline template)', () => { "error_job_count": 2, "deletion": false, "src_namespaces": ["name1", "name2"], - "src_registry_id": 3 + "src_registry": {id: 3}, + "enabled": true }, { "id": 2, @@ -39,7 +40,8 @@ describe('ListReplicationRuleComponent (inline template)', () => { "error_job_count": 2, "deletion": false, "src_namespaces": ["name1", "name2"], - "dest_registry_id": 3 + "dest_registry": {id: 3}, + "enabled": true }, ]; diff --git a/src/portal/lib/src/replication/replication.component.spec.ts b/src/portal/lib/src/replication/replication.component.spec.ts index babe97453..2ceffb373 100644 --- a/src/portal/lib/src/replication/replication.component.spec.ts +++ b/src/portal/lib/src/replication/replication.component.spec.ts @@ -37,8 +37,9 @@ describe('Replication Component (inline template)', () => { "trigger": {"kind": "Manual", "schedule_param": null}, "error_job_count": 2, "deletion": false, - "src_registry_id": 3, - "src_namespaces": ["name1"] + "src_registry": {id: 3}, + "src_namespaces": ["name1"], + "enabled": true }, { "id": 2, @@ -48,8 +49,9 @@ describe('Replication Component (inline template)', () => { "trigger": {"kind": "Manual", "schedule_param": null}, "error_job_count": 2, "deletion": false, - "dest_registry_id": 5, - "src_namespaces": ["name1"] + "dest_registry": {id: 5}, + "src_namespaces": ["name1"], + "enabled": true } ]; diff --git a/src/portal/lib/src/service/interface.ts b/src/portal/lib/src/service/interface.ts index 42750153e..479c3877e 100644 --- a/src/portal/lib/src/service/interface.ts +++ b/src/portal/lib/src/service/interface.ts @@ -109,10 +109,11 @@ export interface ReplicationRule extends Base { trigger: Trigger; filters: Filter[]; deletion?: boolean; - src_registry_id?: number; - dest_registry_id?: number; + src_registry?: any; + dest_registry?: any; src_namespaces: string []; dest_namespace?: string; + enabled: boolean; } export class Filter { diff --git a/src/portal/src/i18n/lang/en-us-lang.json b/src/portal/src/i18n/lang/en-us-lang.json index 7d41adc1e..54235d79d 100644 --- a/src/portal/src/i18n/lang/en-us-lang.json +++ b/src/portal/src/i18n/lang/en-us-lang.json @@ -431,7 +431,7 @@ "JOB_LOG_VIEWER": "View Replication Job Log", "NO_ENDPOINT_INFO": "Please add an endpoint first", "NO_PROJECT_INFO": "This project is not exist", - "SOURCE_IMAGES_FILTER": "Source images filter", + "SOURCE_RESOURCE_FILTER": "Source resource filter", "SCHEDULED": "Scheduled", "MANUAL": "Manual", "EVENT_BASED":"Event Based", @@ -445,6 +445,7 @@ "SOURCE_PROJECT": "Source project", "REPLICATE": "Replicate", "DELETE_REMOTE_IMAGES": "Delete remote images when locally deleted", + "DELETE_ENABLED": "Enabled this policy", "REPLICATE_IMMEDIATE": "Replicate existing images immediately", "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.", diff --git a/src/portal/src/i18n/lang/es-es-lang.json b/src/portal/src/i18n/lang/es-es-lang.json index a76b7d61f..423d6e524 100644 --- a/src/portal/src/i18n/lang/es-es-lang.json +++ b/src/portal/src/i18n/lang/es-es-lang.json @@ -432,7 +432,7 @@ "JOB_LOG_VIEWER": "View Replication Job Log", "NO_ENDPOINT_INFO": "Please add an endpoint first", "NO_PROJECT_INFO": "This project is not exist", - "SOURCE_IMAGES_FILTER": "Source images filter", + "SOURCE_RESOURCE_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 when locally deleted", + "DELETE_ENABLED": "Enabled this policy", "REPLICATE_IMMEDIATE": "Replicate existing images immediately", "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.", diff --git a/src/portal/src/i18n/lang/fr-fr-lang.json b/src/portal/src/i18n/lang/fr-fr-lang.json index e05f64c16..3bd52ed85 100644 --- a/src/portal/src/i18n/lang/fr-fr-lang.json +++ b/src/portal/src/i18n/lang/fr-fr-lang.json @@ -413,7 +413,7 @@ "JOB_LOG_VIEWER": "Afficher les logs des travaux de réplication", "NO_ENDPOINT_INFO": "Please add an endpoint first", "NO_PROJECT_INFO": "This project is not exist", - "SOURCE_IMAGES_FILTER": "Source images filter", + "SOURCE_RESOURCE_FILTER": "Source resource filter", "SCHEDULED": "Scheduled", "MANUAL": "Manual", "EVENT_BASED":"Event Based", @@ -427,6 +427,7 @@ "SOURCE_PROJECT": "Source project", "REPLICATE": "Replicate", "DELETE_REMOTE_IMAGES": "Delete remote images when locally deleted", + "DELETE_ENABLED": "Enabled this policy", "REPLICATE_IMMEDIATE": "Replicate existing images immediately", "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.", diff --git a/src/portal/src/i18n/lang/pt-br-lang.json b/src/portal/src/i18n/lang/pt-br-lang.json index c7778c900..6e3da9bd7 100644 --- a/src/portal/src/i18n/lang/pt-br-lang.json +++ b/src/portal/src/i18n/lang/pt-br-lang.json @@ -431,7 +431,7 @@ "JOB_LOG_VIEWER": "Ver log da tarefa de replicação", "NO_ENDPOINT_INFO": "Por favor adicione antes um endpoint", "NO_PROJECT_INFO": "Esse projeto não existe", - "SOURCE_IMAGES_FILTER": "Filtro de imagens de origem", + "SOURCE_RESOURCE_FILTER": "Source resource filter", "SCHEDULED": "Agendado", "MANUAL": "Manual", "EVENT_BASED":"Event Based", @@ -445,6 +445,7 @@ "SOURCE_PROJECT": "Projeto de origem", "REPLICATE": "Replicar", "DELETE_REMOTE_IMAGES":"Remover imagens remotas quando removido localmente", + "DELETE_ENABLED": "Enabled this policy", "REPLICATE_IMMEDIATE":"Replicar imagens existentes imediatamente", "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.", diff --git a/src/portal/src/i18n/lang/zh-cn-lang.json b/src/portal/src/i18n/lang/zh-cn-lang.json index a013c2c7a..74724bdab 100644 --- a/src/portal/src/i18n/lang/zh-cn-lang.json +++ b/src/portal/src/i18n/lang/zh-cn-lang.json @@ -432,7 +432,7 @@ "JOB_LOG_VIEWER": "查看复制任务日志", "NO_ENDPOINT_INFO": "请先添加一个目标", "NO_PROJECT_INFO": "此项目不存在", - "SOURCE_IMAGES_FILTER": "源镜像过滤器", + "SOURCE_RESOURCE_FILTER": "源资源过滤器", "SCHEDULED": "定时", "MANUAL": "手动", "EVENT_BASED":"事件驱动", @@ -446,6 +446,7 @@ "SOURCE_PROJECT": "源项目", "REPLICATE": "复制", "DELETE_REMOTE_IMAGES": "删除本地镜像时同时也删除远程的镜像。", + "DELETE_ENABLED": "默认启用该规则", "REPLICATE_IMMEDIATE": "立即复制现有的镜像。", "NEW": "新增", "NAME_TOOLTIP": "项目名称由小写字符、数字和._-组成且至少2个字符并以字符或者数字开头。",