import {Fragment} from 'react'; import styled from '@emotion/styled'; import FeatureBadge from 'sentry/components/featureBadge'; import RadioGroup, {RadioGroupProps} from 'sentry/components/forms/controls/radioGroup'; import ExternalLink from 'sentry/components/links/externalLink'; import {t, tct} from 'sentry/locale'; import space from 'sentry/styles/space'; import {DisplayType} from 'sentry/views/dashboardsV2/types'; import {DataSet} from '../utils'; import {BuildStep} from './buildStep'; const DATASET_CHOICES: [DataSet, string][] = [ [DataSet.EVENTS, t('Errors and Transactions')], [DataSet.ISSUES, t('Issues (States, Assignment, Time, etc.)')], ]; interface Props { dataSet: DataSet; displayType: DisplayType; hasReleaseHealthFeature: boolean; onChange: (dataSet: DataSet) => void; } export function DataSetStep({ dataSet, onChange, hasReleaseHealthFeature, displayType, }: Props) { const disabledChoices: RadioGroupProps['disabledChoices'] = []; if (displayType !== DisplayType.TABLE) { disabledChoices.push([ DataSet.ISSUES, t('This dataset is restricted to tabular visualization.'), ]); if (displayType === DisplayType.WORLD_MAP) { disabledChoices.push([ DataSet.RELEASES, t( 'This dataset is restricted to big number, tabular and time series visualizations.' ), ]); } } return ( ), } )} > {t('Releases (Sessions, Crash rates)')} , ], ] : DATASET_CHOICES } disabledChoices={disabledChoices} onChange={newDataSet => { onChange(newDataSet as DataSet); }} /> ); } const DataSetChoices = styled(RadioGroup)` display: flex; flex-wrap: wrap; gap: ${space(2)}; `;