-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(replays): add initial replay cards to replay list (#53323)
closes #53086 created two experimental tables on the replay list page: 1. top 3 most erroneous replays within the last 7 days 2. top 3 most dead click replays within the last 7 days (can change these time periods, I just thought 1 day was too little time for a useful sample size since a lot of numbers showed 0) notes: - these tables are static when compared to the big replay list table, so pagination doesn't affect them (see below for screenshots showing this) - in theory, rage clicks always < dead clicks, which is why I chose to sort by dead clicks page 1: <img width="1250" alt="SCR-20230721-jybf" src="https://github.com/getsentry/sentry/assets/56095982/1c2f6981-e504-4d90-9f88-4c4dfc4523f5"> page 2 (same tables, different replays on big list): <img width="1238" alt="SCR-20230721-jxge" src="https://github.com/getsentry/sentry/assets/56095982/d4b231e3-8786-4144-8122-cc57af0ef3ca">
- Loading branch information
1 parent
5f94dd6
commit 82a85ca
Showing
6 changed files
with
214 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
144 changes: 144 additions & 0 deletions
144
static/app/views/replays/list/replaysErroneousDeadRageCards.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
import styled from '@emotion/styled'; | ||
import {Location} from 'history'; | ||
|
||
import {space} from 'sentry/styles/space'; | ||
import type {Organization} from 'sentry/types'; | ||
import EventView from 'sentry/utils/discover/eventView'; | ||
import useReplayList from 'sentry/utils/replays/hooks/useReplayList'; | ||
import {useHaveSelectedProjectsSentAnyReplayEvents} from 'sentry/utils/replays/hooks/useReplayOnboarding'; | ||
import useOrganization from 'sentry/utils/useOrganization'; | ||
import ReplayTable from 'sentry/views/replays/replayTable'; | ||
import {ReplayColumn} from 'sentry/views/replays/replayTable/types'; | ||
|
||
function ReplaysErroneousDeadRageCards() { | ||
const location: Location = { | ||
pathname: '', | ||
search: '', | ||
query: {}, | ||
hash: '', | ||
state: '', | ||
action: 'PUSH', | ||
key: '', | ||
}; | ||
const organization = useOrganization(); | ||
|
||
const eventViewErrors = EventView.fromNewQueryWithLocation( | ||
{ | ||
name: '', | ||
version: 2, | ||
fields: [ | ||
'activity', | ||
'duration', | ||
'count_errors', | ||
'id', | ||
'project_id', | ||
'user', | ||
'finished_at', | ||
'is_archived', | ||
'started_at', | ||
], | ||
range: '7d', | ||
projects: [], | ||
query: '', | ||
orderby: '-count_errors', | ||
}, | ||
location | ||
); | ||
|
||
const eventViewDeadRage = EventView.fromNewQueryWithLocation( | ||
{ | ||
name: '', | ||
version: 2, | ||
fields: [ | ||
'activity', | ||
'duration', | ||
'count_dead_clicks', | ||
'count_rage_clicks', | ||
'id', | ||
'project_id', | ||
'user', | ||
'finished_at', | ||
'is_archived', | ||
'started_at', | ||
], | ||
range: '7d', | ||
projects: [], | ||
query: '', | ||
orderby: '-count_dead_clicks', | ||
}, | ||
location | ||
); | ||
|
||
const hasSessionReplay = organization.features.includes('session-replay'); | ||
const hasDeadRageCards = organization.features.includes('replay-error-click-cards'); | ||
const {hasSentOneReplay, fetching} = useHaveSelectedProjectsSentAnyReplayEvents(); | ||
|
||
const deadRageCols = [ | ||
ReplayColumn.MOST_DEAD_CLICKS, | ||
ReplayColumn.COUNT_DEAD_CLICKS, | ||
ReplayColumn.COUNT_RAGE_CLICKS, | ||
]; | ||
|
||
const errorCols = [ | ||
ReplayColumn.MOST_ERRONEOUS_REPLAYS, | ||
ReplayColumn.DURATION, | ||
ReplayColumn.COUNT_ERRORS, | ||
ReplayColumn.ACTIVITY, | ||
]; | ||
|
||
return hasSessionReplay && !fetching && hasSentOneReplay ? ( | ||
hasDeadRageCards ? ( | ||
<SplitCardContainer> | ||
<CardTable | ||
eventView={eventViewErrors} | ||
location={location} | ||
organization={organization} | ||
visibleColumns={errorCols} | ||
/> | ||
<CardTable | ||
eventView={eventViewDeadRage} | ||
location={location} | ||
organization={organization} | ||
visibleColumns={deadRageCols} | ||
/> | ||
</SplitCardContainer> | ||
) : null | ||
) : null; | ||
} | ||
|
||
function CardTable({ | ||
eventView, | ||
location, | ||
organization, | ||
visibleColumns, | ||
}: { | ||
eventView: EventView; | ||
location: Location; | ||
organization: Organization; | ||
visibleColumns: ReplayColumn[]; | ||
}) { | ||
const {replays, isFetching, fetchError} = useReplayList({ | ||
eventView, | ||
location, | ||
organization, | ||
}); | ||
|
||
return ( | ||
<ReplayTable | ||
fetchError={fetchError} | ||
isFetching={isFetching} | ||
replays={replays?.slice(0, 3)} | ||
sort={undefined} | ||
visibleColumns={visibleColumns} | ||
saveLocation | ||
/> | ||
); | ||
} | ||
|
||
const SplitCardContainer = styled('div')` | ||
display: grid; | ||
grid-template-columns: 1fr 1fr; | ||
gap: ${space(2)}; | ||
`; | ||
|
||
export default ReplaysErroneousDeadRageCards; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters