import { useCallback, useState } from 'react'; import * as React from 'react'; import { selectors } from '@grafana/e2e-selectors'; import { Trans, t } from '@grafana/i18n'; import { Button, Field, Modal, Input, Alert } from '@grafana/ui'; import { Form } from 'app/core/components/Form/Form'; import { RepeatRowSelect } from '../RepeatRowSelect/RepeatRowSelect'; export type OnRowOptionsUpdate = (title: string, repeat?: string | null) => void; export interface Props { title: string; repeat?: string; onUpdate: OnRowOptionsUpdate; onCancel: () => void; warning?: React.ReactNode; } export const RowOptionsForm = ({ repeat, title, warning, onUpdate, onCancel }: Props) => { const [newRepeat, setNewRepeat] = useState(repeat); const onChangeRepeat = useCallback((name?: string) => setNewRepeat(name), [setNewRepeat]); return (
{ onUpdate(formData.title, newRepeat); }} > {({ register }) => ( <> {warning && ( {warning} )} )}
); };