-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(nav): Move stats to settings #84804
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,7 @@ import {IssueNavigation} from 'sentry/views/issues/navigation'; | |
import OrganizationContainer from 'sentry/views/organizationContainer'; | ||
import OrganizationLayout from 'sentry/views/organizationLayout'; | ||
import OrganizationRoot from 'sentry/views/organizationRoot'; | ||
import {OrganizationStatsWrapper} from 'sentry/views/organizationStats/organizationStatsWrapper'; | ||
import ProjectEventRedirect from 'sentry/views/projectEventRedirect'; | ||
import redirectDeprecatedProjectRoute from 'sentry/views/projects/redirectDeprecatedProjectRoute'; | ||
import RouteNotFound from 'sentry/views/routeNotFound'; | ||
|
@@ -695,6 +696,39 @@ function buildRoutes() { | |
</Route> | ||
); | ||
|
||
const statsChildRoutes = ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Refactor so that we can use the statsChildRoutes in two places |
||
<Fragment> | ||
<IndexRoute component={make(() => import('sentry/views/organizationStats'))} /> | ||
<Route | ||
component={make(() => import('sentry/views/organizationStats/teamInsights'))} | ||
> | ||
<Route | ||
path="issues/" | ||
component={make( | ||
() => import('sentry/views/organizationStats/teamInsights/issues') | ||
)} | ||
/> | ||
<Route | ||
path="health/" | ||
component={make( | ||
() => import('sentry/views/organizationStats/teamInsights/health') | ||
)} | ||
/> | ||
</Route> | ||
</Fragment> | ||
); | ||
const statsRoutes = ( | ||
<Fragment> | ||
<Route path="/stats/" withOrgPath component={OrganizationStatsWrapper}> | ||
{statsChildRoutes} | ||
</Route> | ||
<Redirect | ||
from="/organizations/:orgId/stats/team/" | ||
to="/organizations/:orgId/stats/issues/" | ||
/> | ||
</Fragment> | ||
); | ||
|
||
const orgSettingsRoutes = ( | ||
<Route | ||
component={make( | ||
|
@@ -998,6 +1032,9 @@ function buildRoutes() { | |
)} | ||
/> | ||
</Route> | ||
<Route path="stats/" name={t('Stats')}> | ||
{statsChildRoutes} | ||
</Route> | ||
</Route> | ||
); | ||
|
||
|
@@ -1485,34 +1522,6 @@ function buildRoutes() { | |
</Fragment> | ||
); | ||
|
||
const statsRoutes = ( | ||
<Fragment> | ||
<Route path="/stats/" withOrgPath> | ||
<IndexRoute component={make(() => import('sentry/views/organizationStats'))} /> | ||
<Route | ||
component={make(() => import('sentry/views/organizationStats/teamInsights'))} | ||
> | ||
<Route | ||
path="issues/" | ||
component={make( | ||
() => import('sentry/views/organizationStats/teamInsights/issues') | ||
)} | ||
/> | ||
<Route | ||
path="health/" | ||
component={make( | ||
() => import('sentry/views/organizationStats/teamInsights/health') | ||
)} | ||
/> | ||
</Route> | ||
</Route> | ||
<Redirect | ||
from="/organizations/:orgId/stats/team/" | ||
to="/organizations/:orgId/stats/issues/" | ||
/> | ||
</Fragment> | ||
); | ||
|
||
const discoverChildRoutes = ( | ||
<Fragment> | ||
<IndexRedirect to="queries/" /> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. New wrapper for stats routes to provide redirect from |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import {useRedirectNavV2Routes} from 'sentry/components/nav/useRedirectNavV2Routes'; | ||
import Redirect from 'sentry/components/redirect'; | ||
|
||
type OrganizationStatsWrapperProps = { | ||
children: React.ReactNode; | ||
}; | ||
|
||
// Wraps all routes under /stats/ to redirect to /settings/stats/ | ||
// Can be removed once navigation-sidebar-v2 is fully launched | ||
export function OrganizationStatsWrapper({children}: OrganizationStatsWrapperProps) { | ||
const redirectPath = useRedirectNavV2Routes({ | ||
oldPathPrefix: '/stats/', | ||
newPathPrefix: '/settings/stats/', | ||
}); | ||
|
||
if (redirectPath) { | ||
return <Redirect to={redirectPath} />; | ||
} | ||
|
||
return children; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -126,6 +126,14 @@ const organizationNavigation: NavigationSection[] = [ | |
show: ({organization}) => | ||
!!organization && organization.features.includes('feature-flag-ui'), | ||
}, | ||
{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adds stats item in settings menu (feature flagged) |
||
path: `${organizationSettingsPathPrefix}/stats/`, | ||
title: t('Stats & Usage'), | ||
description: t('View organization stats and usage'), | ||
id: 'stats', | ||
show: ({organization}) => | ||
organization?.features.includes('navigation-sidebar-v2') ?? false, | ||
}, | ||
], | ||
}, | ||
{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removes stats in new nav component