mirror of
https://github.com/grafana/grafana.git
synced 2025-08-02 02:52:15 +08:00

* update eslint, tsconfig + esbuild to handle new jsx transform * remove thing that breaks the new jsx transform * remove react imports * adjust grafana-icons build * is this the correct syntax? * try this * well this was much easier than expected... * change grafana-plugin-configs webpack config * fixes * fix lockfile * fix 2 more violations * use path.resolve instead of require.resolve * remove react import * fix react imports * more fixes * remove React import * remove import React from docs * remove another react import
36 lines
994 B
TypeScript
36 lines
994 B
TypeScript
import { SelectableValue } from '@grafana/data';
|
|
import { InlineField, InlineFieldRow, Select } from '@grafana/ui';
|
|
|
|
import { EditorProps } from '../QueryEditor';
|
|
|
|
export const CSVFileEditor = ({ onChange, query }: EditorProps) => {
|
|
const onChangeFileName = ({ value }: SelectableValue<string>) => {
|
|
onChange({ ...query, csvFileName: value });
|
|
};
|
|
|
|
const files = [
|
|
'flight_info_by_state.csv',
|
|
'population_by_state.csv',
|
|
'gdp_per_capita.csv',
|
|
'js_libraries.csv',
|
|
'ohlc_dogecoin.csv',
|
|
'weight_height.csv',
|
|
'browser_marketshare.csv',
|
|
'automobiles.csv',
|
|
].map((name) => ({ label: name, value: name }));
|
|
|
|
return (
|
|
<InlineFieldRow>
|
|
<InlineField label="File" labelWidth={14}>
|
|
<Select
|
|
width={32}
|
|
onChange={onChangeFileName}
|
|
placeholder="Select csv file"
|
|
options={files}
|
|
value={files.find((f) => f.value === query.csvFileName)}
|
|
/>
|
|
</InlineField>
|
|
</InlineFieldRow>
|
|
);
|
|
};
|