import {Fragment} from 'react'; import styled from '@emotion/styled'; import Link from 'sentry/components/links/link'; import Pagination from 'sentry/components/pagination'; import {PanelTable} from 'sentry/components/panels'; import {IconArrow} from 'sentry/icons'; import {t} from 'sentry/locale'; import {PageContent} from 'sentry/styles/organization'; import {Group, NewQuery} from 'sentry/types'; import DiscoverQuery from 'sentry/utils/discover/discoverQuery'; import EventView from 'sentry/utils/discover/eventView'; import {getQueryParamAsString} from 'sentry/utils/replays/getQueryParamAsString'; import {useLocation} from 'sentry/utils/useLocation'; import useOrganization from 'sentry/utils/useOrganization'; import {useParams} from 'sentry/utils/useParams'; import ReplayTable from 'sentry/views/replays/replayTable'; import {Replay} from 'sentry/views/replays/types'; const DEFAULT_DISCOVER_LIMIT = 50; type Props = { group: Group; }; const GroupReplays = ({group}: Props) => { const location = useLocation(); const organization = useOrganization(); const params = useParams(); const {project} = group; const getEventView = () => { const {groupId} = params; const eventQueryParams: NewQuery = { id: '', name: '', version: 2, fields: [ 'replayId', 'eventID', 'project', 'timestamp', 'url', 'user.display', 'user.email', 'user.id', 'user.ip_address', 'user.name', 'user.username', ], projects: [+project.id], orderby: getQueryParamAsString(query.sort) || '-timestamp', query: `issue.id:${groupId}`, }; return EventView.fromNewQueryWithLocation(eventQueryParams, location); }; const {query} = location; const {cursor: _cursor, page: _page, ...currentQuery} = query; const sort: { field: string; } = { field: getQueryParamAsString(query.sort) || '-timestamp', }; const arrowDirection = sort.field.startsWith('-') ? 'down' : 'up'; const sortArrow = ; return ( {data => { return ( {t('Timestamp')} {sort.field.endsWith('timestamp') && sortArrow} , t('Duration'), t('Errors'), ]} > {data.tableData ? ( ) : null} ); }} ); }; const StyledPanelTable = styled(PanelTable)` grid-template-columns: minmax(0, 1fr) max-content max-content max-content; `; const StyledPageContent = styled(PageContent)` box-shadow: 0px 0px 1px ${p => p.theme.gray200}; background-color: ${p => p.theme.background}; `; const SortLink = styled(Link)` color: inherit; :hover { color: inherit; } svg { vertical-align: top; } `; export default GroupReplays;