mirror of
https://github.com/grafana/grafana.git
synced 2024-11-22 00:47:38 -06:00
Canvas: Add ability to edit selected connections in the inline editor (#83625)
This commit is contained in:
parent
859ecf2a34
commit
5d7a979199
@ -18,6 +18,7 @@ import { activePanelSubject, InstanceState } from '../../CanvasPanel';
|
||||
import { addStandardCanvasEditorOptions } from '../../module';
|
||||
import { InlineEditTabs } from '../../types';
|
||||
import { getElementTypes, onAddItem } from '../../utils';
|
||||
import { getConnectionEditor } from '../connectionEditor';
|
||||
import { getElementEditor } from '../element/elementEditor';
|
||||
import { getLayerEditor } from '../layer/layerEditor';
|
||||
|
||||
@ -42,6 +43,17 @@ export function InlineEditBody() {
|
||||
builder.addNestedOptions(getLayerEditor(instanceState));
|
||||
}
|
||||
|
||||
const selectedConnection = state.selectedConnection;
|
||||
if (selectedConnection && activeTab === InlineEditTabs.SelectedElement) {
|
||||
builder.addNestedOptions(
|
||||
getConnectionEditor({
|
||||
category: [`Selected connection`],
|
||||
connection: selectedConnection,
|
||||
scene: state.scene,
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
const selection = state.selected;
|
||||
if (selection?.length === 1 && activeTab === InlineEditTabs.SelectedElement) {
|
||||
const element = selection[0];
|
||||
@ -82,7 +94,10 @@ export function InlineEditBody() {
|
||||
const rootLayer: FrameState | undefined = instanceState?.layer;
|
||||
|
||||
const noElementSelected =
|
||||
instanceState && activeTab === InlineEditTabs.SelectedElement && instanceState.selected.length === 0;
|
||||
instanceState &&
|
||||
activeTab === InlineEditTabs.SelectedElement &&
|
||||
instanceState.selected.length === 0 &&
|
||||
instanceState.selectedConnection === undefined;
|
||||
|
||||
return (
|
||||
<>
|
||||
|
Loading…
Reference in New Issue
Block a user