import React, { useState } from 'react'; import { QueryEditorProps } from '@grafana/data'; import { InlineFormLabel, Input, TagsInput } from '@grafana/ui'; import { GraphiteDatasource } from '../datasource'; import { GraphiteQuery, GraphiteOptions } from '../types'; export const AnnotationEditor = (props: QueryEditorProps) => { const { query, onChange } = props; const [target, setTarget] = useState(query.target ?? ''); const [tags, setTags] = useState(query.tags ?? []); const updateValue = (key: K, val: V) => { if (key === 'tags') { onChange({ ...query, [key]: val, fromAnnotations: true, queryType: key, }); } else { onChange({ ...query, [key]: val, fromAnnotations: true, textEditor: true, }); } }; const onTagsChange = (tagsInput: string[]) => { setTags(tagsInput); updateValue('tags', tagsInput); }; return (
Graphite Query setTarget(e.currentTarget.value || '')} onBlur={() => updateValue('target', target)} placeholder="Example: statsd.application.counters.*.count" />
Or
Graphite events tags
); };