Merge pull request #7210 from opf/fix/29910/remember-collapsed-state

Remember collapsed state
pull/7214/head
Henriette Dinger 6 years ago committed by GitHub
commit 9e22e56adb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      frontend/src/app/components/wp-fast-table/handlers/state/hierarchy-transformer.ts
  2. 11
      frontend/src/app/components/wp-fast-table/state/wp-table-hierarchy.service.ts

@ -1,6 +1,6 @@
import {Injector} from '@angular/core';
import {scrollTableRowIntoView} from 'core-components/wp-fast-table/helpers/wp-table-row-helpers';
import {distinctUntilChanged, map, takeUntil} from 'rxjs/operators';
import {distinctUntilChanged, filter, map, takeUntil, withLatestFrom} from 'rxjs/operators';
import {IsolatedQuerySpace} from "core-app/modules/work_packages/query-space/isolated-query-space";
import {WorkPackageTableHierarchiesService} from "core-components/wp-fast-table/state/wp-table-hierarchy.service";
import {WorkPackageTable} from "core-components/wp-fast-table/wp-fast-table";
@ -37,6 +37,9 @@ export class HierarchyTransformer {
this.wpTableHierarchies
.observeUntil(this.querySpace.stopAllSubscriptions)
.pipe(
filter(() => this.querySpace.rendered.hasValue())
)
.subscribe((state:WorkPackageTableHierarchies) => {
if (state.isVisible === lastValue) {
@ -62,7 +65,6 @@ export class HierarchyTransformer {
// (e.g., by a collapsed parent)
const collapsed:{ [index:number]:boolean } = {};
// Hide all collapsed hierarchies
_.each(state.collapsed, (isCollapsed:boolean, wpId:string) => {
// Toggle the root style

@ -20,7 +20,16 @@ export class WorkPackageTableHierarchiesService extends WorkPackageQueryStateSer
}
public valueFromQuery(query:QueryResource):WorkPackageTableHierarchies {
return new WorkPackageTableHierarchies(query.showHierarchies);
const value = new WorkPackageTableHierarchies(query.showHierarchies);
const current = this.current;
// Take over current collapsed values
// which are not yet saved
if (current) {
value.collapsed = current.collapsed;
}
return value;
}
public hasChanged(query:QueryResource) {

Loading…
Cancel
Save