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:
Dominik Prokop
2024-01-31 03:30:27 -08:00
committed by GitHub
parent ab891d92fb
commit f20053e4b6
13 changed files with 208 additions and 61 deletions

View File

@@ -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);
});
},
};
};