mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
DashboardScene: Allow editing panel links (#81560)
* Panel links supplier for VizPanel * Update panel links behavior * Allow editing panel links * Update so that single link is rendered without a dropdown * Serialise links in scene -> save model transformation * Betterer fix * Fix inspect json tab test
This commit is contained in:
@@ -11,7 +11,9 @@ import {
|
||||
ScopedVar,
|
||||
ScopedVars,
|
||||
} from '@grafana/data';
|
||||
import { VizPanel } from '@grafana/scenes';
|
||||
import { PanelModel } from 'app/features/dashboard/state/PanelModel';
|
||||
import { dashboardSceneGraph } from 'app/features/dashboard-scene/utils/dashboardSceneGraph';
|
||||
|
||||
import { getLinkSrv } from './link_srv';
|
||||
|
||||
@@ -157,3 +159,22 @@ export const getPanelLinksSupplier = (
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export const getScenePanelLinksSupplier = (
|
||||
panel: VizPanel,
|
||||
replaceVariables: InterpolateFunction
|
||||
): LinkModelSupplier<VizPanel> | undefined => {
|
||||
const links = dashboardSceneGraph.getPanelLinks(panel).state.rawLinks;
|
||||
|
||||
if (!links || links.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return {
|
||||
getLinks: () => {
|
||||
return links.map((link) => {
|
||||
return getLinkSrv().getDataLinkUIModel(link, replaceVariables, panel);
|
||||
});
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user