From 3f0efa795bd819cf87c658452effafd7671c8d15 Mon Sep 17 00:00:00 2001 From: Akshay Iyyadurai Balasundaram Date: Fri, 13 Feb 2026 18:24:10 +0530 Subject: [PATCH 1/2] [ENHANCEMENT] plugin-system: add panel query editor options context Signed-off-by: Akshay Iyyadurai Balasundaram --- .../PanelQueriesSharedControls.tsx | 1 + .../PanelSpecEditor/PanelSpecEditor.tsx | 19 +++++++++--- .../runtime/QueryEditorOptionsProvider.tsx | 31 +++++++++++++++++++ plugin-system/src/runtime/index.ts | 1 + 4 files changed, 47 insertions(+), 5 deletions(-) create mode 100644 plugin-system/src/runtime/QueryEditorOptionsProvider.tsx diff --git a/dashboards/src/components/PanelDrawer/PanelQueriesSharedControls.tsx b/dashboards/src/components/PanelDrawer/PanelQueriesSharedControls.tsx index c1a0ecc..712da0c 100644 --- a/dashboards/src/components/PanelDrawer/PanelQueriesSharedControls.tsx +++ b/dashboards/src/components/PanelDrawer/PanelQueriesSharedControls.tsx @@ -87,6 +87,7 @@ export function PanelQueriesSharedControls({ ; panelDefinition: PanelDefinition; + queryOptions?: QueryOptions; onQueriesChange: (queries: QueryDefinition[]) => void; onQueryRun: (index: number, query: QueryDefinition) => void; onPluginSpecChange: (spec: UnknownSpec) => void; @@ -31,7 +38,7 @@ export interface PanelSpecEditorProps { } export const PanelSpecEditor = forwardRef((props, ref): ReactElement | null => { - const { control, panelDefinition, onQueriesChange, onQueryRun, onPluginSpecChange, onJSONChange } = props; + const { control, panelDefinition, queryOptions, onQueriesChange, onQueryRun, onPluginSpecChange, onJSONChange } = props; const { kind } = panelDefinition.spec.plugin; const { data: plugin, isLoading, error } = usePlugin('Panel', kind); @@ -132,9 +139,11 @@ export const PanelSpecEditor = forwardRef }); return ( - - - + + + + + ); }); diff --git a/plugin-system/src/runtime/QueryEditorOptionsProvider.tsx b/plugin-system/src/runtime/QueryEditorOptionsProvider.tsx new file mode 100644 index 0000000..10e3d0a --- /dev/null +++ b/plugin-system/src/runtime/QueryEditorOptionsProvider.tsx @@ -0,0 +1,31 @@ +// Copyright The Perses Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import { createContext, ReactElement, ReactNode, useContext } from 'react'; + +export type QueryEditorOptions = Record; + +const QueryEditorOptionsContext = createContext({}); + +export interface QueryEditorOptionsProviderProps { + options?: QueryEditorOptions; + children: ReactNode; +} + +export function QueryEditorOptionsProvider({ options, children }: QueryEditorOptionsProviderProps): ReactElement { + return {children}; +} + +export function useQueryEditorOptions(): T { + return useContext(QueryEditorOptionsContext) as T; +} diff --git a/plugin-system/src/runtime/index.ts b/plugin-system/src/runtime/index.ts index 72c8679..834be9a 100644 --- a/plugin-system/src/runtime/index.ts +++ b/plugin-system/src/runtime/index.ts @@ -22,5 +22,6 @@ export * from './profile-queries'; export * from './item-actions'; export * from './DataQueriesProvider'; export * from './QueryCountProvider'; +export * from './QueryEditorOptionsProvider'; export * from './RouterProvider'; export * from './UsageMetricsProvider'; From 19708f2296791887163d48fd404ba2340a49f78c Mon Sep 17 00:00:00 2001 From: Akshay Iyyadurai Balasundaram Date: Fri, 13 Feb 2026 18:34:40 +0530 Subject: [PATCH 2/2] fix lint Signed-off-by: Akshay Iyyadurai Balasundaram --- .../src/components/PanelSpecEditor/PanelSpecEditor.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugin-system/src/components/PanelSpecEditor/PanelSpecEditor.tsx b/plugin-system/src/components/PanelSpecEditor/PanelSpecEditor.tsx index 81d650c..d34ea32 100644 --- a/plugin-system/src/components/PanelSpecEditor/PanelSpecEditor.tsx +++ b/plugin-system/src/components/PanelSpecEditor/PanelSpecEditor.tsx @@ -38,7 +38,8 @@ export interface PanelSpecEditorProps { } export const PanelSpecEditor = forwardRef((props, ref): ReactElement | null => { - const { control, panelDefinition, queryOptions, onQueriesChange, onQueryRun, onPluginSpecChange, onJSONChange } = props; + const { control, panelDefinition, queryOptions, onQueriesChange, onQueryRun, onPluginSpecChange, onJSONChange } = + props; const { kind } = panelDefinition.spec.plugin; const { data: plugin, isLoading, error } = usePlugin('Panel', kind);