Enforce mutual exclusiveness of hierarchies and sort by

pull/6648/head
Wieland Lindenthal 6 years ago
parent 09def68fbd
commit 0dcf5275f8
  1. 7
      frontend/src/app/components/wp-fast-table/state/wp-table-hierarchy.service.ts
  2. 8
      frontend/src/app/components/wp-fast-table/state/wp-table-sort-by.service.ts

@ -42,11 +42,16 @@ export class WorkPackageTableHierarchiesService extends WorkPackageTableBaseServ
state.current = active;
state.last = null;
// hierarchies and group by are mutually exclusive
if (active) {
// hierarchies and group by are mutually exclusive
var groupBy = this.tableState.groupBy.value!;
groupBy.current = undefined;
this.tableState.groupBy.putValue(groupBy);
// hierarchies and sort by are mutually exclusive
var sortBy = this.tableState.sortBy.value!;
sortBy.current = [];
this.tableState.sortBy.putValue(sortBy);
}
this.state.putValue(state);

@ -77,6 +77,14 @@ export class WorkPackageTableSortByService extends WorkPackageTableBaseService<W
}
public applyToQuery(query:QueryResource) {
if (this.current.current.length > 0) {
// hierarchies and sort by are mutually exclusive
var hierarchies = this.tableState.hierarchies.value!;
hierarchies.current = false;
hierarchies.last = null;
this.tableState.hierarchies.putValue(hierarchies);
query.hierarchies = hierarchies.current;
}
query.sortBy = cloneHalResourceCollection<QuerySortByResource>(this.current.current);
return true;
}

Loading…
Cancel
Save