Allow pagination update in embedded tables, too

pull/7174/head
Henriette Dinger 6 years ago
parent b20d7d305f
commit 85a1b6e48f
  1. 18
      frontend/src/app/components/wp-table/embedded/wp-embedded-table.component.ts
  2. 3
      frontend/src/app/modules/work_packages/routing/wp-view-base/work-packages-view.base.ts

@ -1,4 +1,4 @@
import {AfterViewInit, Component, EventEmitter, Input, OnDestroy, OnInit, Output} from '@angular/core'; import {AfterViewInit, Component, Input, OnDestroy, OnInit} from '@angular/core';
import {WorkPackageTableTimelineService} from 'core-components/wp-fast-table/state/wp-table-timeline.service'; import {WorkPackageTableTimelineService} from 'core-components/wp-fast-table/state/wp-table-timeline.service';
import {WorkPackageTablePaginationService} from 'core-components/wp-fast-table/state/wp-table-pagination.service'; import {WorkPackageTablePaginationService} from 'core-components/wp-fast-table/state/wp-table-pagination.service';
import {OpTableActionFactory} from 'core-components/wp-table/table-actions/table-action'; import {OpTableActionFactory} from 'core-components/wp-table/table-actions/table-action';
@ -11,7 +11,8 @@ import {OpModalService} from 'core-components/op-modals/op-modal.service';
import {WorkPackageEmbeddedBaseComponent} from "core-components/wp-table/embedded/wp-embedded-base.component"; import {WorkPackageEmbeddedBaseComponent} from "core-components/wp-table/embedded/wp-embedded-base.component";
import {QueryFormResource} from "core-app/modules/hal/resources/query-form-resource"; import {QueryFormResource} from "core-app/modules/hal/resources/query-form-resource";
import {QueryFormDmService} from "core-app/modules/hal/dm-services/query-form-dm.service"; import {QueryFormDmService} from "core-app/modules/hal/dm-services/query-form-dm.service";
import {QueryFilterInstanceResource} from "core-app/modules/hal/resources/query-filter-instance-resource"; import {untilComponentDestroyed} from "ng2-rx-componentdestroyed";
import {withLatestFrom} from "rxjs/internal/operators";
@Component({ @Component({
selector: 'wp-embedded-table', selector: 'wp-embedded-table',
@ -49,6 +50,19 @@ export class WorkPackageEmbeddedTableComponent extends WorkPackageEmbeddedBaseCo
if (this.tableActions) { if (this.tableActions) {
this.tableActionsService.setActions(...this.tableActions); this.tableActionsService.setActions(...this.tableActions);
} }
// Reload results on changes to pagination (Regression #29845)
this.querySpace.ready.fireOnStateChange(
this.wpTablePagination.state,
'Query loaded'
).values$().pipe(
untilComponentDestroyed(this),
withLatestFrom(this.querySpace.query.values$())
).subscribe(([pagination, query]) => {
this.loadingIndicator = this.QueryDm
.loadResults(query, this.wpTablePagination.paginationObject)
.then((results) => this.initializeStates(query, results));
});
} }
public openConfigurationModal(onUpdated:() => void) { public openConfigurationModal(onUpdated:() => void) {

@ -110,8 +110,7 @@ export abstract class WorkPackagesViewBase implements OnInit, OnDestroy {
.values$() .values$()
.pipe( .pipe(
untilComponentDestroyed(this), untilComponentDestroyed(this),
withLatestFrom(this.querySpace.query.values$() withLatestFrom(this.querySpace.query.values$())
)
).subscribe(([pagination, query]) => { ).subscribe(([pagination, query]) => {
if (this.wpListChecksumService.isQueryOutdated(query, pagination)) { if (this.wpListChecksumService.isQueryOutdated(query, pagination)) {
this.wpListChecksumService.update(query, pagination); this.wpListChecksumService.update(query, pagination);

Loading…
Cancel
Save