diff --git a/npm/ng-packs/packages/core/src/lib/services/list.service.ts b/npm/ng-packs/packages/core/src/lib/services/list.service.ts index 3025b91682..76dac87b5a 100644 --- a/npm/ng-packs/packages/core/src/lib/services/list.service.ts +++ b/npm/ng-packs/packages/core/src/lib/services/list.service.ts @@ -52,6 +52,17 @@ export class ListService implements return this._page; } + private _totalCount = 0 + set totalCount(value: number) { + if (value === this._totalCount) return; + + this._totalCount = value; + this.get(); + } + get totalCount(): number { + return this._totalCount; + } + private _sortKey = ''; set sortKey(value: string) { this._sortKey = value; @@ -121,12 +132,18 @@ export class ListService implements } private resetPageWhenUnchanged() { + const maxPage = Number(Number(this.totalCount / this._maxResultCount).toFixed()); const skipCount = this._page * this._maxResultCount; - if (skipCount === this._skipCount) { - this._page = 0; - this._skipCount = 0; - } else this._skipCount = skipCount; + if (skipCount !== this._totalCount) { + this._skipCount = skipCount; + return; + } + + if (this.page === maxPage && this.page > 0) { + this._skipCount = skipCount - this._maxResultCount; + this.page = this.page - 1; + } } private next() { diff --git a/npm/ng-packs/packages/identity/proxy/src/lib/proxy/identity/identity-user.service.ts b/npm/ng-packs/packages/identity/proxy/src/lib/proxy/identity/identity-user.service.ts index 1d36c7a2e7..c3b6f203f2 100644 --- a/npm/ng-packs/packages/identity/proxy/src/lib/proxy/identity/identity-user.service.ts +++ b/npm/ng-packs/packages/identity/proxy/src/lib/proxy/identity/identity-user.service.ts @@ -52,13 +52,15 @@ export class IdentityUserService { }, { apiName: this.apiName }); - getList = (input: GetIdentityUsersInput) => + getList = (input: GetIdentityUsersInput) => this.restService.request>({ method: 'GET', url: '/api/identity/users', params: { filter: input.filter, sorting: input.sorting, skipCount: input.skipCount, maxResultCount: input.maxResultCount }, }, { apiName: this.apiName }); + + getRoles = (id: string) => this.restService.request>({ diff --git a/npm/ng-packs/packages/theme-shared/extensions/src/lib/components/extensible-table/extensible-table.component.ts b/npm/ng-packs/packages/theme-shared/extensions/src/lib/components/extensible-table/extensible-table.component.ts index 21dec03838..aa264385be 100644 --- a/npm/ng-packs/packages/theme-shared/extensions/src/lib/components/extensible-table/extensible-table.component.ts +++ b/npm/ng-packs/packages/theme-shared/extensions/src/lib/components/extensible-table/extensible-table.component.ts @@ -150,6 +150,10 @@ export class ExtensibleTableComponent implements OnChanges { ngOnChanges({ data }: SimpleChanges) { if (!data?.currentValue) return; + + if (data.currentValue.length < 1) { + this.list.totalCount = this.recordsTotal + } this.data = data.currentValue.map((record: any, index: number) => { this.propList.forEach(prop => {