From c5f4ceb792a7df64e27ff268e85ff7778cad0ac6 Mon Sep 17 00:00:00 2001 From: Rohan Agarwal Date: Thu, 14 Aug 2025 13:42:39 -0700 Subject: [PATCH 1/4] Include event data in copy buttons --- .../events/autofix/autofixRootCause.tsx | 15 ++- .../events/autofix/autofixSolution.tsx | 24 +++-- .../events/autofix/autofixSteps.tsx | 9 +- .../app/components/events/autofix/utils.tsx | 34 +++++++ .../streamline/hooks/useCopyIssueDetails.tsx | 98 +++++++++++-------- .../streamline/sidebar/seerDrawer.tsx | 1 + 6 files changed, 127 insertions(+), 54 deletions(-) diff --git a/static/app/components/events/autofix/autofixRootCause.tsx b/static/app/components/events/autofix/autofixRootCause.tsx index cbaf9a26e1fbee..ffa9ae68f64232 100644 --- a/static/app/components/events/autofix/autofixRootCause.tsx +++ b/static/app/components/events/autofix/autofixRootCause.tsx @@ -14,9 +14,11 @@ import { type CommentThread, } from 'sentry/components/events/autofix/types'; import {makeAutofixQueryKey} from 'sentry/components/events/autofix/useAutofix'; +import {formatRootCauseWithEvent} from 'sentry/components/events/autofix/utils'; import {IconArrow, IconChat, IconClose, IconCopy, IconFocus} from 'sentry/icons'; import {t} from 'sentry/locale'; import {space} from 'sentry/styles/space'; +import type {Event} from 'sentry/types/event'; import {singleLineRenderer} from 'sentry/utils/marked/marked'; import {useMutation, useQueryClient} from 'sentry/utils/queryClient'; import testableTransition from 'sentry/utils/testableTransition'; @@ -70,6 +72,7 @@ type AutofixRootCauseProps = { rootCauseSelection: AutofixRootCauseSelection; runId: string; agentCommentThread?: CommentThread; + event?: Event; isRootCauseFirstAppearance?: boolean; previousDefaultStepIndex?: number; previousInsightCount?: number; @@ -206,11 +209,13 @@ export function formatRootCauseText( function CopyRootCauseButton({ cause, customRootCause, + event, }: { cause?: AutofixRootCauseData; customRootCause?: string; + event?: Event; }) { - const text = formatRootCauseText(cause, customRootCause); + const text = formatRootCauseWithEvent(cause, customRootCause, event); const {onClick, label} = useCopyToClipboard({ text, }); @@ -238,6 +243,7 @@ function AutofixRootCauseDisplay({ previousDefaultStepIndex, previousInsightCount, agentCommentThread, + event, }: AutofixRootCauseProps) { const cause = causes[0]; const iconFocusRef = useRef(null); @@ -324,7 +330,10 @@ function AutofixRootCauseDisplay({ {rootCauseSelection.custom_root_cause} - + @@ -424,7 +433,7 @@ function AutofixRootCauseDisplay({ ) : ( - +