|
@@ -1,3 +1,4 @@
|
|
|
+import {useMemo} from 'react';
|
|
|
import styled from '@emotion/styled';
|
|
|
import {Location} from 'history';
|
|
|
|
|
@@ -6,75 +7,99 @@ 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 {useLocation} from 'sentry/utils/useLocation';
|
|
|
import useOrganization from 'sentry/utils/useOrganization';
|
|
|
import ReplayTable from 'sentry/views/replays/replayTable';
|
|
|
import {ReplayColumn} from 'sentry/views/replays/replayTable/types';
|
|
|
+import {ReplayListLocationQuery} from 'sentry/views/replays/types';
|
|
|
|
|
|
function ReplaysErroneousDeadRageCards() {
|
|
|
- const location: Location = {
|
|
|
- pathname: '',
|
|
|
- search: '',
|
|
|
- query: {},
|
|
|
- hash: '',
|
|
|
- state: '',
|
|
|
- action: 'PUSH',
|
|
|
- key: '',
|
|
|
- };
|
|
|
const organization = useOrganization();
|
|
|
+ const location = useLocation<ReplayListLocationQuery>();
|
|
|
|
|
|
- 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 newLocation = useMemo(() => {
|
|
|
+ return {
|
|
|
+ pathname: '',
|
|
|
+ search: '',
|
|
|
+ hash: '',
|
|
|
+ state: '',
|
|
|
+ action: 'PUSH' as const,
|
|
|
+ key: '',
|
|
|
+ query: {
|
|
|
+ project: location.query.project,
|
|
|
+ environment: location.query.environment,
|
|
|
+ start: location.query.start,
|
|
|
+ statsPeriod: location.query.statsPeriod,
|
|
|
+ utc: location.query.utc,
|
|
|
+ end: location.query.end,
|
|
|
+ },
|
|
|
+ };
|
|
|
+ }, [
|
|
|
+ location.query.project,
|
|
|
+ location.query.environment,
|
|
|
+ location.query.start,
|
|
|
+ location.query.statsPeriod,
|
|
|
+ location.query.utc,
|
|
|
+ location.query.end,
|
|
|
+ ]);
|
|
|
|
|
|
- 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 eventViewErrors = useMemo(() => {
|
|
|
+ return EventView.fromNewQueryWithLocation(
|
|
|
+ {
|
|
|
+ id: '',
|
|
|
+ name: '',
|
|
|
+ version: 2,
|
|
|
+ fields: [
|
|
|
+ 'activity',
|
|
|
+ 'duration',
|
|
|
+ 'count_errors',
|
|
|
+ 'id',
|
|
|
+ 'project_id',
|
|
|
+ 'user',
|
|
|
+ 'finished_at',
|
|
|
+ 'is_archived',
|
|
|
+ 'started_at',
|
|
|
+ ],
|
|
|
+ projects: [],
|
|
|
+ query: 'count_errors:>0',
|
|
|
+ orderby: '-count_errors',
|
|
|
+ },
|
|
|
+ newLocation
|
|
|
+ );
|
|
|
+ }, [newLocation]);
|
|
|
+
|
|
|
+ const eventViewDeadRage = useMemo(() => {
|
|
|
+ return EventView.fromNewQueryWithLocation(
|
|
|
+ {
|
|
|
+ id: '',
|
|
|
+ name: '',
|
|
|
+ version: 2,
|
|
|
+ fields: [
|
|
|
+ 'activity',
|
|
|
+ 'duration',
|
|
|
+ 'count_dead_clicks',
|
|
|
+ 'count_rage_clicks',
|
|
|
+ 'id',
|
|
|
+ 'project_id',
|
|
|
+ 'user',
|
|
|
+ 'finished_at',
|
|
|
+ 'is_archived',
|
|
|
+ 'started_at',
|
|
|
+ ],
|
|
|
+ projects: [],
|
|
|
+ query: 'count_rage_clicks:>0',
|
|
|
+ orderby: '-count_rage_clicks',
|
|
|
+ },
|
|
|
+ newLocation
|
|
|
+ );
|
|
|
+ }, [newLocation]);
|
|
|
|
|
|
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.MOST_RAGE_CLICKS,
|
|
|
ReplayColumn.COUNT_DEAD_CLICKS,
|
|
|
ReplayColumn.COUNT_RAGE_CLICKS,
|
|
|
];
|
|
@@ -91,13 +116,13 @@ function ReplaysErroneousDeadRageCards() {
|
|
|
<SplitCardContainer>
|
|
|
<CardTable
|
|
|
eventView={eventViewErrors}
|
|
|
- location={location}
|
|
|
+ location={newLocation}
|
|
|
organization={organization}
|
|
|
visibleColumns={errorCols}
|
|
|
/>
|
|
|
<CardTable
|
|
|
eventView={eventViewDeadRage}
|
|
|
- location={location}
|
|
|
+ location={newLocation}
|
|
|
organization={organization}
|
|
|
visibleColumns={deadRageCols}
|
|
|
/>
|
|
@@ -121,13 +146,14 @@ function CardTable({
|
|
|
eventView,
|
|
|
location,
|
|
|
organization,
|
|
|
+ perPage: 3,
|
|
|
});
|
|
|
|
|
|
return (
|
|
|
<ReplayTable
|
|
|
fetchError={fetchError}
|
|
|
isFetching={isFetching}
|
|
|
- replays={replays?.slice(0, 3)}
|
|
|
+ replays={replays}
|
|
|
sort={undefined}
|
|
|
visibleColumns={visibleColumns}
|
|
|
saveLocation
|