-
Notifications
You must be signed in to change notification settings - Fork 21
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
FIX: Feature-[DEV-10046] : Dashboard Filters - Parent #1820
base: dev
Are you sure you want to change the base?
Conversation
@Atash3000 - It looks like there are failing unit tests on this PR. |
@adamdoe updated unit test. Should be good now. |
import _ from 'lodash' | ||
|
||
export const updateChildFilters = (newSharedFilters: SharedFilter[], data: Record<string, any>): SharedFilter[] => { | ||
const dateSet = Object.values(data).flat() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spelling
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed!
|
||
if (parentFilter) { | ||
// Filter dataset based on parent's active value | ||
const parentActiveValuesArr = dateSet.filter( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spelling
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed!
@Atash3000 The parent filter selector should be a multi select. |
import { SharedFilter } from '../types/SharedFilter' | ||
import _ from 'lodash' | ||
|
||
export const updateChildFilters = (newSharedFilters: SharedFilter[], data: Record<string, any>): SharedFilter[] => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add logic to this function to only run if the filter is a data filter? api filters handle parent relationships differently
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added logic to filter out all data filters
} | ||
}) | ||
|
||
return [...updatedFilters, ...urlFilters] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't this reorder sharedFilter indexes? They should stay in the same place as the dashboardFilter visualizations are referencing those indexes.
[Replace With Ticket Number]
Testing Steps
Set Up Filters in the Dashboard:
Create at least two filters with "Data" as the filter type.
Configure one as a Parent Filter and the other as a Child Filter (link the child to the parent using the Parents field).
Test Parent-Child Logic:
Select a value in the Parent Filter (e.g., Electronics).
Verify that the Child Filter updates to display only values related to the selected parent value (e.g., Sony, Samsung).
Self Review
Screenshots (if applicable)
Additional Notes