summaryrefslogtreecommitdiffstats
path: root/cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages-dashboard/package-pagination/package-pagination.component.ts
diff options
context:
space:
mode:
authorAhmed Abbas <ahmad.helmy@orange.com>2019-11-27 15:04:18 +0200
committerAhmed Abbas <ahmad.helmy@orange.com>2019-11-27 15:04:18 +0200
commiteea49075a4a8bb62a5a15ec31adfe52e1f1f3b7a (patch)
treed0c8e90ba9ce30262e72b86873c8fde5ff60605c /cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages-dashboard/package-pagination/package-pagination.component.ts
parent341db21b2ac0a14a1ed2b8bf7930914dda054bfe (diff)
filter packages by tag
rename filter-by-keyword to search-by-packages Issue-ID: CCSDK-1968 Issue-ID: CCSDK-1951 Signed-off-by: Ahmed Abbas <ahmad.helmy@orange.com> Change-Id: I4667f2b9e98ba7e217ba7ab15e5cd8c45bee0c33
Diffstat (limited to 'cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages-dashboard/package-pagination/package-pagination.component.ts')
-rw-r--r--cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages-dashboard/package-pagination/package-pagination.component.ts51
1 files changed, 31 insertions, 20 deletions
diff --git a/cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages-dashboard/package-pagination/package-pagination.component.ts b/cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages-dashboard/package-pagination/package-pagination.component.ts
index 49a88c6c2..49f91316b 100644
--- a/cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages-dashboard/package-pagination/package-pagination.component.ts
+++ b/cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages-dashboard/package-pagination/package-pagination.component.ts
@@ -1,30 +1,41 @@
-import { Component, OnInit, ChangeDetectionStrategy } from '@angular/core';
-import { PackagesStore } from '../../packages.store';
+import {Component, OnInit, ChangeDetectionStrategy} from '@angular/core';
+import {PackagesStore} from '../../packages.store';
+import {map} from 'rxjs/operators';
@Component({
- selector: 'app-package-pagination',
- templateUrl: './package-pagination.component.html',
- styleUrls: ['./package-pagination.component.css'],
+ selector: 'app-package-pagination',
+ templateUrl: './package-pagination.component.html',
+ styleUrls: ['./package-pagination.component.css'],
})
export class PackagePaginationComponent implements OnInit {
- pageNumber = 0;
- totalCount = 4;
- pageSize: number;
+ pageNumber: number;
+ totalCount: number;
+ pageSize: number;
+ previousPage: number;
- constructor(private packagesStore: PackagesStore) {
- this.pageSize = packagesStore.pageSize;
- }
+ constructor(private packagesStore: PackagesStore) {
+ this.pageSize = packagesStore.pageSize;
- ngOnInit() {
- }
+ this.packagesStore.state$
+ .subscribe(state => {
+ this.pageNumber = state.currentPage;
+ this.totalCount = state.totalPackages;
+ });
+ }
+
+ ngOnInit() {
+ }
- public getPageFromService(page) {
- console.log('getPageFromService', page);
- if (isNaN(page)) {
- page = 1;
- console.log('page change to first...', page);
+ public getPageFromService(page) {
+ console.log('getPageFromService', page);
+ if (isNaN(page)) {
+ page = 1;
+ console.log('page change to first...', page);
+ }
+ if (this.previousPage !== page) {
+ this.packagesStore.getPage(page - 1, this.packagesStore.pageSize);
+ this.previousPage = page;
+ }
}
- this.packagesStore.getPagedPackages(page - 1, this.packagesStore.pageSize);
- }
}