Skip to content

Commit a3c2aa0

Browse files
feat(snapshots): Add diff threshold UI support
1 parent 3e22506 commit a3c2aa0

File tree

4 files changed

+25
-2
lines changed

4 files changed

+25
-2
lines changed

src/sentry/preprod/api/endpoints/preprod_artifact_snapshot.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,7 @@ def get(self, request: Request, organization: Organization, snapshot_id: str) ->
435435
errored_count=len(categorized.errored),
436436
comparison_run_info=run_info,
437437
approval_info=approval_info,
438+
diff_threshold=manifest.diff_threshold,
438439
).dict()
439440
)
440441

src/sentry/preprod/api/models/snapshots/project_preprod_snapshot_models.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,5 +97,7 @@ class SnapshotDetailsApiResponse(BaseModel):
9797

9898
approval_info: SnapshotApprovalInfo | None = None
9999

100+
diff_threshold: float | None = None
101+
100102

101103
# TODO: POST request in the future when we migrate away from current schemas

static/app/views/preprod/snapshots/header/snapshotHeaderContent.tsx

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@ import {ExternalLink} from '@sentry/scraps/link';
77
import {Text} from '@sentry/scraps/text';
88

99
import * as Layout from 'sentry/components/layouts/thirds';
10-
import {IconCommit, IconPullRequest, IconShow, IconStack} from 'sentry/icons';
10+
import {
11+
IconCommit,
12+
IconPullRequest,
13+
IconSliders,
14+
IconShow,
15+
IconStack,
16+
} from 'sentry/icons';
1117
import type {SVGIconProps} from 'sentry/icons/svgIcon';
1218
import {t} from 'sentry/locale';
1319
import type {Theme} from 'sentry/utils/theme';
@@ -66,7 +72,8 @@ export function SnapshotHeaderContent({
6672
<Layout.HeaderContent>
6773
<Layout.Title>{t('Snapshot')}</Layout.Title>
6874

69-
{vcsItems.length > 0 && (
75+
{(vcsItems.length > 0 ||
76+
(data.diff_threshold !== null && data.diff_threshold !== undefined)) && (
7077
<Flex align="center" gap="lg" wrap="wrap">
7178
{vcsItems.map(item => (
7279
<Flex align="center" gap="xs" key={item.key}>
@@ -82,6 +89,17 @@ export function SnapshotHeaderContent({
8289
)}
8390
</Flex>
8491
))}
92+
{data.diff_threshold !== null && data.diff_threshold !== undefined && (
93+
<Flex align="center" gap="xs">
94+
<IconSliders size="xs" />
95+
<Text size="sm" variant="muted">
96+
{t(
97+
'Specified minimum diff: %s%%',
98+
parseFloat((data.diff_threshold * 100).toPrecision(10))
99+
)}
100+
</Text>
101+
</Flex>
102+
)}
85103
</Flex>
86104
)}
87105

static/app/views/preprod/types/snapshotTypes.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ export interface SnapshotDetailsApiResponse {
5252

5353
approval_info?: SnapshotApprovalInfo | null;
5454

55+
diff_threshold?: number | null;
56+
5557
// Diff fields
5658
added: SnapshotImage[];
5759
added_count: number;

0 commit comments

Comments
 (0)