Skip to content

Commit

Permalink
Data explorer: keep filter and sorting when changing mode from raw to…
Browse files Browse the repository at this point in the history
… raw edit
  • Loading branch information
SteRiccio committed Nov 14, 2024
1 parent ff6b1a6 commit ff89e99
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions common/model/query/query/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,15 @@ const resetNotApplicableProps = (query) => {
return query
}

export const assocMode = (mode) =>
A.pipe(
A.assoc(keys.mode, mode),
assocFilter(defaults[keys.filter]),
assocSort(defaults[keys.sort]),
resetNotApplicableProps
)
export const assocMode = (mode) => (query) => {
const prevMode = getMode(query)
let queryUpdated = A.pipe(A.assoc(keys.mode, mode), resetNotApplicableProps)(query)
if (prevMode == modes.aggregate || mode === modes.aggregate) {
// changing mode from raw to aggregate or vice versa: reset filter and sort
queryUpdated = A.pipe(assocFilter(defaults[keys.filter]), assocSort(defaults[keys.sort]))(queryUpdated)
}
return queryUpdated
}

export const toggleMeasureAggregateFunction =
({ nodeDefUuid, aggregateFn }) =>
Expand Down

0 comments on commit ff89e99

Please sign in to comment.