mirror of
https://github.com/Gimanh/taskview-community.git
synced 2026-09-11 13:29:17 +00:00
fix: handle drill-down correctly
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user