Skip to content

chore(issue summary): More obvious re-summarize button on summary in drawer #91841

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 16, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 19 additions & 85 deletions static/app/components/group/groupSummary.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {isValidElement, useEffect, useState} from 'react';
import styled from '@emotion/styled';

import {DropdownMenu} from 'sentry/components/dropdownMenu';
import {Button} from 'sentry/components/core/button';
import {makeAutofixQueryKey} from 'sentry/components/events/autofix/useAutofix';
import Placeholder from 'sentry/components/placeholder';
import {IconDocs, IconEllipsis, IconFatal, IconFocus, IconSpan} from 'sentry/icons';
import {IconDocs, IconFatal, IconFocus, IconRefresh, IconSpan} from 'sentry/icons';
import {t} from 'sentry/locale';
import {space} from 'sentry/styles/space';
import type {Event} from 'sentry/types/event';
Expand All @@ -13,8 +13,6 @@ import type {Project} from 'sentry/types/project';
import {getConfigForIssueType} from 'sentry/utils/issueTypeConfig';
import {MarkedText} from 'sentry/utils/marked/markedText';
import {type ApiQueryKey, useApiQuery, useQueryClient} from 'sentry/utils/queryClient';
import normalizeUrl from 'sentry/utils/url/normalizeUrl';
import {useFeedbackForm} from 'sentry/utils/useFeedbackForm';
import useOrganization from 'sentry/utils/useOrganization';
import {useAiConfig} from 'sentry/views/issueDetails/streamline/hooks/useAiConfig';

Expand Down Expand Up @@ -119,7 +117,6 @@ export function GroupSummary({
const queryClient = useQueryClient();
const organization = useOrganization();
const [forceEvent, setForceEvent] = useState(false);
const openFeedbackForm = useFeedbackForm();
const aiConfig = useAiConfig(group, project);
const {data, isPending, isError, refresh} = useGroupSummary(
group,
Expand Down Expand Up @@ -153,53 +150,6 @@ export function GroupSummary({
organization.slug,
]);

const eventDetailsItems = [
{
key: 'event-info',
label:
event?.id === data?.eventId ? (
t('Based on this event')
) : (
<span>{t('See original event (%s)', data?.eventId?.substring(0, 8))}</span>
),
to:
event?.id === data?.eventId
? undefined
: window.location.origin +
normalizeUrl(
`/organizations/${organization.slug}/issues/${data?.groupId}/events/${data?.eventId}/`
),
disabled: event?.id === data?.eventId,
},
...(event?.id === data?.eventId
? []
: [
{
key: 'refresh',
label: t('Summarize this event instead'),
onAction: () => setForceEvent(true),
disabled: isPending,
},
]),
...(openFeedbackForm
? [
{
key: 'feedback',
label: t('Give feedback'),
onAction: () => {
openFeedbackForm({
messagePlaceholder: t('How can we make Issue Summary better for you?'),
tags: {
['feedback.source']: 'issue_details_ai_autofix',
['feedback.owner']: 'ml-ai',
},
});
},
},
]
: []),
];

const shouldShowPossibleCause =
!data?.scores ||
(data.scores.possibleCauseConfidence &&
Expand Down Expand Up @@ -254,26 +204,6 @@ export function GroupSummary({
<div data-testid="group-summary">
{isError ? <div>{t('Error loading summary')}</div> : null}
<Content>
{data?.eventId && !isPending && !preview && (
<TooltipWrapper id="group-summary-tooltip-wrapper">
<DropdownMenu
items={eventDetailsItems}
triggerProps={{
icon: <StyledIconEllipsis size="xs" />,
'aria-label': t('Event details'),
size: 'xs',
borderless: true,
showChevron: false,
style: {
zIndex: 0,
},
}}
isDisabled={isPending}
position="bottom-end"
offset={4}
/>
</TooltipWrapper>
)}
<InsightGrid>
{insightCards.map(card => {
if ((!isPending && !card.insight) || (isPending && !card.showWhenLoading)) {
Expand Down Expand Up @@ -309,6 +239,18 @@ export function GroupSummary({
);
})}
</InsightGrid>
{data?.eventId && !isPending && !preview && event?.id !== data?.eventId && (
<ResummarizeWrapper>
<Button
onClick={() => setForceEvent(true)}
disabled={isPending}
size="xs"
icon={<IconRefresh />}
>
{t('Summarize current event')}
</Button>
</ResummarizeWrapper>
)}
</Content>
</div>
);
Expand Down Expand Up @@ -395,17 +337,9 @@ const CardContent = styled('div')`
flex: 1;
`;

const TooltipWrapper = styled('div')`
position: absolute;
top: -${space(1)};
right: 0;

ul {
max-height: none !important;
overflow: visible !important;
}
`;

const StyledIconEllipsis = styled(IconEllipsis)`
color: ${p => p.theme.subText};
const ResummarizeWrapper = styled('div')`
display: flex;
align-items: center;
margin-top: ${space(1)};
flex-shrink: 0;
`;
Loading