mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Explore: Decouple SplitOpen and getFieldLinksForExplore from Panel visualizations (#71811)
* Allow overriding internal data link supplier * Remove SplitOpen and getFieldLinksForExplore dependencies * Fix checking if row index is provided * Fix unit test * Add a comment * Mark SplitOpen as deprecated * Use Panel Context to provide internal data link supplier * Update packages/grafana-ui/src/components/PanelChrome/PanelContext.ts Co-authored-by: Haris Rozajac <58232930+harisrozajac@users.noreply.github.com> * Update packages/grafana-data/src/utils/dataLinks.ts Co-authored-by: Haris Rozajac <58232930+harisrozajac@users.noreply.github.com> * Add missing eventsScope * Fix infinite render loops * Rename internal data link supplier to data link post processor * Update packages/grafana-data/src/field/fieldOverrides.ts Co-authored-by: Torkel Ödegaard <torkel@grafana.com> --------- Co-authored-by: Haris Rozajac <58232930+harisrozajac@users.noreply.github.com> Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
This commit is contained in:
@@ -10,7 +10,7 @@ import {
|
||||
useFieldOverrides,
|
||||
} from '@grafana/data';
|
||||
import { getTemplateSrv, PanelRendererProps } from '@grafana/runtime';
|
||||
import { ErrorBoundaryAlert, useTheme2 } from '@grafana/ui';
|
||||
import { ErrorBoundaryAlert, usePanelContext, useTheme2 } from '@grafana/ui';
|
||||
import { appEvents } from 'app/core/core';
|
||||
|
||||
import { importPanelPlugin, syncGetPanelPlugin } from '../../plugins/importPanelPlugin';
|
||||
@@ -38,7 +38,16 @@ export function PanelRenderer<P extends object = any, F extends object = any>(pr
|
||||
const [plugin, setPlugin] = useState(syncGetPanelPlugin(pluginId));
|
||||
const [error, setError] = useState<string | undefined>();
|
||||
const optionsWithDefaults = useOptionDefaults(plugin, options, fieldConfig);
|
||||
const dataWithOverrides = useFieldOverrides(plugin, optionsWithDefaults?.fieldConfig, data, timeZone, theme, replace);
|
||||
const { dataLinkPostProcessor } = usePanelContext();
|
||||
const dataWithOverrides = useFieldOverrides(
|
||||
plugin,
|
||||
optionsWithDefaults?.fieldConfig,
|
||||
data,
|
||||
timeZone,
|
||||
theme,
|
||||
replace,
|
||||
dataLinkPostProcessor
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
// If we already have a plugin and it's correct one do nothing
|
||||
|
||||
Reference in New Issue
Block a user