Handle graph/table tab selection via Redux state

Signed-off-by: Julius Volz <julius.volz@gmail.com>
This commit is contained in:
Julius Volz 2024-07-22 16:31:18 +02:00
parent 0049e8baff
commit e87214a6bd

View file

@ -98,7 +98,21 @@ const QueryPanel: FC<PanelProps> = ({ idx, metricNames }) => {
dispatch(removePanel(idx));
}}
/>
<Tabs defaultValue="table" keepMounted={false}>
<Tabs
value={panel.visualizer.activeTab}
onChange={(v) =>
dispatch(
setVisualizer({
idx,
visualizer: {
...panel.visualizer,
activeTab: v as "table" | "graph",
},
})
)
}
keepMounted={false}
>
<Tabs.List>
<Tabs.Tab value="table" leftSection={<IconTable style={iconStyle} />}>
Table