Skip to content
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

Data explorer: keep filter and sorting when changing mode from raw to raw edit #3658

Merged
merged 2 commits into from
Nov 15, 2024
Merged
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
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
Loading