import { css } from '@emotion/css'; import React, { useState } from 'react'; import { CSSTransition } from 'react-transition-group'; import { GrafanaTheme } from '@grafana/data'; import { Icon, InlineField, InlineFieldRow, InlineLabel, Input, useStyles } from '@grafana/ui'; import { JaegerQuery } from '../types'; const durationPlaceholder = 'e.g. 1.2s, 100ms, 500us'; type Props = { query: JaegerQuery; onChange: (value: JaegerQuery) => void; }; export function AdvancedOptions({ query, onChange }: Props) { const [showAdvancedOptions, setShowAdvancedOptions] = useState(false); const styles = useStyles(getStyles); return (
setShowAdvancedOptions(!showAdvancedOptions)}> Advanced options{' '}
onChange({ ...query, minDuration: v.currentTarget.value, }) } /> onChange({ ...query, maxDuration: v.currentTarget.value, }) } /> onChange({ ...query, limit: v.currentTarget.value ? parseInt(v.currentTarget.value, 10) : undefined, }) } />
); } function getStyles(theme: GrafanaTheme) { return { advancedOptionsContainer: css` margin: 0 ${theme.spacing.xs} ${theme.spacing.xs} 0; width: 100%; cursor: pointer; `, enter: css` label: enter; height: 0; opacity: 0; `, enterActive: css` label: enterActive; height: 108px; opacity: 1; transition: height 300ms ease, opacity 300ms ease; `, exit: css` label: exit; height: 108px; opacity: 1; `, exitActive: css` label: exitActive; height: 0; opacity: 0; transition: height 300ms ease, opacity 300ms ease; `, angleUp: css` transform: rotate(-180deg); transition: transform 300ms; `, angleDown: css` transform: rotate(0deg); transition: transform 300ms; `, }; }