Skip to content

[NAE-2122] Implement Structured and Efficient Pagination in gRPC #288

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: release/7.0.0-rev4
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ export abstract class AbstractTaskListPaginationComponent extends AbstractDefaul
@Input() public disabled: boolean;
@Input()
set tasks$(tasks: Observable<Array<TaskPanelData>>) {
this._taskViewService.paginationView = true;
this._taskViewService.nextPagePagination(this.pageSize, this.pageIndex);
this._tasks$ = tasks.pipe((tap(() => {
this.length = this._taskViewService.pagination.totalElements;
this.pageIndex = this._taskViewService.pagination.number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ export abstract class AbstractCaseListPaginatorComponent extends AbstractDefault
@Optional() @Inject(NAE_TAB_DATA) injectedTabData: InjectedTabData,
protected route?: ActivatedRoute) {
super(_caseViewService, _log, injectedTabData, route);
this._caseViewService.nextPagePagination(this.pageSize, this.pageIndex);
this._caseViewService.paginationView = true;
this._caseViewService.nextPagePagination(this.pageSize, this.pageIndex);
this.cases$ = this._caseViewService.cases$.pipe(tap(() => {
this.length = this._caseViewService.pagination.totalElements;
this.pageIndex = this._caseViewService.pagination.number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export class TaskViewService extends AbstractSortableViewComponent implements On
protected _allowMultiOpen: boolean;

private readonly _initializing: boolean = true;
protected _paginationView: boolean = false;

constructor(protected _taskService: TaskResourceService,
private _userService: UserService,
Expand Down Expand Up @@ -127,6 +128,9 @@ export class TaskViewService extends AbstractSortableViewComponent implements On
if (pageLoadResult.requestContext !== null) {
this._loading$.off(pageLoadResult.requestContext.filter);
}
if (this._paginationView) {
return pageLoadResult.tasks;
}
return result;
}, {})
);
Expand Down Expand Up @@ -202,6 +206,10 @@ export class TaskViewService extends AbstractSortableViewComponent implements On
return this._allowMultiOpen;
}

public set paginationView(value: boolean) {
this._paginationView = value;
}

public loadPage(requestContext: PageLoadRequestContext): Observable<TaskPageLoadRequestResult> {
if (requestContext === null || requestContext.pageNumber < 0) {
return of({tasks: {}, requestContext});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
<div class="fix-padding">
<nc-task-panel #panel
[textEllipsis]="textEllipsis"
*ngFor="let task of tasks | slice: (pageIndex) * pageSize : (pageIndex + 1) * pageSize;
let i = index;
*ngFor="let task of tasks;
let first = first;
let last = last;
trackBy: trackBy"
Expand Down
Loading