From f7f5298ba201665a6529bdcb56ba9ddaacd9f318 Mon Sep 17 00:00:00 2001 From: FangyuanCheng Date: Thu, 18 Apr 2019 13:34:58 +0800 Subject: [PATCH] Fix replication ui relate issues Signed-off-by: FangyuanCheng --- .../create-edit-rule/create-edit-rule.component.html | 9 ++++++--- .../create-edit-rule/create-edit-rule.component.scss | 4 +--- .../create-edit-rule.component.spec.ts | 8 ++++---- .../src/create-edit-rule/create-edit-rule.component.ts | 2 ++ src/portal/lib/src/endpoint/endpoint.component.ts | 2 +- .../list-replication-rule.component.spec.ts | 4 ++-- .../lib/src/replication/replication.component.spec.ts | 4 ++-- src/portal/lib/src/service/interface.ts | 10 +++++----- 8 files changed, 23 insertions(+), 20 deletions(-) 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 be2b94adf..e6133f334 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 @@ -21,10 +21,12 @@
-
- +
+ - +
+
+
@@ -57,6 +59,7 @@
diff --git a/src/portal/lib/src/create-edit-rule/create-edit-rule.component.scss b/src/portal/lib/src/create-edit-rule/create-edit-rule.component.scss index 67ed6c93a..f2ee47132 100644 --- a/src/portal/lib/src/create-edit-rule/create-edit-rule.component.scss +++ b/src/portal/lib/src/create-edit-rule/create-edit-rule.component.scss @@ -245,6 +245,4 @@ clr-modal { .form-cron { padding-left:3.8rem; } -.mode-base { - z-index: -1; -} + 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 e95a10331..bbf887759 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 @@ -49,8 +49,8 @@ describe("CreateEditRuleComponent (inline template)", () => { src_registry: {id: 2}, src_namespaces: ["name1", "name2"], trigger: { - kind: "Manual", - schedule_param: {} + type: "Manual", + trigger_settings: {} }, filters: [], deletion: false, @@ -162,8 +162,8 @@ describe("CreateEditRuleComponent (inline template)", () => { src_registry: {id: 10 }, dest_registry: {id: 0 }, trigger: { - kind: "Manual", - schedule_param: {} + type: "Manual", + trigger_settings: {} }, filters: [], deletion: false, 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 d81b3b457..ee6550a13 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 @@ -221,6 +221,8 @@ export class CreateEditRuleComponent implements OnInit, OnDestroy { this.isPushMode = true; } setTimeout(() => { + // There is no trigger_setting type when the harbor is upgraded from the old version. + rule.trigger.trigger_settings = rule.trigger.trigger_settings ? rule.trigger.trigger_settings : {cron: ''}; this.ruleForm.reset({ name: rule.name, description: rule.description, diff --git a/src/portal/lib/src/endpoint/endpoint.component.ts b/src/portal/lib/src/endpoint/endpoint.component.ts index f1630559c..44edf5d44 100644 --- a/src/portal/lib/src/endpoint/endpoint.component.ts +++ b/src/portal/lib/src/endpoint/endpoint.component.ts @@ -94,7 +94,6 @@ export class EndpointComponent implements OnInit, OnDestroy { private translateService: TranslateService, private operationService: OperationService, private ref: ChangeDetectorRef) { - this.forceRefreshView(1000); } ngOnInit(): void { @@ -119,6 +118,7 @@ export class EndpointComponent implements OnInit, OnDestroy { .subscribe(targets => { this.targets = targets || []; this.loading = false; + this.forceRefreshView(1000); }, error => { this.errorHandler.error(error); this.loading = false; 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 d8d627fef..221b38de6 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 @@ -24,7 +24,7 @@ describe('ListReplicationRuleComponent (inline template)', () => { "name": "sync_01", "description": "", "filters": null, - "trigger": {"kind": "Manual", "schedule_param": null}, + "trigger": {"type": "Manual", "trigger_settings": null}, "error_job_count": 2, "deletion": false, "src_namespaces": ["name1", "name2"], @@ -37,7 +37,7 @@ describe('ListReplicationRuleComponent (inline template)', () => { "name": "sync_02", "description": "", "filters": null, - "trigger": {"kind": "Manual", "schedule_param": null}, + "trigger": {"type": "Manual", "trigger_settings": null}, "error_job_count": 2, "deletion": false, "src_namespaces": ["name1", "name2"], diff --git a/src/portal/lib/src/replication/replication.component.spec.ts b/src/portal/lib/src/replication/replication.component.spec.ts index 1c162cd91..7c0f1900a 100644 --- a/src/portal/lib/src/replication/replication.component.spec.ts +++ b/src/portal/lib/src/replication/replication.component.spec.ts @@ -34,7 +34,7 @@ describe('Replication Component (inline template)', () => { "name": "sync_01", "description": "", "filters": null, - "trigger": {"kind": "Manual", "schedule_param": null}, + "trigger": {"type": "Manual", "trigger_settings": null}, "error_job_count": 2, "deletion": false, "src_registry": {id: 3}, @@ -47,7 +47,7 @@ describe('Replication Component (inline template)', () => { "name": "sync_02", "description": "", "filters": null, - "trigger": {"kind": "Manual", "schedule_param": null}, + "trigger": {"type": "Manual", "trigger_settings": null}, "error_job_count": 2, "deletion": false, "dest_registry": {id: 5}, diff --git a/src/portal/lib/src/service/interface.ts b/src/portal/lib/src/service/interface.ts index 8d1573812..f3f07ac56 100644 --- a/src/portal/lib/src/service/interface.ts +++ b/src/portal/lib/src/service/interface.ts @@ -126,15 +126,15 @@ export class Filter { } export class Trigger { - kind: string; - schedule_param: + type: string; + trigger_settings: | any | { [key: string]: any | any[]; }; - constructor(kind: string, param: any | { [key: string]: any | any[] }) { - this.kind = kind; - this.schedule_param = param; + constructor(type: string, param: any | { [key: string]: any | any[] }) { + this.type = type; + this.trigger_settings = param; } }