diff --git a/src/VariableQueryEditor.tsx b/src/VariableQueryEditor.tsx new file mode 100644 index 0000000..a4e0120 --- /dev/null +++ b/src/VariableQueryEditor.tsx @@ -0,0 +1,28 @@ +import React, { useState } from 'react'; +import { SplunkQuery } from './types'; +import { TextArea } from '@grafana/ui'; + +interface VariableQueryProps { + query: SplunkQuery; + onChange: (query: SplunkQuery, definition: string) => void; +} + +export const VariableQueryEditor = ({ onChange, query }: VariableQueryProps) => { + const [state, setState] = useState(query); + + const saveQuery = () => { + onChange(state, `${state.queryText}`); + }; + + const handleChange = (event: React.FormEvent) => + setState({ + ...state, + [event.currentTarget.name]: event.currentTarget.value, + }); + + return ( +
+