Files
Gábor Farkas 3e59ae7e56 InfluxDB: Convert the InfluxQL query editor from Angular to React (#32168)
Co-authored-by: Giordano Ricci <me@giordanoricci.com>
2021-05-11 08:15:44 +02:00

24 lines
553 B
TypeScript

import React from 'react';
import { SelectableValue } from '@grafana/data';
import { Seg } from './Seg';
import { unwrap } from './unwrap';
type Props = {
loadOptions: () => Promise<SelectableValue[]>;
allowCustomValue?: boolean;
onAdd: (v: string) => void;
};
export const AddButton = ({ loadOptions, allowCustomValue, onAdd }: Props): JSX.Element => {
return (
<Seg
value="+"
loadOptions={loadOptions}
allowCustomValue={allowCustomValue}
onChange={(v) => {
onAdd(unwrap(v.value));
}}
/>
);
};