Skip to content

Commit 54a28c8

Browse files
DominikB2014andrewshie-sentry
authored andcommitted
ref(insights): remove insights-domin-view flag from sidebar (#81247)
This is part 2 of removing `insights-domain-view` flag (see #81241 for details) In this PR: 1. remove the usage of the flag in the sidebar 2. remove old routes and links to non domain view modules 3. some misc changes related to the the domain view flag being in the sidebar/routes
1 parent a2904a6 commit 54a28c8

File tree

5 files changed

+74
-497
lines changed

5 files changed

+74
-497
lines changed

static/app/components/nav/config.tsx

+39-91
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {openHelpSearchModal} from 'sentry/actionCreators/modal';
2-
import type {NavConfig, NavSidebarItem} from 'sentry/components/nav/utils';
2+
import type {NavConfig} from 'sentry/components/nav/utils';
33
import {
44
IconDashboard,
55
IconGraph,
@@ -15,26 +15,23 @@ import {t} from 'sentry/locale';
1515
import ConfigStore from 'sentry/stores/configStore';
1616
import type {Organization} from 'sentry/types/organization';
1717
import {getDiscoverLandingUrl} from 'sentry/utils/discover/urls';
18-
import {MODULE_BASE_URLS} from 'sentry/views/insights/common/utils/useModuleURL';
19-
import {MODULE_SIDEBAR_TITLE as MODULE_TITLE_HTTP} from 'sentry/views/insights/http/settings';
2018
import {
2119
AI_LANDING_SUB_PATH,
22-
AI_LANDING_TITLE,
20+
AI_SIDEBAR_LABEL,
2321
} from 'sentry/views/insights/pages/ai/settings';
2422
import {
2523
BACKEND_LANDING_SUB_PATH,
26-
BACKEND_LANDING_TITLE,
24+
BACKEND_SIDEBAR_LABEL,
2725
} from 'sentry/views/insights/pages/backend/settings';
2826
import {
2927
FRONTEND_LANDING_SUB_PATH,
30-
FRONTEND_LANDING_TITLE,
28+
FRONTEND_SIDEBAR_LABEL,
3129
} from 'sentry/views/insights/pages/frontend/settings';
3230
import {
3331
MOBILE_LANDING_SUB_PATH,
34-
MOBILE_LANDING_TITLE,
32+
MOBILE_SIDEBAR_LABEL,
3533
} from 'sentry/views/insights/pages/mobile/settings';
3634
import {DOMAIN_VIEW_BASE_URL} from 'sentry/views/insights/pages/settings';
37-
import {INSIGHTS_BASE_URL, MODULE_TITLES} from 'sentry/views/insights/settings';
3835
import {getSearchForIssueGroup, IssueGroup} from 'sentry/views/issueList/utils';
3936

4037
/**
@@ -45,88 +42,6 @@ import {getSearchForIssueGroup, IssueGroup} from 'sentry/views/issueList/utils';
4542
*/
4643
export function createNavConfig({organization}: {organization: Organization}): NavConfig {
4744
const prefix = `organizations/${organization.slug}`;
48-
const insightsPrefix = `${prefix}/${INSIGHTS_BASE_URL}`;
49-
const hasPerfDomainViews = organization.features.includes('insights-domain-view');
50-
51-
const insights: NavSidebarItem = {
52-
label: t('Insights'),
53-
icon: <IconGraph />,
54-
feature: {features: 'insights-entry-points'},
55-
analyticsKey: 'insights',
56-
submenu: [
57-
{
58-
label: MODULE_TITLE_HTTP,
59-
to: `/${insightsPrefix}/${MODULE_BASE_URLS.http}/`,
60-
},
61-
{label: MODULE_TITLES.db, to: `/${insightsPrefix}/${MODULE_BASE_URLS.db}/`},
62-
{
63-
label: MODULE_TITLES.resource,
64-
to: `/${insightsPrefix}/${MODULE_BASE_URLS.resource}/`,
65-
},
66-
{
67-
label: MODULE_TITLES.app_start,
68-
to: `/${insightsPrefix}/${MODULE_BASE_URLS.app_start}/`,
69-
},
70-
{
71-
label: MODULE_TITLES['mobile-screens'],
72-
to: `/${insightsPrefix}/${MODULE_BASE_URLS['mobile-screens']}/`,
73-
feature: {features: 'insights-mobile-screens-module'},
74-
},
75-
{
76-
label: MODULE_TITLES.vital,
77-
to: `/${insightsPrefix}/${MODULE_BASE_URLS.vital}/`,
78-
},
79-
{
80-
label: MODULE_TITLES.cache,
81-
to: `/${insightsPrefix}/${MODULE_BASE_URLS.cache}/`,
82-
},
83-
{
84-
label: MODULE_TITLES.queue,
85-
to: `/${insightsPrefix}/${MODULE_BASE_URLS.queue}/`,
86-
},
87-
{
88-
label: MODULE_TITLES.ai,
89-
to: `/${insightsPrefix}/${MODULE_BASE_URLS.ai}/`,
90-
feature: {features: 'insights-entry-points'},
91-
},
92-
],
93-
};
94-
95-
const perf: NavSidebarItem = {
96-
label: t('Perf.'),
97-
to: '/performance/',
98-
analyticsKey: 'performance',
99-
icon: <IconLightning />,
100-
feature: {
101-
features: 'performance-view',
102-
hookName: 'feature-disabled:performance-sidebar-item',
103-
},
104-
};
105-
106-
const perfDomainViews: NavSidebarItem = {
107-
label: t('Perf.'),
108-
icon: <IconLightning />,
109-
analyticsKey: 'insights-domains',
110-
feature: {features: ['insights-domain-view', 'performance-view']},
111-
submenu: [
112-
{
113-
label: FRONTEND_LANDING_TITLE,
114-
to: `/${prefix}/${DOMAIN_VIEW_BASE_URL}/${FRONTEND_LANDING_SUB_PATH}/`,
115-
},
116-
{
117-
label: BACKEND_LANDING_TITLE,
118-
to: `/${prefix}/${DOMAIN_VIEW_BASE_URL}/${BACKEND_LANDING_SUB_PATH}/`,
119-
},
120-
{
121-
label: AI_LANDING_TITLE,
122-
to: `/${prefix}/${DOMAIN_VIEW_BASE_URL}/${AI_LANDING_SUB_PATH}/`,
123-
},
124-
{
125-
label: MOBILE_LANDING_TITLE,
126-
to: `/${prefix}/${DOMAIN_VIEW_BASE_URL}/${MOBILE_LANDING_SUB_PATH}/`,
127-
},
128-
],
129-
};
13045

13146
return {
13247
main: [
@@ -208,7 +123,40 @@ export function createNavConfig({organization}: {organization: Organization}): N
208123
{label: t('Crons'), to: `/${prefix}/crons/`},
209124
],
210125
},
211-
...(hasPerfDomainViews ? [perfDomainViews, perf] : [insights, perf]),
126+
{
127+
label: t('Insights'),
128+
icon: <IconGraph />,
129+
analyticsKey: 'insights-domains',
130+
feature: {features: ['performance-view']},
131+
submenu: [
132+
{
133+
label: FRONTEND_SIDEBAR_LABEL,
134+
to: `/${prefix}/${DOMAIN_VIEW_BASE_URL}/${FRONTEND_LANDING_SUB_PATH}/`,
135+
},
136+
{
137+
label: BACKEND_SIDEBAR_LABEL,
138+
to: `/${prefix}/${DOMAIN_VIEW_BASE_URL}/${BACKEND_LANDING_SUB_PATH}/`,
139+
},
140+
{
141+
label: MOBILE_SIDEBAR_LABEL,
142+
to: `/${prefix}/${DOMAIN_VIEW_BASE_URL}/${MOBILE_LANDING_SUB_PATH}/`,
143+
},
144+
{
145+
label: AI_SIDEBAR_LABEL,
146+
to: `/${prefix}/${DOMAIN_VIEW_BASE_URL}/${AI_LANDING_SUB_PATH}/`,
147+
},
148+
],
149+
},
150+
{
151+
label: t('Perf.'),
152+
to: '/performance/',
153+
analyticsKey: 'performance',
154+
icon: <IconLightning />,
155+
feature: {
156+
features: 'performance-view',
157+
hookName: 'feature-disabled:performance-sidebar-item',
158+
},
159+
},
212160
{
213161
label: t('Boards'),
214162
analyticsKey: 'customizable-dashboards',

static/app/components/nav/index.spec.tsx

+5-12
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,9 @@ describe('Nav', function () {
107107
beforeEach(() => {
108108
render(<Nav />, {
109109
router: RouterFixture({
110-
location: LocationFixture({pathname: '/organizations/org-slug/insights/http/'}),
110+
location: LocationFixture({
111+
pathname: '/organizations/org-slug/insights/backend/',
112+
}),
111113
}),
112114
organization: OrganizationFixture({features: ALL_AVAILABLE_FEATURES}),
113115
});
@@ -122,17 +124,8 @@ describe('Nav', function () {
122124
it('includes expected submenu items', function () {
123125
const container = screen.getByRole('navigation', {name: 'Secondary Navigation'});
124126
const links = getAllByRole(container, 'link');
125-
expect(links).toHaveLength(8);
126-
[
127-
'Requests',
128-
'Queries',
129-
'Assets',
130-
'App Starts',
131-
'Web Vitals',
132-
'Caches',
133-
'Queues',
134-
'LLM Monitoring',
135-
].forEach((title, index) => {
127+
expect(links).toHaveLength(4);
128+
['Frontend', 'Backend', 'Mobile', 'AI'].forEach((title, index) => {
136129
expect(links[index]).toHaveAccessibleName(title);
137130
});
138131
});

static/app/components/sidebar/index.spec.tsx

+11-32
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ describe('Sidebar', function () {
369369
});
370370

371371
const links = screen.getAllByRole('link');
372-
expect(links).toHaveLength(31);
372+
expect(links).toHaveLength(25);
373373

374374
[
375375
'Issues',
@@ -381,16 +381,10 @@ describe('Sidebar', function () {
381381
'Replays',
382382
'Discover',
383383
/Insights/,
384-
'Requests',
385-
'Queries',
386-
'Assets',
387-
'App Starts',
388-
'Screen Loads',
389-
'Web Vitals',
390-
/Caches/,
391-
/Queues/,
392-
/Mobile UI/,
393-
/LLM Monitoring/,
384+
'Frontend',
385+
'Backend',
386+
'Mobile',
387+
'AI',
394388
'Performance',
395389
'User Feedback',
396390
'Crons',
@@ -407,35 +401,20 @@ describe('Sidebar', function () {
407401
});
408402
});
409403

410-
it('mobile screens module hides all other mobile modules', async function () {
411-
localStorage.setItem('sidebar-accordion-insights:expanded', 'true');
412-
renderSidebarWithFeatures([
413-
'insights-entry-points',
414-
'starfish-mobile-ui-module',
415-
'insights-mobile-screens-module',
416-
]);
417-
418-
await waitFor(function () {
419-
expect(apiMocks.broadcasts).toHaveBeenCalled();
420-
});
421-
422-
['App Starts', 'Screen Loads', /Mobile UI/].forEach(title => {
423-
expect(screen.queryByText(title)).not.toBeInTheDocument();
424-
});
425-
426-
expect(screen.getByText(/Mobile Screens/)).toBeInTheDocument();
427-
});
428-
429404
it('should not render floating accordion when expanded', async () => {
430405
renderSidebarWithFeatures(ALL_AVAILABLE_FEATURES);
431-
await userEvent.click(screen.getByTestId('sidebar-accordion-insights-item'));
406+
await userEvent.click(
407+
screen.getByTestId('sidebar-accordion-insights-domains-item')
408+
);
432409
expect(screen.queryByTestId('floating-accordion')).not.toBeInTheDocument();
433410
});
434411

435412
it('should render floating accordion when collapsed', async () => {
436413
renderSidebarWithFeatures(ALL_AVAILABLE_FEATURES);
437414
await userEvent.click(screen.getByTestId('sidebar-collapse'));
438-
await userEvent.click(screen.getByTestId('sidebar-accordion-insights-item'));
415+
await userEvent.click(
416+
screen.getByTestId('sidebar-accordion-insights-domains-item')
417+
);
439418
expect(await screen.findByTestId('floating-accordion')).toBeInTheDocument();
440419
});
441420
});

0 commit comments

Comments
 (0)