Skip to content

Commit 2012e65

Browse files
authored
feat(replay): Add a banner on the Replay List page showing if there are in-progress bulk-delete tasks (#94713)
The banner only appears if exactly one project has been selected in the global project picker, and one of the 10 most recent jobs is still `pending` or `in-progress`. ![SCR-20250701-jwfh](https://github.com/user-attachments/assets/c5d47779-8cd6-4cce-9b58-481eaa9cd11f) Depends on #94653 Fixes REPLAY-459
1 parent 4180e82 commit 2012e65

File tree

4 files changed

+60
-1
lines changed

4 files changed

+60
-1
lines changed

static/app/components/replays/bulkDelete/replayBulkDeleteAuditLog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {Fragment} from 'react';
33
import Pagination from 'sentry/components/pagination';
44
import ReplayBulkDeleteAuditLogTable from 'sentry/components/replays/bulkDelete/replayBulkDeleteAuditLogTable';
55
import type {ReplayBulkDeleteAuditLog} from 'sentry/components/replays/bulkDelete/types';
6-
import useReplayBulkDeleteAuditLog from 'sentry/components/replays/bulkDelete/useFetchBulkDeleteLogs';
6+
import useReplayBulkDeleteAuditLog from 'sentry/components/replays/bulkDelete/useReplayBulkDeleteAuditLog';
77

88
interface Props {
99
projectSlug: string;
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import {hasEveryAccess} from 'sentry/components/acl/access';
2+
import {Alert} from 'sentry/components/core/alert';
3+
import Link from 'sentry/components/links/link';
4+
import useReplayBulkDeleteAuditLog from 'sentry/components/replays/bulkDelete/useReplayBulkDeleteAuditLog';
5+
import {t, tct} from 'sentry/locale';
6+
import useOrganization from 'sentry/utils/useOrganization';
7+
import useProjectFromId from 'sentry/utils/useProjectFromId';
8+
9+
interface Props {
10+
projectId: string;
11+
}
12+
13+
export default function BulkDeleteAlert({projectId}: Props) {
14+
const organization = useOrganization();
15+
const project = useProjectFromId({project_id: projectId});
16+
const hasWriteAccess = hasEveryAccess(['project:write'], {organization, project});
17+
18+
const {data} = useReplayBulkDeleteAuditLog({
19+
projectSlug: project?.slug ?? '',
20+
query: {per_page: 10, offset: 0, referrer: 'replay-list'},
21+
enabled: project && hasWriteAccess,
22+
});
23+
24+
if (!hasWriteAccess || !project) {
25+
return null;
26+
}
27+
28+
// TODO: This only looks at the first page of results.
29+
// It would be better to be able to search for jobs in progress to be sure.
30+
// The expectation is that only one job is running at a time.
31+
const hasAnyInProgress = data?.data?.some(job =>
32+
['pending', 'in-progress'].includes(job?.status ?? '')
33+
);
34+
35+
if (hasAnyInProgress) {
36+
return (
37+
<Alert
38+
type="info"
39+
showIcon
40+
expand={tct('Visit the [link: Job log] to see more details and track progress.', {
41+
link: (
42+
<Link
43+
to={`/organizations/${organization.slug}/settings/projects/${project.slug}/replays/?replaySettingsTab=bulk-delete`}
44+
/>
45+
),
46+
})}
47+
>
48+
{t(
49+
'Replays are being deleted in the background. Items shown below may be stale.'
50+
)}
51+
</Alert>
52+
);
53+
}
54+
return null;
55+
}

static/app/views/replays/list/listContent.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import usePageFilters from 'sentry/utils/usePageFilters';
1414
import useProjectSdkNeedsUpdate from 'sentry/utils/useProjectSdkNeedsUpdate';
1515
import DeadRageSelectorCards from 'sentry/views/replays/deadRageClick/deadRageSelectorCards';
1616
import useAllMobileProj from 'sentry/views/replays/detail/useAllMobileProj';
17+
import BulkDeleteAlert from 'sentry/views/replays/list/bulkDeleteAlert';
1718
import ReplaysFilters from 'sentry/views/replays/list/filters';
1819
import ReplayOnboardingPanel from 'sentry/views/replays/list/replayOnboardingPanel';
1920
import ReplaysList from 'sentry/views/replays/list/replaysList';
@@ -64,6 +65,9 @@ export default function ListContent() {
6465

6566
return (
6667
<Fragment>
68+
{projects.length === 1 ? (
69+
<BulkDeleteAlert projectId={String(projects[0] ?? '')} />
70+
) : null}
6771
<FiltersContainer>
6872
<ReplaysFilters />
6973
<SearchWrapper>

0 commit comments

Comments
 (0)