/usr/share/grafana/public/app/plugins/datasource/opentsdb/components
import { useState } from 'react'; import { QueryEditorProps } from '@grafana/data'; import { InlineFormLabel, Input, InlineSwitch } from '@grafana/ui'; import OpenTsDatasource from '../datasource'; import { OpenTsdbQuery, OpenTsdbOptions } from '../types'; export const AnnotationEditor = (props: QueryEditorProps<OpenTsDatasource, OpenTsdbQuery, OpenTsdbOptions>) => { const { query, onChange } = props; const [target, setTarget] = useState<string>(query.target ?? ''); const [isGlobal, setIsGlobal] = useState<boolean>(query.isGlobal ?? false); const updateValue = <K extends keyof OpenTsdbQuery, V extends OpenTsdbQuery[K]>(key: K, val: V) => { onChange({ ...query, [key]: val, fromAnnotations: true, }); }; const updateIsGlobal = (isGlobal: boolean) => { isGlobal = !isGlobal; setIsGlobal(isGlobal); updateValue('isGlobal', isGlobal); }; return ( <div className="gf-form-group"> <div className="gf-form"> <InlineFormLabel width={12}>OpenTSDB metrics query</InlineFormLabel> <Input value={target} onChange={(e) => setTarget(e.currentTarget.value ?? '')} onBlur={() => updateValue('target', target)} placeholder="events.eventname" /> </div> <div className="gf-form"> <InlineFormLabel width={12}>Show Global Annotations?</InlineFormLabel> <InlineSwitch value={isGlobal} onChange={(e) => updateIsGlobal(isGlobal)} /> </div> </div> ); };
.
Edit
..
Edit
AnnotationEditor.tsx
Edit
ConfigEditor.tsx
Edit
DownSample.test.tsx
Edit
DownSample.tsx
Edit
FilterSection.test.tsx
Edit
FilterSection.tsx
Edit
MetricSection.test.tsx
Edit
MetricSection.tsx
Edit
OpenTsdbDetails.tsx
Edit
OpenTsdbQueryEditor.test.tsx
Edit
OpenTsdbQueryEditor.tsx
Edit
RateSection.test.tsx
Edit
RateSection.tsx
Edit
TagSection.test.tsx
Edit
TagSection.tsx
Edit
styles.ts
Edit