mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
DashboardScene: Panel edit search crash fix (#82449)
* DashboardScene: Panel edit search crash fix * Fix issue with removing data links
This commit is contained in:
parent
8832971aff
commit
b7b83ded71
@ -3,6 +3,7 @@ import React from 'react';
|
||||
import { config } from '@grafana/runtime';
|
||||
import { VizPanel } from '@grafana/scenes';
|
||||
import { DataLinksInlineEditor, Input, RadioButtonGroup, Select, Switch, TextArea } from '@grafana/ui';
|
||||
import { VizPanelLinks } from 'app/features/dashboard-scene/scene/PanelLinks';
|
||||
import { dashboardSceneGraph } from 'app/features/dashboard-scene/utils/dashboardSceneGraph';
|
||||
import { getPanelLinksVariableSuggestions } from 'app/features/panel/panellinks/link_srv';
|
||||
|
||||
@ -248,17 +249,7 @@ export function getPanelFrameCategory2(panel: VizPanel): OptionsPaneCategoryDesc
|
||||
}).addItem(
|
||||
new OptionsPaneItemDescriptor({
|
||||
title: 'Panel links',
|
||||
render: function renderLinks() {
|
||||
const { rawLinks: links } = panelLinksObject.useState();
|
||||
return (
|
||||
<DataLinksInlineEditor
|
||||
links={links}
|
||||
onChange={(links) => panelLinksObject.setState({ rawLinks: links })}
|
||||
getSuggestions={getPanelLinksVariableSuggestions}
|
||||
data={[]}
|
||||
/>
|
||||
);
|
||||
},
|
||||
render: () => <ScenePanelLinksEditor panelLinks={panelLinksObject} />,
|
||||
})
|
||||
)
|
||||
);
|
||||
@ -325,3 +316,20 @@ export function getPanelFrameCategory2(panel: VizPanel): OptionsPaneCategoryDesc
|
||||
// )
|
||||
// );
|
||||
}
|
||||
|
||||
interface ScenePanelLinksEditorProps {
|
||||
panelLinks: VizPanelLinks;
|
||||
}
|
||||
|
||||
function ScenePanelLinksEditor({ panelLinks }: ScenePanelLinksEditorProps) {
|
||||
const { rawLinks: links } = panelLinks.useState();
|
||||
|
||||
return (
|
||||
<DataLinksInlineEditor
|
||||
links={links}
|
||||
onChange={(links) => panelLinks.setState({ rawLinks: links })}
|
||||
getSuggestions={getPanelLinksVariableSuggestions}
|
||||
data={[]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
@ -229,7 +229,8 @@ export function getVisualizationOptions2(props: OptionPaneRenderProps2): Options
|
||||
render: function renderEditor() {
|
||||
const onChange = (v: unknown) => {
|
||||
panel.onFieldConfigChange(
|
||||
updateDefaultFieldConfigValue(currentFieldConfig, fieldOption.path, v, fieldOption.isCustom)
|
||||
updateDefaultFieldConfigValue(currentFieldConfig, fieldOption.path, v, fieldOption.isCustom),
|
||||
true
|
||||
);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user