import React from 'react';
import { SelectableValue } from '@grafana/data';
import { InlineFieldRow, InlineField, Select, MultiSelect, Input } from '@grafana/ui';
import { USAQuery } from '../types';
export interface Props {
onChange: (value: USAQuery) => void;
query: USAQuery;
}
export function USAQueryEditor({ query, onChange }: Props) {
return (
<>
{
onChange({ ...query, period: v.currentTarget.value });
}}
/>
{
onChange({ ...query, fields: vals.map((v) => v.value) });
}}
width={32}
placeholder="all"
value={query.fields}
/>
{
onChange({ ...query, states: vals.map((v) => v.value) });
}}
placeholder="all"
value={query.states}
/>
>
);
}
export const usaQueryModes = [
'values-as-rows',
'values-as-fields',
'values-as-labeled-fields',
'timeseries',
'timeseries-wide',
].map((f) => ({ label: f, value: f }));
export const fieldNames = [
'foo',
'bar',
'baz', // all short
].map((f) => ({ label: f, value: f }));
export const stateNames = [
'AL',
'AK',
'AZ',
'AR',
'CA',
'CO',
'CT',
'DE',
'DC',
'FL',
'GA',
'HI',
'ID',
'IL',
'IN',
'IA',
'KS',
'KY',
'LA',
'ME',
'MT',
'NE',
'NV',
'NH',
'NJ',
'NM',
'NY',
'NC',
'ND',
'OH',
'OK',
'OR',
'MD',
'MA',
'MI',
'MN',
'MS',
'MO',
'PA',
'RI',
'SC',
'SD',
'TN',
'TX',
'UT',
'VT',
'VA',
'WA',
'WV',
'WI',
'WY',
].map((f) => ({ label: f, value: f }));