import {Fragment, useCallback, useState} from 'react'; import styled from '@emotion/styled'; import {openModal} from 'sentry/actionCreators/modal'; import {Button} from 'sentry/components/button'; import {TabList, Tabs} from 'sentry/components/tabs'; import {IconTable} from 'sentry/icons/iconTable'; import {t} from 'sentry/locale'; import {space} from 'sentry/styles/space'; import {useResultMode} from 'sentry/views/explore/hooks/useResultsMode'; import {useSampleFields} from 'sentry/views/explore/hooks/useSampleFields'; import {useSpanFieldSupportedTags} from 'sentry/views/performance/utils/useSpanFieldSupportedTags'; import {ColumnEditorModal} from './columnEditorModal'; import {SpansTable} from './spansTable'; import {TracesTable} from './tracesTable'; enum Tab { SPAN = 'span', TRACE = 'trace', } interface ExploreTablesProps {} export function ExploreTables({}: ExploreTablesProps) { const [resultMode] = useResultMode(); return ( {resultMode === 'aggregate' && } {resultMode === 'samples' && } ); } function ExploreAggregateTable() { return
TODO: aggregate table
; } function ExploreSamplesTable() { const [tab, setTab] = useState(Tab.SPAN); const [fields, setFields] = useSampleFields(); // TODO: This should be loaded from context to avoid loading tags twice. const tags = useSpanFieldSupportedTags(); const openColumnEditor = useCallback(() => { openModal( modalProps => ( ), {closeEvents: 'escape-key'} ); }, [fields, setFields, tags]); return ( {t('Span Samples')} {t('Trace Samples')} {tab === Tab.SPAN && } {tab === Tab.TRACE && } ); } const SamplesTableHeader = styled('div')` display: flex; flex-direction: row; justify-content: space-between; margin-bottom: ${space(1)}; `;