PanelEdit: Fixes issue with repeat options (#96260)

This commit is contained in:
Torkel Ödegaard 2024-11-12 12:01:08 +01:00 committed by GitHub
parent 7090fd5b34
commit 8a1bbe7517
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 3 deletions

View File

@ -25,7 +25,13 @@ interface Props {
export const PanelOptions = React.memo<Props>(({ panel, searchQuery, listMode, data }) => { export const PanelOptions = React.memo<Props>(({ panel, searchQuery, listMode, data }) => {
const { options, fieldConfig, _pluginInstanceState } = panel.useState(); const { options, fieldConfig, _pluginInstanceState } = panel.useState();
const panelFrameOptions = useMemo(() => getPanelFrameCategory2(panel), [panel]); const layoutElement = panel.parent!;
const layoutElementState = layoutElement.useState();
const panelFrameOptions = useMemo(
() => getPanelFrameCategory2(panel, layoutElementState),
[panel, layoutElementState]
);
const visualizationOptions = useMemo(() => { const visualizationOptions = useMemo(() => {
const plugin = panel.getPlugin(); const plugin = panel.getPlugin();

View File

@ -1,7 +1,7 @@
import { SelectableValue } from '@grafana/data'; import { SelectableValue } from '@grafana/data';
import { selectors } from '@grafana/e2e-selectors'; import { selectors } from '@grafana/e2e-selectors';
import { config } from '@grafana/runtime'; import { config } from '@grafana/runtime';
import { SceneTimeRangeLike, VizPanel } from '@grafana/scenes'; import { SceneObjectState, SceneTimeRangeLike, VizPanel } from '@grafana/scenes';
import { DataLinksInlineEditor, Input, TextArea, Switch, RadioButtonGroup, Select } from '@grafana/ui'; import { DataLinksInlineEditor, Input, TextArea, Switch, RadioButtonGroup, Select } from '@grafana/ui';
import { GenAIPanelDescriptionButton } from 'app/features/dashboard/components/GenAI/GenAIPanelDescriptionButton'; import { GenAIPanelDescriptionButton } from 'app/features/dashboard/components/GenAI/GenAIPanelDescriptionButton';
import { GenAIPanelTitleButton } from 'app/features/dashboard/components/GenAI/GenAIPanelTitleButton'; import { GenAIPanelTitleButton } from 'app/features/dashboard/components/GenAI/GenAIPanelTitleButton';
@ -17,7 +17,10 @@ import { vizPanelToPanel, transformSceneToSaveModel } from '../serialization/tra
import { dashboardSceneGraph } from '../utils/dashboardSceneGraph'; import { dashboardSceneGraph } from '../utils/dashboardSceneGraph';
import { getDashboardSceneFor } from '../utils/utils'; import { getDashboardSceneFor } from '../utils/utils';
export function getPanelFrameCategory2(panel: VizPanel): OptionsPaneCategoryDescriptor { export function getPanelFrameCategory2(
panel: VizPanel,
layoutElementState: SceneObjectState
): OptionsPaneCategoryDescriptor {
const descriptor = new OptionsPaneCategoryDescriptor({ const descriptor = new OptionsPaneCategoryDescriptor({
title: 'Panel options', title: 'Panel options',
id: 'Panel options', id: 'Panel options',