Skip to content

Commit

Permalink
feat(grouping): Remove GroupingConfigSelect
Browse files Browse the repository at this point in the history
This feature is only available to staff, we do not use it and do not intent to use it.
  • Loading branch information
leeandher authored and armenzg committed Jul 26, 2024
1 parent 9ebf1bd commit 5b57ac3
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 206 deletions.
10 changes: 1 addition & 9 deletions static/app/components/events/eventEntries.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ function EventEntries({
}: Props) {
const orgSlug = organization.slug;
const projectSlug = project.slug;
const orgFeatures = organization?.features ?? [];

if (!event) {
return (
Expand Down Expand Up @@ -131,14 +130,7 @@ function EventEntries({
/>
)}
{!isShare && event.groupID && (
<EventGroupingInfo
projectSlug={projectSlug}
event={event}
showGroupingConfig={
orgFeatures.includes('set-grouping-config') && 'groupingConfig' in event
}
group={group}
/>
<EventGroupingInfo projectSlug={projectSlug} event={event} group={group} />
)}
{!isShare && (
<EventRRWebIntegration event={event} orgId={orgSlug} projectSlug={projectSlug} />
Expand Down
72 changes: 0 additions & 72 deletions static/app/components/events/groupingInfo/groupingConfigSelect.tsx

This file was deleted.

16 changes: 2 additions & 14 deletions static/app/components/events/groupingInfo/groupingVariant.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,7 @@ describe('Grouping Variant', () => {
};

it('renders the span hashes for performance issues from event data', () => {
render(
<GroupingVariant
showGroupingConfig={false}
variant={performanceIssueVariant}
event={event}
/>
);
render(<GroupingVariant variant={performanceIssueVariant} event={event} />);

expect(
within(screen.getByText('Parent Span Hashes').closest('tr') as HTMLElement)
Expand All @@ -78,13 +72,7 @@ describe('Grouping Variant', () => {
});

it('renders grouping details for occurrence-backed performance issues', () => {
render(
<GroupingVariant
showGroupingConfig={false}
variant={performanceIssueVariant}
event={occurrenceEvent}
/>
);
render(<GroupingVariant variant={performanceIssueVariant} event={occurrenceEvent} />);

expect(
within(screen.getByText('Parent Span Hashes').closest('tr') as HTMLElement)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import {hasNonContributingComponent} from './utils';

type Props = {
event: Event;
showGroupingConfig: boolean;
variant: EventGroupVariant;
};

Expand Down Expand Up @@ -73,7 +72,7 @@ class GroupVariant extends Component<Props, State> {
};

getVariantData(): [VariantData, EventGroupComponent | undefined] {
const {event, variant, showGroupingConfig} = this.props;
const {event, variant} = this.props;
const data: VariantData = [];
let component: EventGroupComponent | undefined;

Expand Down Expand Up @@ -118,9 +117,6 @@ class GroupVariant extends Component<Props, State> {
/>
</TextWithQuestionTooltip>,
]);
if (showGroupingConfig && variant.config?.id) {
data.push([t('Grouping Config'), variant.config.id]);
}
break;
case EventGroupVariantType.CUSTOM_FINGERPRINT:
data.push([
Expand Down Expand Up @@ -168,9 +164,6 @@ class GroupVariant extends Component<Props, State> {
</TextWithQuestionTooltip>,
]);
addFingerprintInfo(data, variant);
if (showGroupingConfig && variant.config?.id) {
data.push([t('Grouping Config'), variant.config.id]);
}
break;
case EventGroupVariantType.PERFORMANCE_PROBLEM:
const spansToHashes = Object.fromEntries(
Expand Down
40 changes: 0 additions & 40 deletions static/app/components/events/groupingInfo/index.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ describe('EventGroupingInfo', function () {
const defaultProps = {
event,
projectSlug: 'project-slug',
showGroupingConfig: false,
group,
};

Expand Down Expand Up @@ -69,43 +68,4 @@ describe('EventGroupingInfo', function () {
// Should not make grouping-info request
expect(groupingInfoRequest).not.toHaveBeenCalled();
});

it('can switch grouping configs', async function () {
MockApiClient.addMockResponse({
url: `/organizations/org-slug/grouping-configs/`,
body: [
{id: 'default:XXXX', hidden: false},
{id: 'new:XXXX', hidden: false},
],
});

render(<EventGroupingInfo {...defaultProps} showGroupingConfig />);

await userEvent.click(screen.getByRole('button', {name: 'Show Details'}));

// Should show first hash
await screen.findByText('123');

expect(screen.getByText('default:XXXX')).toBeInTheDocument();

MockApiClient.addMockResponse({
url: `/projects/org-slug/project-slug/events/${event.id}/grouping-info/`,
query: {config: 'new:XXXX'},
body: {
app: {
description: 'variant description',
hash: '789',
hashMismatch: false,
key: 'key',
type: EventGroupVariantType.CHECKSUM,
},
},
});

await userEvent.click(screen.getAllByRole('button', {name: 'default:XXXX'})[0]);
await userEvent.click(screen.getByRole('option', {name: 'new:XXXX'}));

// Should show new hash
await screen.findByText('789');
});
});
59 changes: 5 additions & 54 deletions static/app/components/events/groupingInfo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {useApiQuery} from 'sentry/utils/queryClient';
import useOrganization from 'sentry/utils/useOrganization';
import SectionToggleButton from 'sentry/views/issueDetails/sectionToggleButton';

import GroupingConfigSelect from './groupingConfigSelect';
import GroupVariant from './groupingVariant';

const groupingFeedbackTypes = [
Expand All @@ -26,7 +25,6 @@ const groupingFeedbackTypes = [
type GroupingInfoProps = {
event: Event;
projectSlug: string;
showGroupingConfig: boolean;
group?: Group;
};

Expand Down Expand Up @@ -70,30 +68,6 @@ function generatePerformanceGroupInfo({
: null;
}

function GroupConfigSelect({
event,
configOverride,
setConfigOverride,
}: {
configOverride: string | null;
event: Event;
setConfigOverride: (value: string) => void;
}) {
if (!event.groupingConfig) {
return null;
}

const configId = configOverride ?? event.groupingConfig?.id;

return (
<GroupingConfigSelect
eventConfigId={event.groupingConfig.id}
configId={configId}
onSelect={selection => setConfigOverride(selection.value)}
/>
);
}

function GroupInfoSummary({groupInfo}: {groupInfo: EventGroupingInfoResponse | null}) {
const groupedBy = groupInfo
? Object.values(groupInfo)
Expand All @@ -110,26 +84,17 @@ function GroupInfoSummary({groupInfo}: {groupInfo: EventGroupingInfoResponse | n
);
}

export function EventGroupingInfo({
event,
projectSlug,
showGroupingConfig,
group,
}: GroupingInfoProps) {
export function EventGroupingInfo({event, projectSlug, group}: GroupingInfoProps) {
const organization = useOrganization();
const [isOpen, setIsOpen] = useState(false);
const [configOverride, setConfigOverride] = useState<string | null>(null);

const hasPerformanceGrouping =
event.occurrence &&
group?.issueCategory === IssueCategory.PERFORMANCE &&
event.type === 'transaction';

const {data, isLoading, isError, isSuccess} = useApiQuery<EventGroupingInfoResponse>(
[
`/projects/${organization.slug}/${projectSlug}/events/${event.id}/grouping-info/`,
{query: configOverride ? {config: configOverride} : {}},
],
[`/projects/${organization.slug}/${projectSlug}/events/${event.id}/grouping-info/`],
{enabled: !hasPerformanceGrouping, staleTime: Infinity}
);

Expand Down Expand Up @@ -157,19 +122,10 @@ export function EventGroupingInfo({
{isOpen ? (
<Fragment>
<ConfigHeader>
<div>
{showGroupingConfig && (
<GroupConfigSelect
event={event}
configOverride={configOverride}
setConfigOverride={setConfigOverride}
/>
)}
</div>
<FeatureFeedback
featureName="grouping"
feedbackTypes={groupingFeedbackTypes}
buttonProps={{size: 'sm'}}
buttonProps={{size: 'xs'}}
/>
</ConfigHeader>
{isError ? (
Expand All @@ -179,11 +135,7 @@ export function EventGroupingInfo({
{hasPerformanceGrouping || isSuccess
? variants.map((variant, index) => (
<Fragment key={variant.key}>
<GroupVariant
event={event}
variant={variant}
showGroupingConfig={showGroupingConfig}
/>
<GroupVariant event={event} variant={variant} />
{index < variants.length - 1 && <VariantDivider />}
</Fragment>
))
Expand All @@ -196,8 +148,7 @@ export function EventGroupingInfo({

const ConfigHeader = styled('div')`
display: flex;
align-items: center;
justify-content: space-between;
justify-content: flex-end;
gap: ${space(1)};
margin-bottom: ${space(2)};
`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,15 +285,7 @@ function DefaultGroupEventDetailsContent({
<EventAttachments event={event} projectSlug={project.slug} />
<EventSdk sdk={event.sdk} meta={event._meta?.sdk} />
{event.groupID && (
<EventGroupingInfo
projectSlug={project.slug}
event={event}
showGroupingConfig={
organization.features.includes('set-grouping-config') &&
'groupingConfig' in event
}
group={group}
/>
<EventGroupingInfo projectSlug={project.slug} event={event} group={group} />
)}

{!hasReplay && (
Expand Down

0 comments on commit 5b57ac3

Please sign in to comment.