diff --git a/src/components/QueryEditor.tsx b/src/components/QueryEditor.tsx index 8814016..477c93d 100644 --- a/src/components/QueryEditor.tsx +++ b/src/components/QueryEditor.tsx @@ -3,12 +3,28 @@ import {InlineField, Input} from '@grafana/ui'; import {QueryEditorProps} from '@grafana/data'; import {DataSource} from '../datasource'; import {WildGraphQLDataSourceOptions, WildGraphQLMainQuery} from '../types'; -import {GraphiQL} from 'graphiql'; -import 'graphiql/graphiql.css'; +import {GraphiQLInterface} from 'graphiql'; +import { + EditorContextProvider, + ExplorerContextProvider, + PluginContextProvider, + SchemaContextProvider, + ExecutionContextProvider, + // StorageContextProvider, + // HistoryContextProvider +} from '@graphiql/react'; import {Fetcher} from '@graphiql/toolkit'; import {FetcherOpts, FetcherParams} from "@graphiql/toolkit/src/create-fetcher/types"; import {getBackendSrv} from "@grafana/runtime"; -import { firstValueFrom } from 'rxjs'; +import {firstValueFrom} from 'rxjs'; + +import 'graphiql/graphiql.css'; + +// import '@graphiql/react/dist/style.css'; +// import '@graphiql/react/font/roboto.css'; +// import '@graphiql/react/font/fira-code.css'; + + type Props = QueryEditorProps; @@ -60,9 +76,6 @@ export function QueryEditor({ query, onChange, onRunQuery, datasource }: Props) ); }, [datasource.options.url, datasource.options.withCredentials, datasource.options.basicAuth]); - const onQueryTextChange = (event: ChangeEvent) => { - onChange({ ...query, queryText: event.target.value }); - }; const onOperationNameChange = (event: ChangeEvent) => { onChange({ ...query, operationName: event.target.value || undefined }); }; @@ -73,15 +86,53 @@ export function QueryEditor({ query, onChange, onRunQuery, datasource }: Props)
{/*Query*/} - -
-
- - - + {/* {*/} + {/* console.log("Edited query");*/} + {/* console.log(value);*/} + {/* onChange({...query, queryText: value});*/} + {/* }}*/} + {/* isHeadersEditorEnabled={false}*/} + {/* showPersistHeadersSettings={false}*/} + {/* storage={DummyStorage}*/} + {/* shouldPersistHeaders={false}*/} + {/* plugins={}*/} + {/*/>*/} + + {/*By not providing storage, history contexts, they won't be used*/} + {/**/} + {/* */} + + + + {/*Explorer context needed for documentation*/} + + { + console.log("Edited query"); + console.log(value); + onChange({...query, queryText: value}); + }} + /> + + + + + +
-