1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- import {useMemo} from 'react';
- import styled from '@emotion/styled';
- import {Location} from 'history';
- import * as Layout from 'sentry/components/layouts/thirds';
- import type {Group, Organization} from 'sentry/types';
- import EventView from 'sentry/utils/discover/eventView';
- import useReplayList from 'sentry/utils/replays/hooks/useReplayList';
- import {useLocation} from 'sentry/utils/useLocation';
- import useOrganization from 'sentry/utils/useOrganization';
- import useReplaysFromIssue from 'sentry/views/issueDetails/groupReplays/useReplaysFromIssue';
- import ReplayTable from 'sentry/views/replays/replayTable';
- import {ReplayColumns} from 'sentry/views/replays/replayTable/types';
- import type {ReplayListLocationQuery} from 'sentry/views/replays/types';
- type Props = {
- group: Group;
- };
- const VISIBLE_COLUMNS = [
- ReplayColumns.replay,
- ReplayColumns.os,
- ReplayColumns.browser,
- ReplayColumns.duration,
- ReplayColumns.countErrors,
- ReplayColumns.activity,
- ];
- function GroupReplays({group}: Props) {
- const organization = useOrganization();
- const location = useLocation<ReplayListLocationQuery>();
- const {eventView, fetchError, pageLinks} = useReplaysFromIssue({
- group,
- location,
- organization,
- });
- if (!eventView) {
- return (
- <StyledLayoutPage withPadding>
- <ReplayTable
- fetchError={fetchError}
- isFetching
- replays={[]}
- sort={undefined}
- visibleColumns={VISIBLE_COLUMNS}
- />
- </StyledLayoutPage>
- );
- }
- return (
- <GroupReplaysTable
- eventView={eventView}
- organization={organization}
- pageLinks={pageLinks}
- visibleColumns={VISIBLE_COLUMNS}
- />
- );
- }
- const GroupReplaysTable = ({
- eventView,
- organization,
- visibleColumns,
- }: {
- eventView: EventView;
- organization: Organization;
- pageLinks: string | null;
- visibleColumns: ReplayColumns[];
- }) => {
- const location = useMemo(() => ({query: {}} as Location<ReplayListLocationQuery>), []);
- const {replays, isFetching, fetchError} = useReplayList({
- eventView,
- location,
- organization,
- });
- return (
- <StyledLayoutPage withPadding>
- <ReplayTable
- fetchError={fetchError}
- isFetching={isFetching}
- replays={replays}
- sort={undefined}
- visibleColumns={visibleColumns}
- />
- </StyledLayoutPage>
- );
- };
- const StyledLayoutPage = styled(Layout.Page)`
- box-shadow: 0px 0px 1px ${p => p.theme.gray200};
- background-color: ${p => p.theme.background};
- `;
- export default GroupReplays;
|