routes.tsx 71 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247
  1. import {Fragment, lazy} from 'react';
  2. import {IndexRedirect, Redirect} from 'react-router';
  3. import memoize from 'lodash/memoize';
  4. import LazyLoad from 'sentry/components/lazyLoad';
  5. import {EXPERIMENTAL_SPA, USING_CUSTOMER_DOMAIN} from 'sentry/constants';
  6. import {t} from 'sentry/locale';
  7. import HookStore from 'sentry/stores/hookStore';
  8. import type {HookName} from 'sentry/types/hooks';
  9. import errorHandler from 'sentry/utils/errorHandler';
  10. import retryableImport from 'sentry/utils/retryableImport';
  11. import withDomainRedirect from 'sentry/utils/withDomainRedirect';
  12. import withDomainRequired from 'sentry/utils/withDomainRequired';
  13. import App from 'sentry/views/app';
  14. import AuthLayout from 'sentry/views/auth/layout';
  15. import {Tab, TabPaths} from 'sentry/views/issueDetails/types';
  16. import IssueListContainer from 'sentry/views/issueList';
  17. import IssueListOverview from 'sentry/views/issueList/overview';
  18. import OrganizationContainer from 'sentry/views/organizationContainer';
  19. import OrganizationLayout from 'sentry/views/organizationLayout';
  20. import OrganizationRoot from 'sentry/views/organizationRoot';
  21. import {PERFORMANCE_BASE_URL as PERFORMANCE_RESOURCE_BASE_URL} from 'sentry/views/performance/browser/resources/settings';
  22. import {MODULE_BASE_URLS} from 'sentry/views/performance/utils/useModuleURL';
  23. import ProjectEventRedirect from 'sentry/views/projectEventRedirect';
  24. import redirectDeprecatedProjectRoute from 'sentry/views/projects/redirectDeprecatedProjectRoute';
  25. import RouteNotFound from 'sentry/views/routeNotFound';
  26. import SettingsWrapper from 'sentry/views/settings/components/settingsWrapper';
  27. import {ModuleName} from 'sentry/views/starfish/types';
  28. import {IndexRoute, Route} from './components/route';
  29. const hook = (name: HookName) => HookStore.get(name).map(cb => cb());
  30. // LazyExoticComponent Props get crazy when wrapped in an additional layer
  31. const SafeLazyLoad = errorHandler(LazyLoad) as unknown as React.ComponentType<
  32. typeof LazyLoad
  33. >;
  34. // NOTE: makeLazyloadComponent is exported for use in the sentry.io (getsentry)
  35. // pirvate routing tree.
  36. /**
  37. * Factory function to produce a component that will render the SafeLazyLoad
  38. * _with_ the required props.
  39. */
  40. export function makeLazyloadComponent<C extends React.ComponentType<any>>(
  41. resolve: () => Promise<{default: C}>
  42. ) {
  43. const LazyComponent = lazy<C>(() => retryableImport(resolve));
  44. // XXX: Assign the component to a variable so it has a displayname
  45. function RouteLazyLoad(props: React.ComponentProps<C>) {
  46. // we can use this hook to set the organization as it's
  47. // a child of the organization context
  48. return <SafeLazyLoad {...props} LazyComponent={LazyComponent} />;
  49. }
  50. return RouteLazyLoad;
  51. }
  52. // Shorthand to avoid extra line wrapping
  53. const make = makeLazyloadComponent;
  54. function buildRoutes() {
  55. // Read this to understand where to add new routes, how / why the routing
  56. // tree is structured the way it is, and how the lazy-loading /
  57. // code-splitting works for pages.
  58. //
  59. // ## Formatting
  60. //
  61. // NOTE that there are intentionally NO blank lines within route tree blocks.
  62. // This helps make it easier to navigate within the file by using your
  63. // editors shortcuts to jump between 'paragraphs' of code.
  64. //
  65. // [!!] Do NOT add blank lines within route blocks to preserve this behavior!
  66. //
  67. //
  68. // ## Lazy loading
  69. //
  70. // * The `SafeLazyLoad` component
  71. //
  72. // Most routes are rendered as LazyLoad components (SafeLazyLoad is the
  73. // errorHandler wrapped version). This means the rendered component for the
  74. // route will only be loaded when the route is loaded. This helps us
  75. // "code-split" the app.
  76. //
  77. // ## Hooks
  78. //
  79. // There are a number of `hook()` routes placed within the routing tree to
  80. // allow for additional routes to be augmented into the application via the
  81. // hookStore mechanism.
  82. //
  83. //
  84. // ## The structure
  85. //
  86. // * `experimentalSpaRoutes`
  87. //
  88. // These routes are specifically for the experimental single-page-app mode,
  89. // where Sentry is run separate from Django. These are NOT part of the root
  90. // <App /> component.
  91. //
  92. // Right now these are mainly used for authentication pages. In the future
  93. // they would be used for other pages like registration.
  94. //
  95. // * `rootRoutes`
  96. //
  97. // These routes live directly under the <App /> container, and generally
  98. // are not specific to an organization.
  99. //
  100. // * `settingsRoutes`
  101. //
  102. // This is the route tree for all of `/settings/`. This route tree is
  103. // composed of a few different sub-trees.
  104. //
  105. // - `accountSettingsRoutes` User specific settings
  106. // - `orgSettingsRoutes` Specific to a organization
  107. // - `projectSettingsRoutes` Specific to a project
  108. // - `legacySettingsRedirects` Routes that used to exist in settings
  109. //
  110. // * `organizationRoutes`
  111. //
  112. // This is where a majority of the app routes live. This is wrapped with
  113. // the <OrganizationLayout /> component, which renders the sidebar and
  114. // loads the organiztion into context (though in some cases, there may be
  115. // no organiztion)
  116. //
  117. // When adding new top-level organization routes, be sure the top level
  118. // route includes withOrgPath to support installs that are not using
  119. // customer domains.
  120. //
  121. // Within these routes are a variety of subroutes. They are not all
  122. // listed here as the subroutes will be added and removed, and most are
  123. // self explanatory.
  124. //
  125. // * `legacyRedirectRoutes`
  126. //
  127. // This route tree contains <Redirect /> routes for many old legacy paths.
  128. //
  129. // You may also find <Redirect />'s collocated next to the feature routes
  130. // they have redirects for. A good rule here is to place 'helper' redirects
  131. // next to the routes they redirect to, and place 'legacy route' redirects
  132. // for routes that have completely changed in this tree.
  133. const experimentalSpaRoutes = EXPERIMENTAL_SPA ? (
  134. <Route path="/auth/login/" component={errorHandler(AuthLayout)}>
  135. <IndexRoute component={make(() => import('sentry/views/auth/login'))} />
  136. <Route path=":orgId/" component={make(() => import('sentry/views/auth/login'))} />
  137. </Route>
  138. ) : null;
  139. const rootRoutes = (
  140. <Fragment>
  141. <IndexRoute component={make(() => import('sentry/views/app/root'))} />
  142. {hook('routes:root')}
  143. <Route
  144. path="/accept/:orgId/:memberId/:token/"
  145. component={make(() => import('sentry/views/acceptOrganizationInvite'))}
  146. />
  147. <Route
  148. path="/accept/:memberId/:token/"
  149. component={make(() => import('sentry/views/acceptOrganizationInvite'))}
  150. />
  151. <Route
  152. path="/accept-transfer/"
  153. component={make(() => import('sentry/views/acceptProjectTransfer'))}
  154. />
  155. <Route component={errorHandler(OrganizationContainer)}>
  156. <Route
  157. path="/extensions/external-install/:integrationSlug/:installationId"
  158. component={make(() => import('sentry/views/integrationOrganizationLink'))}
  159. />
  160. <Route
  161. path="/extensions/:integrationSlug/link/"
  162. component={make(() => import('sentry/views/integrationOrganizationLink'))}
  163. />
  164. </Route>
  165. <Route
  166. path="/sentry-apps/:sentryAppSlug/external-install/"
  167. component={make(() => import('sentry/views/sentryAppExternalInstallation'))}
  168. />
  169. <Redirect from="/account/" to="/settings/account/details/" />
  170. <Redirect from="/share/group/:shareId/" to="/share/issue/:shareId/" />
  171. {/* TODO: remove share/issue orgless url */}
  172. <Route
  173. path="/share/issue/:shareId/"
  174. component={make(() => import('sentry/views/sharedGroupDetails'))}
  175. />
  176. <Route
  177. path="/organizations/:orgId/share/issue/:shareId/"
  178. component={make(() => import('sentry/views/sharedGroupDetails'))}
  179. />
  180. {USING_CUSTOMER_DOMAIN && (
  181. <Route
  182. path="/unsubscribe/project/:id/"
  183. component={make(() => import('sentry/views/unsubscribe/project'))}
  184. />
  185. )}
  186. <Route
  187. path="/unsubscribe/:orgId/project/:id/"
  188. component={make(() => import('sentry/views/unsubscribe/project'))}
  189. />
  190. {USING_CUSTOMER_DOMAIN && (
  191. <Route
  192. path="/unsubscribe/issue/:id/"
  193. component={make(() => import('sentry/views/unsubscribe/issue'))}
  194. />
  195. )}
  196. <Route
  197. path="/unsubscribe/:orgId/issue/:id/"
  198. component={make(() => import('sentry/views/unsubscribe/issue'))}
  199. />
  200. <Route
  201. path="/organizations/new/"
  202. component={make(() => import('sentry/views/organizationCreate'))}
  203. />
  204. <Route
  205. path="/data-export/:dataExportId"
  206. component={make(() => import('sentry/views/dataExport/dataDownload'))}
  207. withOrgPath
  208. />
  209. <Route component={errorHandler(OrganizationContainer)}>
  210. <Route
  211. path="/disabled-member/"
  212. component={make(() => import('sentry/views/disabledMember'))}
  213. withOrgPath
  214. />
  215. </Route>
  216. {USING_CUSTOMER_DOMAIN && (
  217. <Route
  218. path="/restore/"
  219. component={make(() => import('sentry/views/organizationRestore'))}
  220. />
  221. )}
  222. <Route
  223. path="/organizations/:orgId/restore/"
  224. component={make(() => import('sentry/views/organizationRestore'))}
  225. />
  226. {USING_CUSTOMER_DOMAIN && (
  227. <Route
  228. path="/join-request/"
  229. component={withDomainRequired(
  230. make(() => import('sentry/views/organizationJoinRequest'))
  231. )}
  232. key="orgless-join-request"
  233. />
  234. )}
  235. <Route
  236. path="/join-request/:orgId/"
  237. component={withDomainRedirect(
  238. make(() => import('sentry/views/organizationJoinRequest'))
  239. )}
  240. key="org-join-request"
  241. />
  242. <Route
  243. path="/relocation/"
  244. component={make(() => import('sentry/views/relocation'))}
  245. key="orgless-relocation"
  246. >
  247. <IndexRedirect to="get-started/" />
  248. <Route path=":step/" component={make(() => import('sentry/views/relocation'))} />
  249. </Route>
  250. {USING_CUSTOMER_DOMAIN && (
  251. <Route
  252. path="/onboarding/"
  253. component={errorHandler(withDomainRequired(OrganizationContainer))}
  254. key="orgless-onboarding"
  255. >
  256. <IndexRedirect to="welcome/" />
  257. <Route
  258. path=":step/"
  259. component={make(() => import('sentry/views/onboarding'))}
  260. />
  261. </Route>
  262. )}
  263. <Route
  264. path="/onboarding/:orgId/"
  265. component={withDomainRedirect(errorHandler(OrganizationContainer))}
  266. key="org-onboarding"
  267. >
  268. <IndexRedirect to="welcome/" />
  269. <Route path=":step/" component={make(() => import('sentry/views/onboarding'))} />
  270. </Route>
  271. <Route
  272. path="/stories/"
  273. component={make(() => import('sentry/views/stories/index'))}
  274. withOrgPath
  275. />
  276. </Fragment>
  277. );
  278. const accountSettingsRoutes = (
  279. <Route
  280. path="account/"
  281. name={t('Account')}
  282. component={make(
  283. () => import('sentry/views/settings/account/accountSettingsLayout')
  284. )}
  285. >
  286. <IndexRedirect to="details/" />
  287. <Route
  288. path="details/"
  289. name={t('Details')}
  290. component={make(() => import('sentry/views/settings/account/accountDetails'))}
  291. />
  292. <Route path="notifications/" name={t('Notifications')}>
  293. <IndexRoute
  294. component={make(
  295. () =>
  296. import(
  297. 'sentry/views/settings/account/notifications/notificationSettingsController'
  298. )
  299. )}
  300. />
  301. <Route
  302. path=":fineTuneType/"
  303. name={t('Fine Tune Alerts')}
  304. component={make(
  305. () =>
  306. import(
  307. 'sentry/views/settings/account/accountNotificationFineTuningController'
  308. )
  309. )}
  310. />
  311. </Route>
  312. <Route
  313. path="emails/"
  314. name={t('Emails')}
  315. component={make(() => import('sentry/views/settings/account/accountEmails'))}
  316. />
  317. <Route
  318. path="authorizations/"
  319. component={make(
  320. () => import('sentry/views/settings/account/accountAuthorizations')
  321. )}
  322. />
  323. <Route path="security/" name={t('Security')}>
  324. <Route
  325. component={make(
  326. () =>
  327. import(
  328. 'sentry/views/settings/account/accountSecurity/accountSecurityWrapper'
  329. )
  330. )}
  331. >
  332. <IndexRoute
  333. component={make(
  334. () => import('sentry/views/settings/account/accountSecurity')
  335. )}
  336. />
  337. <Route
  338. path="session-history/"
  339. name={t('Session History')}
  340. component={make(
  341. () => import('sentry/views/settings/account/accountSecurity/sessionHistory')
  342. )}
  343. />
  344. <Route
  345. path="mfa/:authId/"
  346. name={t('Details')}
  347. component={make(
  348. () =>
  349. import(
  350. 'sentry/views/settings/account/accountSecurity/accountSecurityDetails'
  351. )
  352. )}
  353. />
  354. </Route>
  355. <Route
  356. path="mfa/:authId/enroll/"
  357. name={t('Enroll')}
  358. component={make(
  359. () =>
  360. import(
  361. 'sentry/views/settings/account/accountSecurity/accountSecurityEnroll'
  362. )
  363. )}
  364. />
  365. </Route>
  366. <Route
  367. path="subscriptions/"
  368. name={t('Subscriptions')}
  369. component={make(
  370. () => import('sentry/views/settings/account/accountSubscriptions')
  371. )}
  372. />
  373. <Route
  374. path="identities/"
  375. name={t('Identities')}
  376. component={make(() => import('sentry/views/settings/account/accountIdentities'))}
  377. />
  378. <Route path="api/" name={t('API')}>
  379. <IndexRedirect to="auth-tokens/" />
  380. <Route path="auth-tokens/" name={t('User Auth Tokens')}>
  381. <IndexRoute
  382. component={make(() => import('sentry/views/settings/account/apiTokens'))}
  383. />
  384. <Route
  385. path="new-token/"
  386. name={t('Create New Token')}
  387. component={make(() => import('sentry/views/settings/account/apiNewToken'))}
  388. />
  389. </Route>
  390. <Route path="applications/" name={t('Applications')}>
  391. <IndexRoute
  392. component={make(
  393. () => import('sentry/views/settings/account/apiApplications')
  394. )}
  395. />
  396. <Route
  397. path=":appId/"
  398. name={t('Details')}
  399. component={make(
  400. () => import('sentry/views/settings/account/apiApplications/details')
  401. )}
  402. />
  403. </Route>
  404. {hook('routes:api')}
  405. </Route>
  406. <Route
  407. path="close-account/"
  408. name={t('Close Account')}
  409. component={make(() => import('sentry/views/settings/account/accountClose'))}
  410. />
  411. </Route>
  412. );
  413. const projectSettingsRoutes = (
  414. <Route
  415. path="projects/:projectId/"
  416. name={t('Project')}
  417. component={make(
  418. () => import('sentry/views/settings/project/projectSettingsLayout')
  419. )}
  420. >
  421. <IndexRoute
  422. name={t('General')}
  423. component={make(() => import('sentry/views/settings/projectGeneralSettings'))}
  424. />
  425. <Redirect from="install/" to="/projects/:projectId/getting-started/" />
  426. <Route
  427. path="teams/"
  428. name={t('Teams')}
  429. component={make(() => import('sentry/views/settings/project/projectTeams'))}
  430. />
  431. <Route
  432. path="alerts/"
  433. name={t('Alerts')}
  434. component={make(() => import('sentry/views/settings/projectAlerts'))}
  435. >
  436. <IndexRoute
  437. component={make(() => import('sentry/views/settings/projectAlerts/settings'))}
  438. />
  439. <Redirect from="new/" to="/organizations/:orgId/alerts/:projectId/new/" />
  440. <Redirect from="rules/" to="/organizations/:orgId/alerts/rules/" />
  441. <Redirect from="rules/new/" to="/organizations/:orgId/alerts/:projectId/new/" />
  442. <Redirect
  443. from="metric-rules/new/"
  444. to="/organizations/:orgId/alerts/:projectId/new/"
  445. />
  446. <Redirect
  447. from="rules/:ruleId/"
  448. to="/organizations/:orgId/alerts/rules/:projectId/:ruleId/"
  449. />
  450. <Redirect
  451. from="metric-rules/:ruleId/"
  452. to="/organizations/:orgId/alerts/metric-rules/:projectId/:ruleId/"
  453. />
  454. </Route>
  455. <Route
  456. path="environments/"
  457. name={t('Environments')}
  458. component={make(
  459. () => import('sentry/views/settings/project/projectEnvironments')
  460. )}
  461. >
  462. <IndexRoute />
  463. <Route path="hidden/" />
  464. </Route>
  465. <Route
  466. path="tags/"
  467. name={t('Tags & Context')}
  468. component={make(() => import('sentry/views/settings/projectTags'))}
  469. />
  470. <Redirect from="issue-tracking/" to="/settings/:orgId/:projectId/plugins/" />
  471. <Route
  472. path="release-tracking/"
  473. name={t('Release Tracking')}
  474. component={make(
  475. () => import('sentry/views/settings/project/projectReleaseTracking')
  476. )}
  477. />
  478. <Route
  479. path="ownership/"
  480. name={t('Ownership Rules')}
  481. component={make(() => import('sentry/views/settings/project/projectOwnership'))}
  482. />
  483. <Route
  484. path="data-forwarding/"
  485. name={t('Data Forwarding')}
  486. component={make(() => import('sentry/views/settings/projectDataForwarding'))}
  487. />
  488. <Route
  489. path="user-feedback/"
  490. name={t('User Feedback')}
  491. component={make(() => import('sentry/views/settings/projectUserFeedback'))}
  492. />
  493. <Route path="security-and-privacy/" name={t('Security & Privacy')}>
  494. <IndexRoute
  495. component={make(
  496. () => import('sentry/views/settings/projectSecurityAndPrivacy')
  497. )}
  498. />
  499. <Route
  500. path="advanced-data-scrubbing/:scrubbingId/"
  501. component={make(
  502. () => import('sentry/views/settings/projectSecurityAndPrivacy')
  503. )}
  504. />
  505. </Route>
  506. <Route
  507. path="debug-symbols/"
  508. name={t('Debug Information Files')}
  509. component={make(() => import('sentry/views/settings/projectDebugFiles'))}
  510. />
  511. <Route
  512. path="proguard/"
  513. name={t('ProGuard Mappings')}
  514. component={make(() => import('sentry/views/settings/projectProguard'))}
  515. />
  516. <Route
  517. path="performance/"
  518. name={t('Performance')}
  519. component={make(() => import('sentry/views/settings/projectPerformance'))}
  520. />
  521. <Route path="metrics/" name={t('Metrics')}>
  522. <IndexRoute
  523. component={make(() => import('sentry/views/settings/projectMetrics'))}
  524. />
  525. <Route
  526. name={t('Metrics Details')}
  527. path=":mri/"
  528. component={make(
  529. () => import('sentry/views/settings/projectMetrics/projectMetricsDetails')
  530. )}
  531. />
  532. </Route>
  533. <Route
  534. path="replays/"
  535. name={t('Replays')}
  536. component={make(() => import('sentry/views/settings/project/projectReplays'))}
  537. />
  538. <Route
  539. path="remote-config/"
  540. name={t('Remote Config')}
  541. component={make(
  542. () => import('sentry/views/settings/project/projectRemoteConfig')
  543. )}
  544. />
  545. <Route path="source-maps/" name={t('Source Maps')}>
  546. <IndexRoute
  547. component={make(() => import('sentry/views/settings/projectSourceMaps'))}
  548. />
  549. <Route
  550. path="artifact-bundles/"
  551. name={t('Artifact Bundles')}
  552. component={make(() => import('sentry/views/settings/projectSourceMaps'))}
  553. >
  554. <Route
  555. name={t('Artifact Bundle')}
  556. path=":bundleId/"
  557. component={make(() => import('sentry/views/settings/projectSourceMaps'))}
  558. />
  559. </Route>
  560. <Route
  561. path="release-bundles/"
  562. name={t('Release Bundles')}
  563. component={make(() => import('sentry/views/settings/projectSourceMaps'))}
  564. >
  565. <Route
  566. name={t('Release Bundle')}
  567. path=":bundleId/"
  568. component={make(() => import('sentry/views/settings/projectSourceMaps'))}
  569. />
  570. </Route>
  571. <Redirect from=":name/" to="release-bundles/:name/" />
  572. </Route>
  573. <Route
  574. path="processing-issues/"
  575. name={t('Processing Issues')}
  576. component={make(
  577. () => import('sentry/views/settings/project/projectProcessingIssues')
  578. )}
  579. />
  580. <Route
  581. path="filters/"
  582. name={t('Inbound Filters')}
  583. component={make(() => import('sentry/views/settings/project/projectFilters'))}
  584. >
  585. <IndexRedirect to="data-filters/" />
  586. <Route path=":filterType/" />
  587. </Route>
  588. <Redirect from="dynamic-sampling/" to="performance/" />
  589. <Route
  590. path="issue-grouping/"
  591. name={t('Issue Grouping')}
  592. component={make(() => import('sentry/views/settings/projectIssueGrouping'))}
  593. />
  594. <Route
  595. path="hooks/"
  596. name={t('Service Hooks')}
  597. component={make(
  598. () => import('sentry/views/settings/project/projectServiceHooks')
  599. )}
  600. />
  601. <Route
  602. path="hooks/new/"
  603. name={t('Create Service Hook')}
  604. component={make(
  605. () => import('sentry/views/settings/project/projectCreateServiceHook')
  606. )}
  607. />
  608. <Route
  609. path="hooks/:hookId/"
  610. name={t('Service Hook Details')}
  611. component={make(
  612. () => import('sentry/views/settings/project/projectServiceHookDetails')
  613. )}
  614. />
  615. <Route path="keys/" name={t('Client Keys')}>
  616. <IndexRoute
  617. component={make(() => import('sentry/views/settings/project/projectKeys/list'))}
  618. />
  619. <Route
  620. path=":keyId/"
  621. name={t('Details')}
  622. component={make(
  623. () => import('sentry/views/settings/project/projectKeys/details')
  624. )}
  625. />
  626. </Route>
  627. <Route
  628. path="loader-script/"
  629. name={t('Loader Script')}
  630. component={make(() => import('sentry/views/settings/project/loaderScript'))}
  631. />
  632. <Redirect from="csp/" to="security-headers/" />
  633. <Route path="security-headers/" name={t('Security Headers')}>
  634. <IndexRoute
  635. component={make(() => import('sentry/views/settings/projectSecurityHeaders'))}
  636. />
  637. <Route
  638. path="csp/"
  639. name={t('Content Security Policy')}
  640. component={make(
  641. () => import('sentry/views/settings/projectSecurityHeaders/csp')
  642. )}
  643. />
  644. <Route
  645. path="expect-ct/"
  646. name={t('Certificate Transparency')}
  647. component={make(
  648. () => import('sentry/views/settings/projectSecurityHeaders/expectCt')
  649. )}
  650. />
  651. <Route
  652. path="hpkp/"
  653. name={t('HPKP')}
  654. component={make(
  655. () => import('sentry/views/settings/projectSecurityHeaders/hpkp')
  656. )}
  657. />
  658. </Route>
  659. <Route path="plugins/" name={t('Legacy Integrations')}>
  660. <IndexRoute
  661. component={make(() => import('sentry/views/settings/projectPlugins'))}
  662. />
  663. <Route
  664. path=":pluginId/"
  665. name={t('Integration Details')}
  666. component={make(() => import('sentry/views/settings/projectPlugins/details'))}
  667. />
  668. </Route>
  669. </Route>
  670. );
  671. const orgSettingsRoutes = (
  672. <Route
  673. component={make(
  674. () => import('sentry/views/settings/organization/organizationSettingsLayout')
  675. )}
  676. >
  677. {hook('routes:organization')}
  678. {!USING_CUSTOMER_DOMAIN && (
  679. <IndexRoute
  680. name={t('General')}
  681. component={make(
  682. () => import('sentry/views/settings/organizationGeneralSettings')
  683. )}
  684. />
  685. )}
  686. {USING_CUSTOMER_DOMAIN && (
  687. <Route
  688. path="/settings/organization/"
  689. name={t('General')}
  690. component={make(
  691. () => import('sentry/views/settings/organizationGeneralSettings')
  692. )}
  693. />
  694. )}
  695. <Route
  696. path="projects/"
  697. name={t('Projects')}
  698. component={make(() => import('sentry/views/settings/organizationProjects'))}
  699. />
  700. <Route path="api-keys/" name={t('API Key')}>
  701. <IndexRoute
  702. component={make(() => import('sentry/views/settings/organizationApiKeys'))}
  703. />
  704. <Route
  705. path=":apiKey/"
  706. name={t('Details')}
  707. component={make(
  708. () =>
  709. import(
  710. 'sentry/views/settings/organizationApiKeys/organizationApiKeyDetails'
  711. )
  712. )}
  713. />
  714. </Route>
  715. <Route
  716. path="audit-log/"
  717. name={t('Audit Log')}
  718. component={make(() => import('sentry/views/settings/organizationAuditLog'))}
  719. />
  720. <Route
  721. path="auth/"
  722. name={t('Auth Providers')}
  723. component={make(() => import('sentry/views/settings/organizationAuth'))}
  724. />
  725. <Redirect from="members/requests" to="members/" />
  726. <Route path="members/" name={t('Members')}>
  727. <Route
  728. component={make(
  729. () =>
  730. import(
  731. 'sentry/views/settings/organizationMembers/organizationMembersWrapper'
  732. )
  733. )}
  734. >
  735. <IndexRoute
  736. component={make(
  737. () =>
  738. import(
  739. 'sentry/views/settings/organizationMembers/organizationMembersList'
  740. )
  741. )}
  742. />
  743. </Route>
  744. <Route
  745. path=":memberId/"
  746. name={t('Details')}
  747. component={make(
  748. () =>
  749. import('sentry/views/settings/organizationMembers/organizationMemberDetail')
  750. )}
  751. />
  752. </Route>
  753. <Route
  754. path="rate-limits/"
  755. name={t('Rate Limits')}
  756. component={make(() => import('sentry/views/settings/organizationRateLimits'))}
  757. />
  758. <Route
  759. path="relay/"
  760. name={t('Relay')}
  761. component={make(() => import('sentry/views/settings/organizationRelay'))}
  762. />
  763. <Route
  764. path="repos/"
  765. name={t('Repositories')}
  766. component={make(() => import('sentry/views/settings/organizationRepositories'))}
  767. />
  768. <Route
  769. path="settings/"
  770. component={make(
  771. () => import('sentry/views/settings/organizationGeneralSettings')
  772. )}
  773. />
  774. <Route path="security-and-privacy/" name={t('Security & Privacy')}>
  775. <IndexRoute
  776. component={make(
  777. () => import('sentry/views/settings/organizationSecurityAndPrivacy')
  778. )}
  779. />
  780. <Route
  781. path="advanced-data-scrubbing/:scrubbingId/"
  782. component={make(
  783. () => import('sentry/views/settings/organizationSecurityAndPrivacy')
  784. )}
  785. />
  786. </Route>
  787. <Route path="teams/" name={t('Teams')}>
  788. <IndexRoute
  789. component={make(() => import('sentry/views/settings/organizationTeams'))}
  790. />
  791. <Route
  792. path=":teamId/"
  793. name={t('Team')}
  794. component={make(
  795. () => import('sentry/views/settings/organizationTeams/teamDetails')
  796. )}
  797. >
  798. <IndexRedirect to="members/" />
  799. <Route
  800. path="members/"
  801. name={t('Members')}
  802. component={make(
  803. () => import('sentry/views/settings/organizationTeams/teamMembers')
  804. )}
  805. />
  806. <Route
  807. path="notifications/"
  808. name={t('Notifications')}
  809. component={make(
  810. () => import('sentry/views/settings/organizationTeams/teamNotifications')
  811. )}
  812. />
  813. <Route
  814. path="projects/"
  815. name={t('Projects')}
  816. component={make(
  817. () => import('sentry/views/settings/organizationTeams/teamProjects')
  818. )}
  819. />
  820. <Route
  821. path="settings/"
  822. name={t('Settings')}
  823. component={make(
  824. () => import('sentry/views/settings/organizationTeams/teamSettings')
  825. )}
  826. />
  827. </Route>
  828. </Route>
  829. <Redirect from="plugins/" to="integrations/" />
  830. <Route path="plugins/" name={t('Integrations')}>
  831. <Route
  832. path=":integrationSlug/"
  833. name={t('Integration Details')}
  834. component={make(
  835. () =>
  836. import('sentry/views/settings/organizationIntegrations/pluginDetailedView')
  837. )}
  838. />
  839. </Route>
  840. <Redirect from="sentry-apps/" to="integrations/" />
  841. <Route path="sentry-apps/" name={t('Integrations')}>
  842. <Route
  843. path=":integrationSlug"
  844. name={t('Details')}
  845. component={make(
  846. () =>
  847. import(
  848. 'sentry/views/settings/organizationIntegrations/sentryAppDetailedView'
  849. )
  850. )}
  851. />
  852. </Route>
  853. <Redirect from="document-integrations/" to="integrations/" />
  854. <Route path="document-integrations/" name={t('Integrations')}>
  855. <Route
  856. path=":integrationSlug"
  857. name={t('Details')}
  858. component={make(
  859. () =>
  860. import(
  861. 'sentry/views/settings/organizationIntegrations/docIntegrationDetailedView'
  862. )
  863. )}
  864. />
  865. </Route>
  866. <Route path="integrations/" name={t('Integrations')}>
  867. <IndexRoute
  868. component={make(
  869. () =>
  870. import(
  871. 'sentry/views/settings/organizationIntegrations/integrationListDirectory'
  872. )
  873. )}
  874. />
  875. <Route
  876. path=":integrationSlug"
  877. name={t('Integration Details')}
  878. component={make(
  879. () =>
  880. import(
  881. 'sentry/views/settings/organizationIntegrations/integrationDetailedView'
  882. )
  883. )}
  884. />
  885. <Route
  886. path=":providerKey/:integrationId/"
  887. name={t('Configure Integration')}
  888. component={make(
  889. () =>
  890. import(
  891. 'sentry/views/settings/organizationIntegrations/configureIntegration'
  892. )
  893. )}
  894. />
  895. </Route>
  896. <Route path="developer-settings/" name={t('Custom Integrations')}>
  897. <IndexRoute
  898. component={make(
  899. () => import('sentry/views/settings/organizationDeveloperSettings')
  900. )}
  901. />
  902. <Route
  903. path="new-public/"
  904. name={t('Create Integration')}
  905. component={make(
  906. () =>
  907. import(
  908. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails'
  909. )
  910. )}
  911. />
  912. <Route
  913. path="new-internal/"
  914. name={t('Create Integration')}
  915. component={make(
  916. () =>
  917. import(
  918. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails'
  919. )
  920. )}
  921. />
  922. <Route
  923. path=":appSlug/"
  924. name={t('Edit Integration')}
  925. component={make(
  926. () =>
  927. import(
  928. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails'
  929. )
  930. )}
  931. />
  932. <Route
  933. path=":appSlug/dashboard/"
  934. name={t('Integration Dashboard')}
  935. component={make(
  936. () =>
  937. import(
  938. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDashboard'
  939. )
  940. )}
  941. />
  942. </Route>
  943. <Route path="auth-tokens/" name={t('Auth Tokens')}>
  944. <IndexRoute
  945. component={make(() => import('sentry/views/settings/organizationAuthTokens'))}
  946. />
  947. <Route
  948. path="new-token/"
  949. name={t('Create New Auth Token')}
  950. component={make(
  951. () => import('sentry/views/settings/organizationAuthTokens/newAuthToken')
  952. )}
  953. />
  954. <Route
  955. path=":tokenId/"
  956. name={t('Edit Auth Token')}
  957. component={make(
  958. () => import('sentry/views/settings/organizationAuthTokens/authTokenDetails')
  959. )}
  960. />
  961. </Route>
  962. <Route
  963. path="early-features/"
  964. name={t('Early Features')}
  965. component={make(() => import('sentry/views/settings/earlyFeatures'))}
  966. />
  967. </Route>
  968. );
  969. const legacySettingsRedirects = (
  970. <Fragment>
  971. <Redirect from=":projectId/" to="projects/:projectId/" />
  972. <Redirect from=":projectId/alerts/" to="projects/:projectId/alerts/" />
  973. <Redirect from=":projectId/alerts/rules/" to="projects/:projectId/alerts/rules/" />
  974. <Redirect
  975. from=":projectId/alerts/rules/:ruleId/"
  976. to="projects/:projectId/alerts/rules/:ruleId/"
  977. />
  978. </Fragment>
  979. );
  980. const settingsRoutes = (
  981. <Route path="/settings/" name={t('Settings')} component={SettingsWrapper}>
  982. <IndexRoute component={make(() => import('sentry/views/settings/settingsIndex'))} />
  983. {accountSettingsRoutes}
  984. <Fragment>
  985. {USING_CUSTOMER_DOMAIN && (
  986. <Route
  987. name={t('Organization')}
  988. component={withDomainRequired(NoOp)}
  989. key="orgless-settings-route"
  990. >
  991. {orgSettingsRoutes}
  992. {projectSettingsRoutes}
  993. </Route>
  994. )}
  995. <Route
  996. path=":orgId/"
  997. name={t('Organization')}
  998. component={withDomainRedirect(NoOp)}
  999. key="org-settings"
  1000. >
  1001. {orgSettingsRoutes}
  1002. {projectSettingsRoutes}
  1003. {legacySettingsRedirects}
  1004. </Route>
  1005. </Fragment>
  1006. </Route>
  1007. );
  1008. const projectsRoutes = (
  1009. <Route
  1010. path="/projects/"
  1011. component={make(() => import('sentry/views/projects/'))}
  1012. withOrgPath
  1013. >
  1014. <IndexRoute component={make(() => import('sentry/views/projectsDashboard'))} />
  1015. <Route
  1016. path="new/"
  1017. component={make(() => import('sentry/views/projectInstall/newProject'))}
  1018. />
  1019. <Route
  1020. path=":projectId/"
  1021. component={make(() => import('sentry/views/projectDetail'))}
  1022. />
  1023. <Route
  1024. path=":projectId/events/:eventId/"
  1025. component={errorHandler(ProjectEventRedirect)}
  1026. />
  1027. <Route
  1028. path=":projectId/getting-started/"
  1029. component={make(
  1030. () => import('sentry/views/projectInstall/platformOrIntegration')
  1031. )}
  1032. />
  1033. </Route>
  1034. );
  1035. const dashboardRoutes = (
  1036. <Fragment>
  1037. <Fragment>
  1038. {USING_CUSTOMER_DOMAIN && (
  1039. <Route
  1040. path="/dashboards/"
  1041. component={withDomainRequired(make(() => import('sentry/views/dashboards')))}
  1042. key="orgless-dashboards-route"
  1043. >
  1044. <IndexRoute
  1045. component={make(() => import('sentry/views/dashboards/manage'))}
  1046. />
  1047. </Route>
  1048. )}
  1049. <Route
  1050. path="/organizations/:orgId/dashboards/"
  1051. component={withDomainRedirect(make(() => import('sentry/views/dashboards')))}
  1052. key="org-dashboards"
  1053. >
  1054. <IndexRoute component={make(() => import('sentry/views/dashboards/manage'))} />
  1055. </Route>
  1056. </Fragment>
  1057. <Fragment>
  1058. {USING_CUSTOMER_DOMAIN && (
  1059. <Route
  1060. path="/dashboards/new/"
  1061. component={withDomainRequired(
  1062. make(() => import('sentry/views/dashboards/create'))
  1063. )}
  1064. key="orgless-dashboards-new-route"
  1065. >
  1066. <Route
  1067. path="widget/:widgetIndex/edit/"
  1068. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1069. />
  1070. <Route
  1071. path="widget/new/"
  1072. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1073. />
  1074. </Route>
  1075. )}
  1076. <Route
  1077. path="/organizations/:orgId/dashboards/new/"
  1078. component={withDomainRedirect(
  1079. make(() => import('sentry/views/dashboards/create'))
  1080. )}
  1081. key="org-dashboards-new"
  1082. >
  1083. <Route
  1084. path="widget/:widgetIndex/edit/"
  1085. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1086. />
  1087. <Route
  1088. path="widget/new/"
  1089. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1090. />
  1091. </Route>
  1092. </Fragment>
  1093. <Fragment>
  1094. {USING_CUSTOMER_DOMAIN && (
  1095. <Route
  1096. path="/dashboards/new/:templateId"
  1097. component={withDomainRequired(
  1098. make(() => import('sentry/views/dashboards/create'))
  1099. )}
  1100. key="orgless-dashboards-new-template-route"
  1101. >
  1102. <Route
  1103. path="widget/:widgetId/"
  1104. component={make(() => import('sentry/views/dashboards/create'))}
  1105. />
  1106. </Route>
  1107. )}
  1108. <Route
  1109. path="/organizations/:orgId/dashboards/new/:templateId"
  1110. component={withDomainRedirect(
  1111. make(() => import('sentry/views/dashboards/create'))
  1112. )}
  1113. key="org-dashboards-new-template"
  1114. >
  1115. <Route
  1116. path="widget/:widgetId/"
  1117. component={make(() => import('sentry/views/dashboards/create'))}
  1118. />
  1119. </Route>
  1120. </Fragment>
  1121. <Redirect
  1122. from="/organizations/:orgId/dashboards/:dashboardId/"
  1123. to="/organizations/:orgId/dashboard/:dashboardId/"
  1124. />
  1125. {USING_CUSTOMER_DOMAIN && (
  1126. <Redirect from="/dashboards/:dashboardId/" to="/dashboard/:dashboardId/" />
  1127. )}
  1128. <Route
  1129. path="/dashboard/:dashboardId/"
  1130. component={make(() => import('sentry/views/dashboards/view'))}
  1131. withOrgPath
  1132. >
  1133. <Route
  1134. path="widget/:widgetIndex/edit/"
  1135. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1136. />
  1137. <Route
  1138. path="widget/new/"
  1139. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1140. />
  1141. <Route
  1142. path="widget/:widgetId/"
  1143. component={make(() => import('sentry/views/dashboards/view'))}
  1144. />
  1145. </Route>
  1146. </Fragment>
  1147. );
  1148. const alertChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1149. // ALERT CHILD ROUTES
  1150. return (
  1151. <Fragment>
  1152. <IndexRoute
  1153. component={make(() => import('sentry/views/alerts/list/incidents'))}
  1154. />
  1155. <Route path="rules/">
  1156. <IndexRoute
  1157. component={make(
  1158. () => import('sentry/views/alerts/list/rules/alertRulesList')
  1159. )}
  1160. />
  1161. <Route
  1162. path="details/:ruleId/"
  1163. component={make(() => import('sentry/views/alerts/rules/metric/details'))}
  1164. />
  1165. <Route
  1166. path=":projectId/"
  1167. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1168. >
  1169. <IndexRedirect
  1170. to={
  1171. forCustomerDomain
  1172. ? '/alerts/rules/'
  1173. : '/organizations/:orgId/alerts/rules/'
  1174. }
  1175. />
  1176. <Route
  1177. path=":ruleId/"
  1178. component={make(() => import('sentry/views/alerts/edit'))}
  1179. />
  1180. </Route>
  1181. <Route path=":projectId/:ruleId/details/">
  1182. <IndexRoute
  1183. component={make(
  1184. () => import('sentry/views/alerts/rules/issue/details/ruleDetails')
  1185. )}
  1186. />
  1187. </Route>
  1188. </Route>
  1189. <Route path="metric-rules/">
  1190. <IndexRedirect
  1191. to={
  1192. forCustomerDomain ? '/alerts/rules/' : '/organizations/:orgId/alerts/rules/'
  1193. }
  1194. />
  1195. <Route
  1196. path=":projectId/"
  1197. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1198. >
  1199. <IndexRedirect
  1200. to={
  1201. forCustomerDomain
  1202. ? '/alerts/rules/'
  1203. : '/organizations/:orgId/alerts/rules/'
  1204. }
  1205. />
  1206. <Route
  1207. path=":ruleId/"
  1208. component={make(() => import('sentry/views/alerts/edit'))}
  1209. />
  1210. </Route>
  1211. </Route>
  1212. <Route
  1213. path="wizard/"
  1214. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1215. >
  1216. <IndexRoute component={make(() => import('sentry/views/alerts/wizard'))} />
  1217. </Route>
  1218. <Route
  1219. path="new/"
  1220. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1221. >
  1222. <IndexRedirect
  1223. to={
  1224. forCustomerDomain
  1225. ? '/alerts/wizard/'
  1226. : '/organizations/:orgId/alerts/wizard/'
  1227. }
  1228. />
  1229. <Route
  1230. path=":alertType/"
  1231. component={make(() => import('sentry/views/alerts/create'))}
  1232. />
  1233. </Route>
  1234. <Route
  1235. path=":alertId/"
  1236. component={make(() => import('sentry/views/alerts/incidentRedirect'))}
  1237. />
  1238. <Route
  1239. path=":projectId/"
  1240. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1241. >
  1242. <Route
  1243. path="new/"
  1244. component={make(() => import('sentry/views/alerts/create'))}
  1245. />
  1246. <Route
  1247. path="wizard/"
  1248. component={make(() => import('sentry/views/alerts/wizard'))}
  1249. />
  1250. </Route>
  1251. </Fragment>
  1252. );
  1253. };
  1254. // ALERT ROUTES
  1255. const alertRoutes = (
  1256. <Fragment>
  1257. {USING_CUSTOMER_DOMAIN && (
  1258. <Route
  1259. path="/alerts/"
  1260. component={withDomainRequired(make(() => import('sentry/views/alerts')))}
  1261. key="orgless-alerts-route"
  1262. >
  1263. {alertChildRoutes({forCustomerDomain: true})}
  1264. </Route>
  1265. )}
  1266. <Route
  1267. path="/organizations/:orgId/alerts/"
  1268. component={withDomainRedirect(make(() => import('sentry/views/alerts')))}
  1269. key="org-alerts"
  1270. >
  1271. {alertChildRoutes({forCustomerDomain: false})}
  1272. </Route>
  1273. </Fragment>
  1274. );
  1275. const cronsRoutes = (
  1276. <Route
  1277. path="/crons/"
  1278. component={make(() => import('sentry/views/monitors'))}
  1279. withOrgPath
  1280. >
  1281. <IndexRoute component={make(() => import('sentry/views/monitors/overview'))} />
  1282. <Route
  1283. path="create/"
  1284. component={make(() => import('sentry/views/monitors/create'))}
  1285. />
  1286. <Redirect from=":monitorSlug/" to="/crons/" />
  1287. <Redirect from=":monitorSlug/edit/" to="/crons/" />
  1288. <Route
  1289. path=":projectId/:monitorSlug/"
  1290. component={make(() => import('sentry/views/monitors/details'))}
  1291. />
  1292. <Route
  1293. path=":projectId/:monitorSlug/edit/"
  1294. component={make(() => import('sentry/views/monitors/edit'))}
  1295. />
  1296. </Route>
  1297. );
  1298. const replayRoutes = (
  1299. <Route
  1300. path="/replays/"
  1301. component={make(() => import('sentry/views/replays/index'))}
  1302. withOrgPath
  1303. >
  1304. <IndexRoute component={make(() => import('sentry/views/replays/list'))} />
  1305. <Route
  1306. path="selectors/"
  1307. component={make(
  1308. () => import('sentry/views/replays/deadRageClick/deadRageClickList')
  1309. )}
  1310. />
  1311. <Route
  1312. path=":replaySlug/"
  1313. component={make(() => import('sentry/views/replays/details'))}
  1314. />
  1315. </Route>
  1316. );
  1317. const releasesRoutes = (
  1318. <Fragment>
  1319. <Route path="/releases/" withOrgPath>
  1320. <IndexRoute component={make(() => import('sentry/views/releases/list'))} />
  1321. <Route
  1322. path=":release/"
  1323. component={make(() => import('sentry/views/releases/detail'))}
  1324. >
  1325. <IndexRoute
  1326. component={make(() => import('sentry/views/releases/detail/overview'))}
  1327. />
  1328. <Route
  1329. path="commits/"
  1330. component={make(
  1331. () => import('sentry/views/releases/detail/commitsAndFiles/commits')
  1332. )}
  1333. />
  1334. <Route
  1335. path="files-changed/"
  1336. component={make(
  1337. () => import('sentry/views/releases/detail/commitsAndFiles/filesChanged')
  1338. )}
  1339. />
  1340. </Route>
  1341. </Route>
  1342. <Redirect
  1343. from="/releases/new-events/"
  1344. to="/organizations/:orgId/releases/:release/"
  1345. />
  1346. <Redirect
  1347. from="/releases/all-events/"
  1348. to="/organizations/:orgId/releases/:release/"
  1349. />
  1350. </Fragment>
  1351. );
  1352. const activityRoutes = (
  1353. <Route
  1354. path="/activity/"
  1355. component={make(() => import('sentry/views/organizationActivity'))}
  1356. withOrgPath
  1357. />
  1358. );
  1359. const statsRoutes = (
  1360. <Fragment>
  1361. <Route path="/stats/" withOrgPath>
  1362. <IndexRoute component={make(() => import('sentry/views/organizationStats'))} />
  1363. <Route
  1364. component={make(() => import('sentry/views/organizationStats/teamInsights'))}
  1365. >
  1366. <Route
  1367. path="issues/"
  1368. component={make(
  1369. () => import('sentry/views/organizationStats/teamInsights/issues')
  1370. )}
  1371. />
  1372. <Route
  1373. path="health/"
  1374. component={make(
  1375. () => import('sentry/views/organizationStats/teamInsights/health')
  1376. )}
  1377. />
  1378. </Route>
  1379. </Route>
  1380. <Redirect
  1381. from="/organizations/:orgId/stats/team/"
  1382. to="/organizations/:orgId/stats/issues/"
  1383. />
  1384. </Fragment>
  1385. );
  1386. // TODO(mark) Long term this /queries route should go away and /discover
  1387. // should be the canonical route for discover2. We have a redirect right now
  1388. // as /discover was for discover 1 and most of the application is linking to
  1389. // /discover/queries and not /discover
  1390. const discoverRoutes = (
  1391. <Route
  1392. path="/discover/"
  1393. component={make(() => import('sentry/views/discover'))}
  1394. withOrgPath
  1395. >
  1396. <IndexRedirect to="queries/" />
  1397. <Route
  1398. path="homepage/"
  1399. component={make(() => import('sentry/views/discover/homepage'))}
  1400. />
  1401. <Route
  1402. path="queries/"
  1403. component={make(() => import('sentry/views/discover/landing'))}
  1404. />
  1405. <Route
  1406. path="results/"
  1407. component={make(() => import('sentry/views/discover/results'))}
  1408. />
  1409. <Route
  1410. path=":eventSlug/"
  1411. component={make(() => import('sentry/views/discover/eventDetails'))}
  1412. />
  1413. </Route>
  1414. );
  1415. const llmMonitoringRoutes = (
  1416. <Route path={`/${MODULE_BASE_URLS[ModuleName.AI]}/`} withOrgPath>
  1417. <IndexRoute component={make(() => import('sentry/views/llmMonitoring/landing'))} />
  1418. <Route
  1419. path="pipeline-type/:groupId/"
  1420. component={make(
  1421. () => import('sentry/views/llmMonitoring/llmMonitoringDetailsPage')
  1422. )}
  1423. />
  1424. </Route>
  1425. );
  1426. const insightsSubRoutes = (
  1427. <Fragment>
  1428. <Route path={`${MODULE_BASE_URLS[ModuleName.DB]}/`}>
  1429. <IndexRoute
  1430. component={make(
  1431. () => import('sentry/views/performance/database/databaseLandingPage')
  1432. )}
  1433. />
  1434. <Route
  1435. path="spans/span/:groupId/"
  1436. component={make(
  1437. () => import('sentry/views/performance/database/databaseSpanSummaryPage')
  1438. )}
  1439. />
  1440. </Route>
  1441. <Route path={`${MODULE_BASE_URLS[ModuleName.HTTP]}/`}>
  1442. <IndexRoute
  1443. component={make(() => import('sentry/views/performance/http/httpLandingPage'))}
  1444. />
  1445. <Route
  1446. path="domains/"
  1447. component={make(
  1448. () => import('sentry/views/performance/http/httpDomainSummaryPage')
  1449. )}
  1450. />
  1451. </Route>
  1452. <Route path={`${MODULE_BASE_URLS[ModuleName.CACHE]}/`}>
  1453. <IndexRoute
  1454. component={make(
  1455. () => import('sentry/views/performance/cache/cacheLandingPage')
  1456. )}
  1457. />
  1458. </Route>
  1459. <Route path={`${MODULE_BASE_URLS[ModuleName.VITAL]}/`}>
  1460. <IndexRoute
  1461. component={make(
  1462. () =>
  1463. import('sentry/views/performance/browser/webVitals/webVitalsLandingPage')
  1464. )}
  1465. />
  1466. <Route
  1467. path="overview/"
  1468. component={make(
  1469. () => import('sentry/views/performance/browser/webVitals/pageOverview')
  1470. )}
  1471. />
  1472. </Route>
  1473. <Route path={`${MODULE_BASE_URLS[ModuleName.RESOURCE]}/`}>
  1474. <IndexRoute
  1475. component={make(
  1476. () => import('sentry/views/performance/browser/resources/index')
  1477. )}
  1478. />
  1479. <Route
  1480. path="spans/span/:groupId/"
  1481. component={make(
  1482. () =>
  1483. import(
  1484. 'sentry/views/performance/browser/resources/resourceSummaryPage/index'
  1485. )
  1486. )}
  1487. />
  1488. </Route>
  1489. <Route path={`${PERFORMANCE_RESOURCE_BASE_URL}/`}>
  1490. <IndexRoute
  1491. component={make(
  1492. () => import('sentry/views/performance/browser/resources/index')
  1493. )}
  1494. />
  1495. <Route
  1496. path="spans/span/:groupId/"
  1497. component={make(
  1498. () =>
  1499. import(
  1500. 'sentry/views/performance/browser/resources/resourceSummaryPage/index'
  1501. )
  1502. )}
  1503. />
  1504. </Route>
  1505. <Route path={`${MODULE_BASE_URLS[ModuleName.QUEUE]}/`}>
  1506. <IndexRoute
  1507. component={make(
  1508. () => import('sentry/views/performance/queues/queuesLandingPage')
  1509. )}
  1510. />
  1511. <Route
  1512. path="destination/"
  1513. component={make(
  1514. () =>
  1515. import(
  1516. 'sentry/views/performance/queues/destinationSummary/destinationSummaryPage'
  1517. )
  1518. )}
  1519. />
  1520. </Route>
  1521. <Route path={`${MODULE_BASE_URLS[ModuleName.SCREEN_LOAD]}/`}>
  1522. <IndexRoute
  1523. component={make(() => import('sentry/views/performance/mobile/screenload'))}
  1524. />
  1525. <Route
  1526. path="spans/"
  1527. component={make(
  1528. () => import('sentry/views/performance/mobile/screenload/screenLoadSpans')
  1529. )}
  1530. />
  1531. </Route>
  1532. <Route path={`${MODULE_BASE_URLS[ModuleName.APP_START]}/`}>
  1533. <IndexRoute
  1534. component={make(() => import('sentry/views/performance/mobile/appStarts'))}
  1535. />
  1536. <Route
  1537. path="spans/"
  1538. component={make(
  1539. () => import('sentry/views/performance/mobile/appStarts/screenSummary')
  1540. )}
  1541. />
  1542. </Route>
  1543. <Route path={`${MODULE_BASE_URLS[ModuleName.MOBILE_UI]}/`}>
  1544. <IndexRoute
  1545. component={make(() => import('sentry/views/performance/mobile/ui'))}
  1546. />
  1547. <Route
  1548. path="spans/"
  1549. component={make(
  1550. () => import('sentry/views/performance/mobile/ui/screenSummary')
  1551. )}
  1552. />
  1553. </Route>
  1554. <Route path={`${MODULE_BASE_URLS[ModuleName.AI]}/`}>
  1555. <IndexRoute
  1556. component={make(() => import('sentry/views/llmMonitoring/landing'))}
  1557. />
  1558. <Route
  1559. path="pipeline-type/:groupId/"
  1560. component={make(
  1561. () => import('sentry/views/llmMonitoring/llmMonitoringDetailsPage')
  1562. )}
  1563. />
  1564. </Route>
  1565. </Fragment>
  1566. );
  1567. const insightsRoutes = (
  1568. <Route path="/insights/" withOrgPath>
  1569. {insightsSubRoutes}
  1570. </Route>
  1571. );
  1572. const performanceRoutes = (
  1573. <Route
  1574. path="/performance/"
  1575. component={make(() => import('sentry/views/performance'))}
  1576. withOrgPath
  1577. >
  1578. <IndexRoute component={make(() => import('sentry/views/performance/content'))} />
  1579. <Route
  1580. path="trends/"
  1581. component={make(() => import('sentry/views/performance/trends'))}
  1582. />
  1583. <Route path="traces/">
  1584. <IndexRoute component={make(() => import('sentry/views/performance/traces'))} />
  1585. </Route>
  1586. <Route path="summary/">
  1587. <IndexRoute
  1588. component={make(
  1589. () =>
  1590. import('sentry/views/performance/transactionSummary/transactionOverview')
  1591. )}
  1592. />
  1593. <Route
  1594. path="replays/"
  1595. component={make(
  1596. () => import('sentry/views/performance/transactionSummary/transactionReplays')
  1597. )}
  1598. />
  1599. <Route
  1600. path="vitals/"
  1601. component={make(
  1602. () => import('sentry/views/performance/transactionSummary/transactionVitals')
  1603. )}
  1604. />
  1605. <Route
  1606. path="tags/"
  1607. component={make(
  1608. () => import('sentry/views/performance/transactionSummary/transactionTags')
  1609. )}
  1610. />
  1611. <Route
  1612. path="events/"
  1613. component={make(
  1614. () => import('sentry/views/performance/transactionSummary/transactionEvents')
  1615. )}
  1616. />
  1617. <Route
  1618. path="anomalies/"
  1619. component={make(
  1620. () =>
  1621. import('sentry/views/performance/transactionSummary/transactionAnomalies')
  1622. )}
  1623. />
  1624. <Route
  1625. path="profiles/"
  1626. component={make(
  1627. () =>
  1628. import('sentry/views/performance/transactionSummary/transactionProfiles')
  1629. )}
  1630. />
  1631. <Route
  1632. path="aggregateWaterfall/"
  1633. component={make(
  1634. () =>
  1635. import('sentry/views/performance/transactionSummary/aggregateSpanWaterfall')
  1636. )}
  1637. />
  1638. <Route path="spans/">
  1639. <IndexRoute
  1640. component={make(
  1641. () => import('sentry/views/performance/transactionSummary/transactionSpans')
  1642. )}
  1643. />
  1644. <Route
  1645. path=":spanSlug/"
  1646. component={make(
  1647. () =>
  1648. import(
  1649. 'sentry/views/performance/transactionSummary/transactionSpans/spanDetails'
  1650. )
  1651. )}
  1652. />
  1653. </Route>
  1654. </Route>
  1655. <Route
  1656. path="vitaldetail/"
  1657. component={make(() => import('sentry/views/performance/vitalDetail'))}
  1658. />
  1659. <Route
  1660. path="trace/:traceSlug/"
  1661. component={make(() => import('sentry/views/performance/traceDetails'))}
  1662. />
  1663. {insightsSubRoutes}
  1664. <Route
  1665. path=":eventSlug/"
  1666. component={make(() => import('sentry/views/performance/transactionDetails'))}
  1667. />
  1668. </Route>
  1669. );
  1670. const userFeedbackRoutes = (
  1671. <Route
  1672. path="/user-feedback/"
  1673. component={make(() => import('sentry/views/userFeedback'))}
  1674. withOrgPath
  1675. />
  1676. );
  1677. const feedbackv2Routes = (
  1678. <Route
  1679. path="/feedback/"
  1680. component={make(() => import('sentry/views/feedback/index'))}
  1681. withOrgPath
  1682. >
  1683. <IndexRoute
  1684. component={make(() => import('sentry/views/feedback/feedbackListPage'))}
  1685. />
  1686. </Route>
  1687. );
  1688. const issueListRoutes = (
  1689. <Route path="/issues" component={errorHandler(IssueListContainer)} withOrgPath>
  1690. <IndexRoute component={errorHandler(IssueListOverview)} />
  1691. <Route path="searches/:searchId/" component={errorHandler(IssueListOverview)} />
  1692. </Route>
  1693. );
  1694. // Once org issues is complete, these routes can be nested under
  1695. // /organizations/:orgId/issues
  1696. const issueTabs = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1697. const hoc = forCustomerDomain ? withDomainRequired : x => x;
  1698. return (
  1699. <Fragment>
  1700. <IndexRoute
  1701. component={hoc(
  1702. make(() => import('sentry/views/issueDetails/groupEventDetails'))
  1703. )}
  1704. />
  1705. <Route
  1706. path={TabPaths[Tab.REPLAYS]}
  1707. component={hoc(make(() => import('sentry/views/issueDetails/groupReplays')))}
  1708. />
  1709. <Route
  1710. path={TabPaths[Tab.ACTIVITY]}
  1711. component={hoc(make(() => import('sentry/views/issueDetails/groupActivity')))}
  1712. />
  1713. <Route
  1714. path={TabPaths[Tab.EVENTS]}
  1715. component={hoc(make(() => import('sentry/views/issueDetails/groupEvents')))}
  1716. />
  1717. <Route
  1718. path={TabPaths[Tab.TAGS]}
  1719. component={hoc(make(() => import('sentry/views/issueDetails/groupTags')))}
  1720. />
  1721. <Route
  1722. path={`${TabPaths[Tab.TAGS]}:tagKey/`}
  1723. component={make(() => import('sentry/views/issueDetails/groupTagValues'))}
  1724. />
  1725. <Route
  1726. path={TabPaths[Tab.USER_FEEDBACK]}
  1727. component={hoc(
  1728. make(() => import('sentry/views/issueDetails/groupUserFeedback'))
  1729. )}
  1730. />
  1731. <Route
  1732. path={TabPaths[Tab.ATTACHMENTS]}
  1733. component={hoc(
  1734. make(() => import('sentry/views/issueDetails/groupEventAttachments'))
  1735. )}
  1736. />
  1737. <Route
  1738. path={TabPaths[Tab.SIMILAR_ISSUES]}
  1739. component={hoc(
  1740. make(() => import('sentry/views/issueDetails/groupSimilarIssues'))
  1741. )}
  1742. />
  1743. <Route
  1744. path={TabPaths[Tab.MERGED]}
  1745. component={hoc(make(() => import('sentry/views/issueDetails/groupMerged')))}
  1746. />
  1747. </Fragment>
  1748. );
  1749. };
  1750. const issueDetailsChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => (
  1751. <Fragment>
  1752. {issueTabs({forCustomerDomain})}
  1753. <Route path={`${TabPaths[Tab.EVENTS]}:eventId/`}>
  1754. {issueTabs({forCustomerDomain})}
  1755. </Route>
  1756. </Fragment>
  1757. );
  1758. const issueDetailsRoutes = (
  1759. <Fragment>
  1760. <Route
  1761. path="/organizations/:orgId/issues/:groupId/"
  1762. component={withDomainRedirect(
  1763. make(() => import('sentry/views/issueDetails/groupDetails'))
  1764. )}
  1765. key="org-issues-group-id"
  1766. >
  1767. {issueDetailsChildRoutes({forCustomerDomain: false})}
  1768. </Route>
  1769. {USING_CUSTOMER_DOMAIN && (
  1770. <Route
  1771. path="/issues/:groupId/"
  1772. component={withDomainRequired(
  1773. make(() => import('sentry/views/issueDetails/groupDetails'))
  1774. )}
  1775. key="orgless-issues-group-id-route"
  1776. >
  1777. {issueDetailsChildRoutes({forCustomerDomain: true})}
  1778. </Route>
  1779. )}
  1780. </Fragment>
  1781. );
  1782. // These are the "manage" pages. For sentry.io, these are _different_ from
  1783. // the SaaS admin routes in getsentry.
  1784. const adminManageRoutes = (
  1785. <Route
  1786. path="/manage/"
  1787. component={make(() => import('sentry/views/admin/adminLayout'))}
  1788. >
  1789. <IndexRoute component={make(() => import('sentry/views/admin/adminOverview'))} />
  1790. <Route
  1791. path="buffer/"
  1792. component={make(() => import('sentry/views/admin/adminBuffer'))}
  1793. />
  1794. <Route
  1795. path="relays/"
  1796. component={make(() => import('sentry/views/admin/adminRelays'))}
  1797. />
  1798. <Route
  1799. path="organizations/"
  1800. component={make(() => import('sentry/views/admin/adminOrganizations'))}
  1801. />
  1802. <Route
  1803. path="projects/"
  1804. component={make(() => import('sentry/views/admin/adminProjects'))}
  1805. />
  1806. <Route
  1807. path="queue/"
  1808. component={make(() => import('sentry/views/admin/adminQueue'))}
  1809. />
  1810. <Route
  1811. path="quotas/"
  1812. component={make(() => import('sentry/views/admin/adminQuotas'))}
  1813. />
  1814. <Route
  1815. path="settings/"
  1816. component={make(() => import('sentry/views/admin/adminSettings'))}
  1817. />
  1818. <Route path="users/">
  1819. <IndexRoute component={make(() => import('sentry/views/admin/adminUsers'))} />
  1820. <Route
  1821. path=":id"
  1822. component={make(() => import('sentry/views/admin/adminUserEdit'))}
  1823. />
  1824. </Route>
  1825. <Route
  1826. path="status/mail/"
  1827. component={make(() => import('sentry/views/admin/adminMail'))}
  1828. />
  1829. <Route
  1830. path="status/environment/"
  1831. component={make(() => import('sentry/views/admin/adminEnvironment'))}
  1832. />
  1833. <Route
  1834. path="status/packages/"
  1835. component={make(() => import('sentry/views/admin/adminPackages'))}
  1836. />
  1837. <Route
  1838. path="status/warnings/"
  1839. component={make(() => import('sentry/views/admin/adminWarnings'))}
  1840. />
  1841. </Route>
  1842. );
  1843. // XXX(epurkhiser): This should probably go away. It's not totally clear to
  1844. // me why we need the OrganizationRoot root container.
  1845. const legacyOrganizationRootRoutes = (
  1846. <Route component={errorHandler(OrganizationRoot)}>
  1847. <Redirect from="/organizations/:orgId/teams/new/" to="/settings/:orgId/teams/" />
  1848. <Route path="/organizations/:orgId/">
  1849. {hook('routes:organization')}
  1850. <IndexRedirect to="issues/" />
  1851. <Redirect from="teams/" to="/settings/:orgId/teams/" />
  1852. <Redirect from="teams/your-teams/" to="/settings/:orgId/teams/" />
  1853. <Redirect from="teams/all-teams/" to="/settings/:orgId/teams/" />
  1854. <Redirect from="teams/:teamId/" to="/settings/:orgId/teams/:teamId/" />
  1855. <Redirect
  1856. from="teams/:teamId/members/"
  1857. to="/settings/:orgId/teams/:teamId/members/"
  1858. />
  1859. <Redirect
  1860. from="teams/:teamId/projects/"
  1861. to="/settings/:orgId/teams/:teamId/projects/"
  1862. />
  1863. <Redirect
  1864. from="teams/:teamId/settings/"
  1865. to="/settings/:orgId/teams/:teamId/settings/"
  1866. />
  1867. <Redirect from="settings/" to="/settings/:orgId/" />
  1868. <Redirect from="api-keys/" to="/settings/:orgId/api-keys/" />
  1869. <Redirect from="api-keys/:apiKey/" to="/settings/:orgId/api-keys/:apiKey/" />
  1870. <Redirect from="members/" to="/settings/:orgId/members/" />
  1871. <Redirect from="members/:memberId/" to="/settings/:orgId/members/:memberId/" />
  1872. <Redirect from="rate-limits/" to="/settings/:orgId/rate-limits/" />
  1873. <Redirect from="repos/" to="/settings/:orgId/repos/" />
  1874. </Route>
  1875. </Route>
  1876. );
  1877. const gettingStartedRoutes = (
  1878. <Fragment>
  1879. {USING_CUSTOMER_DOMAIN && (
  1880. <Fragment>
  1881. <Redirect
  1882. from="/getting-started/:projectId/"
  1883. to="/projects/:projectId/getting-started/"
  1884. />
  1885. <Redirect
  1886. from="/getting-started/:projectId/:platform/"
  1887. to="/projects/:projectId/getting-started/"
  1888. />
  1889. </Fragment>
  1890. )}
  1891. <Redirect
  1892. from="/:orgId/:projectId/getting-started/"
  1893. to="/organizations/:orgId/projects/:projectId/getting-started/"
  1894. />
  1895. <Redirect
  1896. from="/:orgId/:projectId/getting-started/:platform/"
  1897. to="/organizations/:orgId/projects/:projectId/getting-started/"
  1898. />
  1899. </Fragment>
  1900. );
  1901. const profilingRoutes = (
  1902. <Route
  1903. path="/profiling/"
  1904. component={make(() => import('sentry/views/profiling'))}
  1905. withOrgPath
  1906. >
  1907. <IndexRoute component={make(() => import('sentry/views/profiling/content'))} />
  1908. <Route
  1909. path="summary/:projectId/"
  1910. component={make(() => import('sentry/views/profiling/profileSummary'))}
  1911. />
  1912. <Route
  1913. path="profile/:projectId/differential-flamegraph/"
  1914. component={make(() => import('sentry/views/profiling/differentialFlamegraph'))}
  1915. />
  1916. <Route
  1917. path="profile/:projectId/:eventId/"
  1918. component={make(() => import('sentry/views/profiling/profilesProvider'))}
  1919. >
  1920. <Route
  1921. path="flamegraph/"
  1922. component={make(() => import('sentry/views/profiling/profileFlamechart'))}
  1923. />
  1924. </Route>
  1925. </Route>
  1926. );
  1927. const metricsRoutes = (
  1928. <Fragment>
  1929. <Route
  1930. path="/metrics/"
  1931. component={make(() => import('sentry/views/metrics'))}
  1932. withOrgPath
  1933. >
  1934. <IndexRoute component={make(() => import('sentry/views/metrics/metrics'))} />
  1935. </Route>
  1936. {/* TODO(ddm): fade this out */}
  1937. <Redirect from="/ddm/" to="/metrics/" />
  1938. </Fragment>
  1939. );
  1940. // Support for deprecated URLs (pre-Sentry 10). We just redirect users to new
  1941. // canonical URLs.
  1942. //
  1943. // XXX(epurkhiser): Can these be moved over to the legacyOrgRedirects routes,
  1944. // or do these need to be nested into the OrganizationLayout tree?
  1945. const legacyOrgRedirects = (
  1946. <Route path="/:orgId/:projectId/">
  1947. <IndexRoute
  1948. component={errorHandler(
  1949. redirectDeprecatedProjectRoute(
  1950. ({orgId, projectId}) => `/organizations/${orgId}/issues/?project=${projectId}`
  1951. )
  1952. )}
  1953. />
  1954. <Route
  1955. path="issues/"
  1956. component={errorHandler(
  1957. redirectDeprecatedProjectRoute(
  1958. ({orgId, projectId}) => `/organizations/${orgId}/issues/?project=${projectId}`
  1959. )
  1960. )}
  1961. />
  1962. <Route
  1963. path="dashboard/"
  1964. component={errorHandler(
  1965. redirectDeprecatedProjectRoute(
  1966. ({orgId, projectId}) =>
  1967. `/organizations/${orgId}/dashboards/?project=${projectId}`
  1968. )
  1969. )}
  1970. />
  1971. <Route
  1972. path="user-feedback/"
  1973. component={errorHandler(
  1974. redirectDeprecatedProjectRoute(
  1975. ({orgId, projectId}) =>
  1976. `/organizations/${orgId}/user-feedback/?project=${projectId}`
  1977. )
  1978. )}
  1979. />
  1980. <Route
  1981. path="releases/"
  1982. component={errorHandler(
  1983. redirectDeprecatedProjectRoute(
  1984. ({orgId, projectId}) =>
  1985. `/organizations/${orgId}/releases/?project=${projectId}`
  1986. )
  1987. )}
  1988. />
  1989. <Route
  1990. path="releases/:version/"
  1991. component={errorHandler(
  1992. redirectDeprecatedProjectRoute(
  1993. ({orgId, projectId, router}) =>
  1994. `/organizations/${orgId}/releases/${router.params.version}/?project=${projectId}`
  1995. )
  1996. )}
  1997. />
  1998. <Route
  1999. path="releases/:version/new-events/"
  2000. component={errorHandler(
  2001. redirectDeprecatedProjectRoute(
  2002. ({orgId, projectId, router}) =>
  2003. `/organizations/${orgId}/releases/${router.params.version}/new-events/?project=${projectId}`
  2004. )
  2005. )}
  2006. />
  2007. <Route
  2008. path="releases/:version/all-events/"
  2009. component={errorHandler(
  2010. redirectDeprecatedProjectRoute(
  2011. ({orgId, projectId, router}) =>
  2012. `/organizations/${orgId}/releases/${router.params.version}/all-events/?project=${projectId}`
  2013. )
  2014. )}
  2015. />
  2016. <Route
  2017. path="releases/:version/commits/"
  2018. component={errorHandler(
  2019. redirectDeprecatedProjectRoute(
  2020. ({orgId, projectId, router}) =>
  2021. `/organizations/${orgId}/releases/${router.params.version}/commits/?project=${projectId}`
  2022. )
  2023. )}
  2024. />
  2025. </Route>
  2026. );
  2027. const organizationRoutes = (
  2028. <Route component={errorHandler(OrganizationLayout)}>
  2029. {settingsRoutes}
  2030. {projectsRoutes}
  2031. {dashboardRoutes}
  2032. {userFeedbackRoutes}
  2033. {feedbackv2Routes}
  2034. {issueListRoutes}
  2035. {issueDetailsRoutes}
  2036. {alertRoutes}
  2037. {cronsRoutes}
  2038. {replayRoutes}
  2039. {releasesRoutes}
  2040. {activityRoutes}
  2041. {statsRoutes}
  2042. {discoverRoutes}
  2043. {performanceRoutes}
  2044. {insightsRoutes}
  2045. {llmMonitoringRoutes}
  2046. {profilingRoutes}
  2047. {metricsRoutes}
  2048. {gettingStartedRoutes}
  2049. {adminManageRoutes}
  2050. {legacyOrganizationRootRoutes}
  2051. {legacyOrgRedirects}
  2052. </Route>
  2053. );
  2054. const legacyRedirectRoutes = (
  2055. <Route path="/:orgId/">
  2056. <IndexRedirect to="/organizations/:orgId/" />
  2057. <Route path=":projectId/settings/">
  2058. <Redirect from="teams/" to="/settings/:orgId/projects/:projectId/teams/" />
  2059. <Redirect from="alerts/" to="/settings/:orgId/projects/:projectId/alerts/" />
  2060. <Redirect
  2061. from="alerts/rules/"
  2062. to="/settings/:orgId/projects/:projectId/alerts/rules/"
  2063. />
  2064. <Redirect
  2065. from="alerts/rules/new/"
  2066. to="/settings/:orgId/projects/:projectId/alerts/rules/new/"
  2067. />
  2068. <Redirect
  2069. from="alerts/rules/:ruleId/"
  2070. to="/settings/:orgId/projects/:projectId/alerts/rules/:ruleId/"
  2071. />
  2072. <Redirect
  2073. from="environments/"
  2074. to="/settings/:orgId/projects/:projectId/environments/"
  2075. />
  2076. <Redirect
  2077. from="environments/hidden/"
  2078. to="/settings/:orgId/projects/:projectId/environments/hidden/"
  2079. />
  2080. <Redirect from="tags/" to="/settings/projects/:orgId/projects/:projectId/tags/" />
  2081. <Redirect
  2082. from="issue-tracking/"
  2083. to="/settings/:orgId/projects/:projectId/issue-tracking/"
  2084. />
  2085. <Redirect
  2086. from="release-tracking/"
  2087. to="/settings/:orgId/projects/:projectId/release-tracking/"
  2088. />
  2089. <Redirect
  2090. from="ownership/"
  2091. to="/settings/:orgId/projects/:projectId/ownership/"
  2092. />
  2093. <Redirect
  2094. from="data-forwarding/"
  2095. to="/settings/:orgId/projects/:projectId/data-forwarding/"
  2096. />
  2097. <Redirect
  2098. from="debug-symbols/"
  2099. to="/settings/:orgId/projects/:projectId/debug-symbols/"
  2100. />
  2101. <Redirect
  2102. from="processing-issues/"
  2103. to="/settings/:orgId/projects/:projectId/processing-issues/"
  2104. />
  2105. <Redirect from="filters/" to="/settings/:orgId/projects/:projectId/filters/" />
  2106. <Redirect from="hooks/" to="/settings/:orgId/projects/:projectId/hooks/" />
  2107. <Redirect from="keys/" to="/settings/:orgId/projects/:projectId/keys/" />
  2108. <Redirect
  2109. from="keys/:keyId/"
  2110. to="/settings/:orgId/projects/:projectId/keys/:keyId/"
  2111. />
  2112. <Redirect
  2113. from="user-feedback/"
  2114. to="/settings/:orgId/projects/:projectId/user-feedback/"
  2115. />
  2116. <Redirect
  2117. from="security-headers/"
  2118. to="/settings/:orgId/projects/:projectId/security-headers/"
  2119. />
  2120. <Redirect
  2121. from="security-headers/csp/"
  2122. to="/settings/:orgId/projects/:projectId/security-headers/csp/"
  2123. />
  2124. <Redirect
  2125. from="security-headers/expect-ct/"
  2126. to="/settings/:orgId/projects/:projectId/security-headers/expect-ct/"
  2127. />
  2128. <Redirect
  2129. from="security-headers/hpkp/"
  2130. to="/settings/:orgId/projects/:projectId/security-headers/hpkp/"
  2131. />
  2132. <Redirect from="plugins/" to="/settings/:orgId/projects/:projectId/plugins/" />
  2133. <Redirect
  2134. from="plugins/:pluginId/"
  2135. to="/settings/:orgId/projects/:projectId/plugins/:pluginId/"
  2136. />
  2137. <Redirect
  2138. from="integrations/:providerKey/"
  2139. to="/settings/:orgId/projects/:projectId/integrations/:providerKey/"
  2140. />
  2141. </Route>
  2142. <Redirect from=":projectId/group/:groupId/" to="issues/:groupId/" />
  2143. <Redirect
  2144. from=":projectId/issues/:groupId/"
  2145. to="/organizations/:orgId/issues/:groupId/"
  2146. />
  2147. <Redirect
  2148. from=":projectId/issues/:groupId/events/"
  2149. to="/organizations/:orgId/issues/:groupId/events/"
  2150. />
  2151. <Redirect
  2152. from=":projectId/issues/:groupId/events/:eventId/"
  2153. to="/organizations/:orgId/issues/:groupId/events/:eventId/"
  2154. />
  2155. <Redirect
  2156. from=":projectId/issues/:groupId/tags/"
  2157. to="/organizations/:orgId/issues/:groupId/tags/"
  2158. />
  2159. <Redirect
  2160. from=":projectId/issues/:groupId/tags/:tagKey/"
  2161. to="/organizations/:orgId/issues/:groupId/tags/:tagKey/"
  2162. />
  2163. <Redirect
  2164. from=":projectId/issues/:groupId/feedback/"
  2165. to="/organizations/:orgId/issues/:groupId/feedback/"
  2166. />
  2167. <Redirect
  2168. from=":projectId/issues/:groupId/similar/"
  2169. to="/organizations/:orgId/issues/:groupId/similar/"
  2170. />
  2171. <Redirect
  2172. from=":projectId/issues/:groupId/merged/"
  2173. to="/organizations/:orgId/issues/:groupId/merged/"
  2174. />
  2175. <Route
  2176. path=":projectId/events/:eventId/"
  2177. component={errorHandler(ProjectEventRedirect)}
  2178. />
  2179. </Route>
  2180. );
  2181. const appRoutes = (
  2182. <Route>
  2183. {experimentalSpaRoutes}
  2184. <Route path="/" component={errorHandler(App)}>
  2185. {rootRoutes}
  2186. {organizationRoutes}
  2187. {legacyRedirectRoutes}
  2188. <Route path="*" component={errorHandler(RouteNotFound)} />
  2189. </Route>
  2190. </Route>
  2191. );
  2192. return appRoutes;
  2193. }
  2194. // We load routes both when initializing the SDK (for routing integrations) and
  2195. // when the app renders Main. Memoize to avoid rebuilding the route tree.
  2196. export const routes = memoize(buildRoutes);
  2197. // Exported for use in tests.
  2198. export {buildRoutes};
  2199. function NoOp({children}: {children: JSX.Element}) {
  2200. return children;
  2201. }