-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
feat: Pass dashboard context to explore through local storage #20743
Changes from all commits
412f184
066e477
7ab049b
645c396
2a08622
63b790f
9369185
7dc2c10
fd105dc
1aa1ed6
c3a721e
d326d64
87cde77
58d2bd0
f3b2027
0ea75cf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,6 +55,8 @@ import { FeatureFlag, isFeatureEnabled } from '../../featureFlags'; | |
import extractUrlParams from '../util/extractUrlParams'; | ||
import getNativeFilterConfig from '../util/filterboxMigrationHelper'; | ||
import { updateColorSchema } from './dashboardInfo'; | ||
import { getChartIdsInFilterScope } from '../util/getChartIdsInFilterScope'; | ||
import updateComponentParentsList from '../util/updateComponentParentsList'; | ||
|
||
export const HYDRATE_DASHBOARD = 'HYDRATE_DASHBOARD'; | ||
|
||
|
@@ -256,6 +258,19 @@ export const hydrateDashboard = | |
layout[layoutId].meta.sliceName = slice.slice_name; | ||
} | ||
}); | ||
|
||
// make sure that parents tree is built | ||
if ( | ||
Object.values(layout).some( | ||
element => element.id !== DASHBOARD_ROOT_ID && !element.parents, | ||
) | ||
) { | ||
updateComponentParentsList({ | ||
currentComponent: layout[DASHBOARD_ROOT_ID], | ||
layout, | ||
}); | ||
} | ||
|
||
buildActiveFilters({ | ||
dashboardFilters, | ||
components: layout, | ||
|
@@ -333,9 +348,21 @@ export const hydrateDashboard = | |
rootPath: [DASHBOARD_ROOT_ID], | ||
excluded: [chartId], // By default it doesn't affects itself | ||
}, | ||
chartsInScope: Array.from(sliceIds), | ||
}, | ||
}; | ||
} | ||
if ( | ||
behaviors.includes(Behavior.INTERACTIVE_CHART) && | ||
!metadata.chart_configuration[chartId].crossFilters?.chartsInScope | ||
) { | ||
metadata.chart_configuration[chartId].crossFilters.chartsInScope = | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Optimization for cross filters (works the same as the one implemented for native filters a few months ago) to speed up finding charts in scope. Also, thanks to that, we don't need to save dashboard layout in local storage |
||
getChartIdsInFilterScope( | ||
metadata.chart_configuration[chartId].crossFilters.scope, | ||
charts, | ||
dashboardLayout.present, | ||
); | ||
} | ||
}); | ||
} | ||
|
||
|
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.
Some sample dashboards don't have
parents
in their layout metadata, which caused e2e tests to failThere 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 we fix the sample dashboards metadata instead of introducing this logic? We can do it in a follow-up if needed.