From 8a1bbe7517b94b9e1d2eaf9c13cd674a1036e345 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 12 Nov 2024 12:01:08 +0100 Subject: [PATCH] PanelEdit: Fixes issue with repeat options (#96260) --- .../features/dashboard-scene/panel-edit/PanelOptions.tsx | 8 +++++++- .../dashboard-scene/panel-edit/getPanelFrameOptions.tsx | 7 +++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/public/app/features/dashboard-scene/panel-edit/PanelOptions.tsx b/public/app/features/dashboard-scene/panel-edit/PanelOptions.tsx index c7cf2182b5c..3467f8c8f5e 100644 --- a/public/app/features/dashboard-scene/panel-edit/PanelOptions.tsx +++ b/public/app/features/dashboard-scene/panel-edit/PanelOptions.tsx @@ -25,7 +25,13 @@ interface Props { export const PanelOptions = React.memo(({ panel, searchQuery, listMode, data }) => { 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 plugin = panel.getPlugin(); diff --git a/public/app/features/dashboard-scene/panel-edit/getPanelFrameOptions.tsx b/public/app/features/dashboard-scene/panel-edit/getPanelFrameOptions.tsx index c19bb1c108c..629430b1ecc 100644 --- a/public/app/features/dashboard-scene/panel-edit/getPanelFrameOptions.tsx +++ b/public/app/features/dashboard-scene/panel-edit/getPanelFrameOptions.tsx @@ -1,7 +1,7 @@ import { SelectableValue } from '@grafana/data'; import { selectors } from '@grafana/e2e-selectors'; 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 { GenAIPanelDescriptionButton } from 'app/features/dashboard/components/GenAI/GenAIPanelDescriptionButton'; 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 { getDashboardSceneFor } from '../utils/utils'; -export function getPanelFrameCategory2(panel: VizPanel): OptionsPaneCategoryDescriptor { +export function getPanelFrameCategory2( + panel: VizPanel, + layoutElementState: SceneObjectState +): OptionsPaneCategoryDescriptor { const descriptor = new OptionsPaneCategoryDescriptor({ title: 'Panel options', id: 'Panel options',