Skip to content

Commit 5d898de

Browse files
aliu39andrewshie-sentry
authored andcommitted
ref(tags/flags): change issue tags route to /distributions/ (#88062)
Now that feature flags are included in the tags drawer of streamlined UI, we're deciding to change the route path to /distributions/. Since the new/old views share routes, this will have to be done for the old UI too (tags tab). Also adds redirects from the previous /tags/ and /tags/:tagKey route. Implementation: renames the `Tab.TAGS` enum to `Tab.DISTRIBUTIONS` and updates the `TabPaths` entry. I've added a comment explaining this tab is renamed from tags. "tags" is not in the name because all the other paths = enum name, and "tags-and-flags-distributions/", for example, seems too long for a URL.
1 parent cce1c35 commit 5d898de

File tree

16 files changed

+53
-29
lines changed

16 files changed

+53
-29
lines changed

fixtures/page_objects/issue_details.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def visit_issue_in_environment(self, org, groupid, environment):
2525
self.browser.wait_until(".group-detail")
2626

2727
def visit_tag_values(self, org, groupid, tag):
28-
self.browser.get(f"/organizations/{org}/issues/{groupid}/tags/{tag}/")
28+
self.browser.get(f"/organizations/{org}/issues/{groupid}/distributions/{tag}/")
2929
self.browser.wait_until('[data-test-id="group-tag-value"]')
3030

3131
def get_environment(self):

static/app/components/events/eventTags/eventTagsTreeRow.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import useCopyToClipboard from 'sentry/utils/useCopyToClipboard';
2424
import {useLocation} from 'sentry/utils/useLocation';
2525
import useMutateProject from 'sentry/utils/useMutateProject';
2626
import useOrganization from 'sentry/utils/useOrganization';
27+
import {Tab, TabPaths} from 'sentry/views/issueDetails/types';
2728
import {traceAnalytics} from 'sentry/views/performance/newTraceDetails/traceAnalytics';
2829
import {
2930
getSearchInExploreTarget,
@@ -163,7 +164,7 @@ function EventTagsTreeRowDropdown({
163164
key: 'tag-details',
164165
label: t('Tag breakdown'),
165166
to: {
166-
pathname: `/organizations/${organization.slug}/issues/${event.groupID}/tags/${encodeURIComponent(originalTag.key)}/`,
167+
pathname: `/organizations/${organization.slug}/issues/${event.groupID}/${TabPaths[Tab.DISTRIBUTIONS]}${encodeURIComponent(originalTag.key)}/`,
167168
query: location.query,
168169
},
169170
},

static/app/routes.tsx

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2068,11 +2068,11 @@ function buildRoutes() {
20682068
component={make(() => import('sentry/views/issueDetails/groupCheckIns'))}
20692069
/>
20702070
<Route
2071-
path={TabPaths[Tab.TAGS]}
2071+
path={TabPaths[Tab.DISTRIBUTIONS]}
20722072
component={make(() => import('sentry/views/issueDetails/groupTags/groupTagsTab'))}
20732073
/>
20742074
<Route
2075-
path={`${TabPaths[Tab.TAGS]}:tagKey/`}
2075+
path={`${TabPaths[Tab.DISTRIBUTIONS]}:tagKey/`}
20762076
component={make(() => import('sentry/views/issueDetails/groupTagValues'))}
20772077
/>
20782078
<Route
@@ -2110,6 +2110,25 @@ function buildRoutes() {
21102110
/>
21112111
<Route path="views/:viewId/" component={errorHandler(OverviewWrapper)} />
21122112
<Route path="searches/:searchId/" component={errorHandler(OverviewWrapper)} />
2113+
2114+
{/* Redirects for legacy tags route. */}
2115+
<Redirect
2116+
from=":groupId/tags/"
2117+
to={`/issues/:groupId/${TabPaths[Tab.DISTRIBUTIONS]}`}
2118+
/>
2119+
<Redirect
2120+
from=":groupId/tags/:tagKey/"
2121+
to={`/issues/:groupId/${TabPaths[Tab.DISTRIBUTIONS]}:tagKey/`}
2122+
/>
2123+
<Redirect
2124+
from={`:groupId/${TabPaths[Tab.EVENTS]}:eventId/tags/`}
2125+
to={`/issues/:groupId/${TabPaths[Tab.EVENTS]}:eventId/${TabPaths[Tab.DISTRIBUTIONS]}`}
2126+
/>
2127+
<Redirect
2128+
from={`:groupId/${TabPaths[Tab.EVENTS]}:eventId/tags/:tagKey/`}
2129+
to={`/issues/:groupId/${TabPaths[Tab.EVENTS]}:eventId/${TabPaths[Tab.DISTRIBUTIONS]}:tagKey/`}
2130+
/>
2131+
21132132
<Route
21142133
path=":groupId/"
21152134
component={make(() => import('sentry/views/issueDetails/groupDetails'))}

static/app/views/issueDetails/groupDetails.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@ function GroupDetailsContent({
665665
return;
666666
}
667667

668-
if (currentTab === Tab.TAGS) {
668+
if (currentTab === Tab.DISTRIBUTIONS) {
669669
openTagsDrawer();
670670
} else if (currentTab === Tab.SIMILAR_ISSUES) {
671671
openSimilarIssuesDrawer();
@@ -688,7 +688,7 @@ function GroupDetailsContent({
688688

689689
const isDisplayingEventDetails = [
690690
Tab.DETAILS,
691-
Tab.TAGS,
691+
Tab.DISTRIBUTIONS,
692692
Tab.SIMILAR_ISSUES,
693693
Tab.MERGED,
694694
Tab.ACTIVITY,

static/app/views/issueDetails/groupFeatureFlags/flagDetailsDrawerContent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export function FlagDetailsDrawerContent() {
7676
<LinkButton
7777
size="sm"
7878
to={{
79-
pathname: `${baseUrl}${TabPaths[Tab.TAGS]}`,
79+
pathname: `${baseUrl}${TabPaths[Tab.DISTRIBUTIONS]}`,
8080
query: {...location.query, tab: DrawerTab.FEATURE_FLAGS},
8181
}}
8282
>

static/app/views/issueDetails/groupTagValues.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import {useParams} from 'sentry/utils/useParams';
3333
import useProjectFromSlug from 'sentry/utils/useProjectFromSlug';
3434
import {hasDatasetSelector} from 'sentry/views/dashboards/utils';
3535
import GroupEventDetails from 'sentry/views/issueDetails/groupEventDetails/groupEventDetails';
36+
import {Tab, TabPaths} from 'sentry/views/issueDetails/types';
3637
import {useGroup} from 'sentry/views/issueDetails/useGroup';
3738
import {useGroupDetailsRoute} from 'sentry/views/issueDetails/useGroupDetailsRoute';
3839
import {
@@ -297,7 +298,7 @@ export function GroupTagValues() {
297298
<LinkButton
298299
size="sm"
299300
priority="default"
300-
href={`/${orgId}/${group.project.slug}/issues/${group.id}/tags/${tagKey}/export/`}
301+
href={`/${orgId}/${group.project.slug}/issues/${group.id}/${TabPaths[Tab.DISTRIBUTIONS]}${tagKey}/export/`}
301302
>
302303
{t('Export Page to CSV')}
303304
</LinkButton>

static/app/views/issueDetails/groupTags/groupTagsDrawer.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export function GroupTagsDrawer({
123123
// TODO(issues): Dropdown menu doesn't support hrefs yet
124124
onAction: () => {
125125
window.open(
126-
`/${organization.slug}/${project.slug}/issues/${group.id}/tags/${tagKey}/export/`,
126+
`/${organization.slug}/${project.slug}/issues/${group.id}/${TabPaths[Tab.DISTRIBUTIONS]}${tagKey}/export/`,
127127
'_blank'
128128
);
129129
},
@@ -200,7 +200,7 @@ export function GroupTagsDrawer({
200200
label: t('All Tags'),
201201
to: tagKey
202202
? {
203-
pathname: `${baseUrl}${TabPaths[Tab.TAGS]}`,
203+
pathname: `${baseUrl}${TabPaths[Tab.DISTRIBUTIONS]}`,
204204
query: {...location.query, tab: DrawerTab.TAGS},
205205
}
206206
: undefined,
@@ -209,7 +209,7 @@ export function GroupTagsDrawer({
209209
label: t('All Feature Flags'),
210210
to: tagKey
211211
? {
212-
pathname: `${baseUrl}${TabPaths[Tab.TAGS]}`,
212+
pathname: `${baseUrl}${TabPaths[Tab.DISTRIBUTIONS]}`,
213213
query: {...location.query, tab: DrawerTab.FEATURE_FLAGS},
214214
}
215215
: undefined,

static/app/views/issueDetails/groupTags/groupTagsTab.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {useLocation} from 'sentry/utils/useLocation';
2121
import {useParams} from 'sentry/utils/useParams';
2222
import GroupEventDetails from 'sentry/views/issueDetails/groupEventDetails/groupEventDetails';
2323
import {useGroupTags} from 'sentry/views/issueDetails/groupTags/useGroupTags';
24+
import {Tab, TabPaths} from 'sentry/views/issueDetails/types';
2425
import {useGroup} from 'sentry/views/issueDetails/useGroup';
2526
import {useGroupDetailsRoute} from 'sentry/views/issueDetails/useGroupDetailsRoute';
2627
import {
@@ -75,7 +76,7 @@ export function GroupTagsTab() {
7576

7677
const getTagKeyTarget = (tag: SimpleTag) => {
7778
return {
78-
pathname: `${baseUrl}tags/${tag.key}/`,
79+
pathname: `${baseUrl}${TabPaths[Tab.DISTRIBUTIONS]}/${tag.key}/`,
7980
query: extractSelectionParameters(location.query),
8081
};
8182
};

static/app/views/issueDetails/groupTags/useGroupTagsDrawer.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import type {Group} from 'sentry/types/group';
66
import {useLocation} from 'sentry/utils/useLocation';
77
import {useNavigate} from 'sentry/utils/useNavigate';
88
import {GroupTagsDrawer} from 'sentry/views/issueDetails/groupTags/groupTagsDrawer';
9+
import {Tab, TabPaths} from 'sentry/views/issueDetails/types';
910
import {useGroupDetailsRoute} from 'sentry/views/issueDetails/useGroupDetailsRoute';
1011

1112
export function useGroupTagsDrawer({
@@ -42,7 +43,7 @@ export function useGroupTagsDrawer({
4243
);
4344
},
4445
shouldCloseOnLocationChange: newLocation => {
45-
return !newLocation.pathname.includes('/tags/');
46+
return !newLocation.pathname.includes(`/${TabPaths[Tab.DISTRIBUTIONS]}`);
4647
},
4748
}
4849
);

static/app/views/issueDetails/header.spec.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ describe('GroupHeader', () => {
8787

8888
await userEvent.click(screen.getByRole('tab', {name: /tags/i}));
8989
expect(router.push).toHaveBeenCalledWith({
90-
pathname: 'BASE_URL/tags/',
90+
pathname: 'BASE_URL/distributions/',
9191
query: {},
9292
});
9393

@@ -206,7 +206,7 @@ describe('GroupHeader', () => {
206206

207207
await userEvent.click(screen.getByRole('tab', {name: /tags/i}));
208208
expect(router.push).toHaveBeenCalledWith({
209-
pathname: 'BASE_URL/tags/',
209+
pathname: 'BASE_URL/distributions/',
210210
query: {},
211211
});
212212

0 commit comments

Comments
 (0)