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