From f0b241c69570d4d59110d195e5f9372436553c0b Mon Sep 17 00:00:00 2001 From: Will Sun <30999793+AllForNothing@users.noreply.github.com> Date: Wed, 17 Mar 2021 14:32:45 +0800 Subject: [PATCH] Add pagination to replication rules searching (#14464) Signed-off-by: AllForNothing --- .../list-replication-rule.component.html | 18 +++++++++--------- .../list-replication-rule.component.ts | 6 +++--- .../replication/replication.component.html | 1 + .../replication/replication.component.ts | 5 +++-- .../new-user-form/new-user-form.component.html | 2 +- 5 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/portal/src/app/base/left-side-nav/replication/replication/list-replication-rule/list-replication-rule.component.html b/src/portal/src/app/base/left-side-nav/replication/replication/list-replication-rule/list-replication-rule.component.html index 0e3798a63..f3b117af5 100644 --- a/src/portal/src/app/base/left-side-nav/replication/replication/list-replication-rule/list-replication-rule.component.html +++ b/src/portal/src/app/base/left-side-nav/replication/replication/list-replication-rule/list-replication-rule.component.html @@ -53,13 +53,13 @@ {{p.name}}
- - Disabled - - {{'REPLICATION.RULE_DISABLED' | translate}} - - -
Enabled
+ + Disabled + + {{'REPLICATION.RULE_DISABLED' | translate}} + + +
Enabled
@@ -73,8 +73,8 @@ - - {{p.src_registry && p.src_registry.id > 0 ? 'pull-based' : 'push-based'}} + + {{p.src_registry && p.src_registry.id > 0 ? 'pull-based' : 'push-based'}} {{p.dest_registry ? p.dest_registry.name : ''}} : {{p.dest_namespace? p.dest_namespace: '-'}} diff --git a/src/portal/src/app/base/left-side-nav/replication/replication/list-replication-rule/list-replication-rule.component.ts b/src/portal/src/app/base/left-side-nav/replication/replication/list-replication-rule/list-replication-rule.component.ts index c89ceb026..a801538e5 100644 --- a/src/portal/src/app/base/left-side-nav/replication/replication/list-replication-rule/list-replication-rule.component.ts +++ b/src/portal/src/app/base/left-side-nav/replication/replication/list-replication-rule/list-replication-rule.component.ts @@ -52,6 +52,7 @@ export class ListReplicationRuleComponent { @Input() hasUpdateReplicationPermission: boolean; @Input() hasDeleteReplicationPermission: boolean; @Input() hasExecuteReplicationPermission: boolean; + @Input() searchString: string; @Output() selectOne = new EventEmitter(); @Output() editOne = new EventEmitter(); @Output() toggleOne = new EventEmitter(); @@ -68,7 +69,6 @@ export class ListReplicationRuleComponent { page: number = 1; pageSize: number = 5; totalCount: number = 0; - ruleName: string = ""; loading: boolean = true; constructor(private replicationService: ReplicationService, @@ -232,7 +232,7 @@ export class ListReplicationRuleComponent { } this.loading = true; this.replicationService.getReplicationRulesResponse( - this.ruleName, + this.searchString, this.page, this.pageSize) .pipe(finalize(() => this.loading = false)) @@ -255,7 +255,7 @@ export class ListReplicationRuleComponent { this.page = 1; this.totalCount = 0; this.selectedRow = null; - this.ruleName = ""; + this.searchString = null; this.clrLoad(); } isHelmHub(srcRegistry: any): boolean { diff --git a/src/portal/src/app/base/left-side-nav/replication/replication/replication.component.html b/src/portal/src/app/base/left-side-nav/replication/replication/replication.component.html index 87b43def1..6230c525d 100644 --- a/src/portal/src/app/base/left-side-nav/replication/replication/replication.component.html +++ b/src/portal/src/app/base/left-side-nav/replication/replication/replication.component.html @@ -17,6 +17,7 @@ [hasUpdateReplicationPermission]="hasUpdateReplicationPermission" [hasDeleteReplicationPermission]="hasDeleteReplicationPermission" [hasExecuteReplicationPermission]="hasExecuteReplicationPermission" + [searchString]="filterComponent?.currentValue" >
diff --git a/src/portal/src/app/base/left-side-nav/replication/replication/replication.component.ts b/src/portal/src/app/base/left-side-nav/replication/replication/replication.component.ts index 0240e5a4c..56cb9ef78 100644 --- a/src/portal/src/app/base/left-side-nav/replication/replication/replication.component.ts +++ b/src/portal/src/app/base/left-side-nav/replication/replication/replication.component.ts @@ -168,7 +168,8 @@ export class ReplicationComponent implements OnInit, OnDestroy { switchMap( ruleName => { this.listReplicationRule.loading = true; this.listReplicationRule.page = 1; - return this.replicationService.getReplicationRulesResponse(ruleName); + return this.replicationService + .getReplicationRulesResponse(ruleName, this.listReplicationRule.page, this.listReplicationRule.pageSize); }) ).subscribe(response => { this.hideJobs(); @@ -176,7 +177,7 @@ export class ReplicationComponent implements OnInit, OnDestroy { if (response.headers) { let xHeader: string = response.headers.get("x-total-count"); if (xHeader) { - this.totalCount = parseInt(xHeader, 0); + this.listReplicationRule.totalCount = parseInt(xHeader, 0); } } this.listReplicationRule.selectedRow = null; // Clear selection diff --git a/src/portal/src/app/shared/components/new-user-form/new-user-form.component.html b/src/portal/src/app/shared/components/new-user-form/new-user-form.component.html index d317188f9..6b2f214cb 100644 --- a/src/portal/src/app/shared/components/new-user-form/new-user-form.component.html +++ b/src/portal/src/app/shared/components/new-user-form/new-user-form.component.html @@ -59,7 +59,7 @@ - {{'TOOLTIP.COMMENT' | translate}}