Skip to content

Commit 08d3d1d

Browse files
gggritsoclaude
andauthored
feat(navigation): Hide Insights sidebar behind feature flag (#112965)
Hide the "Insights" entry from the primary sidebar and secondary navigation menu, gated behind the `insights-to-dashboards-ui-rollout` feature flag. Part of the Insights → Dashboards UI migration. When the flag is enabled, the Insights primary nav link is not rendered and the secondary navigation returns `null` (matching the existing `prevent` pattern). It's a _touch_ janky because landing on a `/insights/` URL shows a blank secondary menu, but we're about to add redirects anyway, so the `/insights/` URLs won't even exist Closes DAIN-1213 Co-authored-by: Claude <noreply@anthropic.com>
1 parent d164379 commit 08d3d1d

File tree

3 files changed

+55
-27
lines changed

3 files changed

+55
-27
lines changed

static/app/views/navigation/index.desktop.spec.tsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,27 @@ describe('desktop navigation', () => {
211211
expect(links[5]).toHaveAttribute('href', '/settings/org-slug/');
212212
});
213213

214+
it('hides Insights nav item when insights-to-dashboards-ui-rollout is enabled', () => {
215+
render(
216+
<PrimaryNavigationContextProvider>
217+
<Navigation />
218+
</PrimaryNavigationContextProvider>,
219+
navigationContext({
220+
organization: {
221+
features: [...ALL_AVAILABLE_FEATURES, 'insights-to-dashboards-ui-rollout'],
222+
},
223+
})
224+
);
225+
226+
const primaryNav = screen.getByRole('navigation', {name: 'Primary Navigation'});
227+
const links = within(primaryNav).getAllByRole('link');
228+
const linkNames = links.map(
229+
link => link.getAttribute('aria-label') ?? link.textContent
230+
);
231+
232+
expect(linkNames).not.toContain('Insights');
233+
});
234+
214235
it('primary navigation marks exactly one link as active for the current route', () => {
215236
render(
216237
<PrimaryNavigationContextProvider>

static/app/views/navigation/navigation.tsx

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -226,33 +226,35 @@ export function PrimaryNavigationItems({listRef}: PrimaryNavigationItemsProps) {
226226
</NavigationTourElement>
227227
</Feature>
228228

229-
<Feature features={['performance-view']}>
230-
<NavigationTourElement
231-
id={NavigationTour.INSIGHTS}
232-
title={null}
233-
description={null}
234-
>
235-
{tourProps => (
236-
<PrimaryNavigation.ListItem>
237-
<PrimaryNavigation.Link
238-
to={`/${prefix}/insights/`}
239-
analyticsKey="insights"
240-
label={t('Insights')}
241-
{...mergeProps(
242-
makeNavigationItemProps(
243-
'insights',
244-
`/${prefix}/insights/`,
245-
`/${prefix}/insights`
246-
),
247-
tourProps
248-
)}
249-
>
250-
<IconGraph type="area" />
251-
</PrimaryNavigation.Link>
252-
</PrimaryNavigation.ListItem>
253-
)}
254-
</NavigationTourElement>
255-
</Feature>
229+
{!organization.features.includes('insights-to-dashboards-ui-rollout') && (
230+
<Feature features={['performance-view']}>
231+
<NavigationTourElement
232+
id={NavigationTour.INSIGHTS}
233+
title={null}
234+
description={null}
235+
>
236+
{tourProps => (
237+
<PrimaryNavigation.ListItem>
238+
<PrimaryNavigation.Link
239+
to={`/${prefix}/insights/`}
240+
analyticsKey="insights"
241+
label={t('Insights')}
242+
{...mergeProps(
243+
makeNavigationItemProps(
244+
'insights',
245+
`/${prefix}/insights/`,
246+
`/${prefix}/insights`
247+
),
248+
tourProps
249+
)}
250+
>
251+
<IconGraph type="area" />
252+
</PrimaryNavigation.Link>
253+
</PrimaryNavigation.ListItem>
254+
)}
255+
</NavigationTourElement>
256+
</Feature>
257+
)}
256258

257259
{hasPageFrame ? null : (
258260
<PrimaryNavigation.ListItem padding="0 md">

static/app/views/navigation/secondary/content.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type {ReactNode} from 'react';
22

33
import {unreachable} from 'sentry/utils/unreachable';
4+
import {useOrganization} from 'sentry/utils/useOrganization';
45
import {usePrimaryNavigation} from 'sentry/views/navigation/primaryNavigationContext';
56
import {AdminSecondaryNavigation} from 'sentry/views/navigation/secondary/sections/admin/adminSecondaryNavigation';
67
import {DashboardsSecondaryNavigation} from 'sentry/views/navigation/secondary/sections/dashboards/dashboardsSecondaryNavigation';
@@ -13,10 +14,14 @@ import {SettingsSecondaryNavigation} from 'sentry/views/navigation/secondary/sec
1314

1415
export function SecondaryNavigationContent(): ReactNode {
1516
const {activeGroup} = usePrimaryNavigation();
17+
const organization = useOrganization();
1618
switch (activeGroup) {
1719
case 'issues':
1820
return <IssuesSecondaryNavigation />;
1921
case 'insights':
22+
if (organization.features.includes('insights-to-dashboards-ui-rollout')) {
23+
return null;
24+
}
2025
return <InsightsSecondaryNavigation />;
2126
case 'dashboards':
2227
return <DashboardsSecondaryNavigation />;

0 commit comments

Comments
 (0)