@@ -15,7 +15,13 @@ import { ErrorAlert, JSONEditor, LinksEditor } from '@perses-dev/components';
1515import { PanelDefinition , PanelEditorValues , QueryDefinition , UnknownSpec } from '@perses-dev/core' ;
1616import { Control , Controller } from 'react-hook-form' ;
1717import { forwardRef , ReactElement } from 'react' ;
18- import { QueryCountProvider , useDataQueriesContext , usePlugin } from '../../runtime' ;
18+ import {
19+ QueryCountProvider ,
20+ QueryEditorOptionsProvider ,
21+ QueryOptions ,
22+ useDataQueriesContext ,
23+ usePlugin ,
24+ } from '../../runtime' ;
1925import { PanelPlugin } from '../../model' ;
2026import { OptionsEditorTabsProps , OptionsEditorTabs } from '../OptionsEditorTabs' ;
2127import { MultiQueryEditor } from '../MultiQueryEditor' ;
@@ -24,14 +30,15 @@ import { PluginEditorRef } from '../PluginEditor';
2430export interface PanelSpecEditorProps {
2531 control : Control < PanelEditorValues > ;
2632 panelDefinition : PanelDefinition ;
33+ queryOptions ?: QueryOptions ;
2734 onQueriesChange : ( queries : QueryDefinition [ ] ) => void ;
2835 onQueryRun : ( index : number , query : QueryDefinition ) => void ;
2936 onPluginSpecChange : ( spec : UnknownSpec ) => void ;
3037 onJSONChange : ( panelDefinitionStr : string ) => void ;
3138}
3239
3340export const PanelSpecEditor = forwardRef < PluginEditorRef , PanelSpecEditorProps > ( ( props , ref ) : ReactElement | null => {
34- const { control, panelDefinition, onQueriesChange, onQueryRun, onPluginSpecChange, onJSONChange } = props ;
41+ const { control, panelDefinition, queryOptions , onQueriesChange, onQueryRun, onPluginSpecChange, onJSONChange } = props ;
3542 const { kind } = panelDefinition . spec . plugin ;
3643 const { data : plugin , isLoading, error } = usePlugin ( 'Panel' , kind ) ;
3744
@@ -132,9 +139,11 @@ export const PanelSpecEditor = forwardRef<PluginEditorRef, PanelSpecEditorProps>
132139 } ) ;
133140
134141 return (
135- < QueryCountProvider queryCount = { ( panelDefinition . spec . queries ?? [ ] ) . length } >
136- < OptionsEditorTabs key = { tabs . length } tabs = { tabs } />
137- </ QueryCountProvider >
142+ < QueryEditorOptionsProvider options = { queryOptions } >
143+ < QueryCountProvider queryCount = { ( panelDefinition . spec . queries ?? [ ] ) . length } >
144+ < OptionsEditorTabs key = { tabs . length } tabs = { tabs } />
145+ </ QueryCountProvider >
146+ </ QueryEditorOptionsProvider >
138147 ) ;
139148} ) ;
140149
0 commit comments