fix: handle drill-down correctly

This commit is contained in:
Nikolai Giman
2026-04-27 01:06:22 +02:00
parent 95f024275c
commit 344526b1b2
2 changed files with 12 additions and 3 deletions
@@ -23,6 +23,5 @@ export default class AnalyticsRoutes implements Routable {
const guards = [IsLoggedIn, RejectApiTokenAuth, CanAccessAnalytics]
this.router.get('/sections', guards, this.controller.fetchSections)
this.router.get('/drilldown/:sectionId', guards, this.controller.fetchDrillDown)
this.router.get('/drill-down/:sectionId', guards, this.controller.fetchDrillDown)
}
}
@@ -61,9 +61,19 @@ function render() {
if (props.section.payload.kind !== 'series') return
const config: ChartConfiguration = build(props.section, currentChartType.value)
const isDrillable = !!props.section.drillDown
config.options = {
...(config.options ?? {}),
onClick: (_evt, elements, chart) => {
onHover: (event, elements) => {
const target = event.native?.target as HTMLElement | undefined
if (!target) return
target.style.cursor = isDrillable && elements.length ? 'pointer' : 'default'
},
}
if (isDrillable) {
config.options.onClick = (_evt, elements, chart) => {
if (!elements.length) return
const el = elements[0]
const datasetIndex = el.datasetIndex
@@ -78,7 +88,7 @@ function render() {
index,
meta: sectionDs?.meta,
})
},
}
}
if (instance) {