Skip to content

Commit

Permalink
add drawer open to more places, project slug
Browse files Browse the repository at this point in the history
  • Loading branch information
scttcper committed Sep 20, 2024
1 parent 7fa0b52 commit cbdf9b9
Show file tree
Hide file tree
Showing 7 changed files with 413 additions and 320 deletions.
17 changes: 16 additions & 1 deletion static/app/components/events/eventTagsAndScreenshot/tags.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {forwardRef, useCallback, useMemo, useState} from 'react';
import {forwardRef, useCallback, useMemo, useRef, useState} from 'react';
import styled from '@emotion/styled';

import {Button} from 'sentry/components/button';
import ButtonBar from 'sentry/components/buttonBar';
import {
getSentryDefaultTags,
Expand All @@ -14,8 +15,10 @@ import {t, tct} from 'sentry/locale';
import {space} from 'sentry/styles/space';
import type {Event} from 'sentry/types/event';
import type {Project} from 'sentry/types/project';
import {useGroupTagsDrawer} from 'sentry/views/issueDetails/groupTags/groupTagsDrawer';
import {SectionKey} from 'sentry/views/issueDetails/streamline/context';
import {InterimSection} from 'sentry/views/issueDetails/streamline/interimSection';
import {useHasStreamlinedUI} from 'sentry/views/issueDetails/utils';

import {EventTags} from '../eventTags';

Expand All @@ -27,6 +30,13 @@ type Props = {
export const EventTagsDataSection = forwardRef<HTMLElement, Props>(
function EventTagsDataSection({event, projectSlug}: Props, ref) {
const sentryTags = getSentryDefaultTags();
const hasStreamlinedUI = useHasStreamlinedUI();
const openButtonRef = useRef<HTMLButtonElement>(null);
const {openTagsDrawer} = useGroupTagsDrawer({
projectSlug: projectSlug,
groupId: event.groupID!,
openButtonRef: openButtonRef,
});

const [tagFilter, setTagFilter] = useState<TagFilter>(TagFilter.ALL);
const handleTagFilterChange = useCallback((value: TagFilter) => {
Expand All @@ -51,6 +61,11 @@ export const EventTagsDataSection = forwardRef<HTMLElement, Props>(

const actions = (
<ButtonBar gap={1}>
{hasStreamlinedUI && (
<Button onClick={openTagsDrawer} size="xs">
{t('View All Issue Tags')}
</Button>
)}
<SegmentedControl
size="xs"
aria-label={t('Filter tags')}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {EventFixture} from 'sentry-fixture/event';
import {GroupFixture} from 'sentry-fixture/group';
import {OrganizationFixture} from 'sentry-fixture/organization';
import {ProjectFixture} from 'sentry-fixture/project';

Expand All @@ -16,6 +17,7 @@ import * as analytics from 'sentry/utils/analytics';
describe('HighlightsDataSection', function () {
const organization = OrganizationFixture();
const project = ProjectFixture();
const group = GroupFixture();
const event = EventFixture({
contexts: TEST_EVENT_CONTEXTS,
tags: TEST_EVENT_TAGS,
Expand Down Expand Up @@ -53,6 +55,7 @@ describe('HighlightsDataSection', function () {
event={event}
project={project}
viewAllRef={{current: null}}
groupId={group.id}
/>,
{organization}
);
Expand Down Expand Up @@ -87,7 +90,7 @@ describe('HighlightsDataSection', function () {
body: {},
});

render(<HighlightsDataSection event={event} project={project} />, {
render(<HighlightsDataSection event={event} project={project} groupId={group.id} />, {
organization,
});
expect(screen.getByText('Event Highlights')).toBeInTheDocument();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,11 @@ export default function HighlightsDataSection({
const organization = useOrganization();
const hasStreamlinedUI = useHasStreamlinedUI();
const openButtonRef = useRef<HTMLButtonElement>(null);
const {openTagsDrawer} = useGroupTagsDrawer({groupId, openButtonRef, project});
const {openTagsDrawer} = useGroupTagsDrawer({
groupId,
openButtonRef,
projectSlug: project.slug,
});

const viewAllButton = hasStreamlinedUI ? (
// Streamline details ui has "Jump to" feature, instead we'll show the drawer button
Expand Down
Loading

0 comments on commit cbdf9b9

Please sign in to comment.