import React, { FunctionComponent } from 'react'; import { SelectableValue } from '@grafana/data'; import { Select } from '@grafana/ui'; import { QueryEditorRow } from '..'; import { SELECT_WIDTH, LOOKBACK_PERIODS } from '../../constants'; export interface Props { refId: string; onChange: (lookbackPeriod: string) => void; templateVariableOptions: Array>; current?: string; } export const LookbackPeriodSelect: FunctionComponent = ({ refId, current, templateVariableOptions, onChange, }) => { const options = LOOKBACK_PERIODS.map((lp) => ({ ...lp, label: lp.text, })); if (current && !options.find((op) => op.value === current)) { options.push({ label: current, text: current, value: current, hidden: false }); } const visibleOptions = options.filter((lp) => !lp.hidden); return (