diff --git a/src/components/Panel.tsx b/src/components/Panel.tsx index 3cba27f..08d45cb 100644 --- a/src/components/Panel.tsx +++ b/src/components/Panel.tsx @@ -29,13 +29,26 @@ export function Panel({ options, data, width, height, timeZone, timeRange, onCha const pod = new ChartwerkGaugePod((chartContainer as any).current, series, chartwerkOptions); pod.render(); }); + + const isLinkActive = !_.isEmpty(options.gauge.link); + const chartClickHandler = (event: React.MouseEvent) => { + event.preventDefault(); + console.log('click', options); + if (!isLinkActive) { + return; + } + window.open(options.gauge.link, "_self"); + }; + return (
); } diff --git a/src/module.ts b/src/module.ts index f73279f..0ecec60 100644 --- a/src/module.ts +++ b/src/module.ts @@ -128,5 +128,11 @@ export const plugin = new PanelPlugin(Panel).setPanelOptions((buil }, showIf: (config) => config.visualizationType === Pod.GAUGE, editor: ThresholdsEditor as any, + }) + .addTextInput({ + path: 'gauge.link', + name: '', + category: ['Link'], + showIf: (config) => config.visualizationType === Pod.GAUGE, }); }); diff --git a/src/types.ts b/src/types.ts index a0a2e94..0957663 100644 --- a/src/types.ts +++ b/src/types.ts @@ -6,14 +6,15 @@ export interface PanelOptions { value: ExtremumOptions; valueSize: number; reversed: boolean; - decimals?: number; - unit?: string; thresholds: { arcBackground: string; defaultColor: string; thresholds: Threshold[]; }; icons: Icon[]; + decimals?: number; + unit?: string; + link?: string; }; }