routes.tsx 71 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244
  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('Metrics Details')}
  526. path=":mri/"
  527. component={make(
  528. () => import('sentry/views/settings/projectMetrics/projectMetricsDetails')
  529. )}
  530. />
  531. </Route>
  532. <Route
  533. path="replays/"
  534. name={t('Replays')}
  535. component={make(() => import('sentry/views/settings/project/projectReplays'))}
  536. />
  537. <Route path="source-maps/" name={t('Source Maps')}>
  538. <IndexRoute
  539. component={make(() => import('sentry/views/settings/projectSourceMaps'))}
  540. />
  541. <Route
  542. path="artifact-bundles/"
  543. name={t('Artifact Bundles')}
  544. component={make(() => import('sentry/views/settings/projectSourceMaps'))}
  545. >
  546. <Route
  547. name={t('Artifact Bundle')}
  548. path=":bundleId/"
  549. component={make(() => import('sentry/views/settings/projectSourceMaps'))}
  550. />
  551. </Route>
  552. <Route
  553. path="release-bundles/"
  554. name={t('Release Bundles')}
  555. component={make(() => import('sentry/views/settings/projectSourceMaps'))}
  556. >
  557. <Route
  558. name={t('Release Bundle')}
  559. path=":bundleId/"
  560. component={make(() => import('sentry/views/settings/projectSourceMaps'))}
  561. />
  562. </Route>
  563. <Redirect from=":name/" to="release-bundles/:name/" />
  564. </Route>
  565. <Route
  566. path="processing-issues/"
  567. name={t('Processing Issues')}
  568. component={make(
  569. () => import('sentry/views/settings/project/projectProcessingIssues')
  570. )}
  571. />
  572. <Route
  573. path="filters/"
  574. name={t('Inbound Filters')}
  575. component={make(() => import('sentry/views/settings/project/projectFilters'))}
  576. >
  577. <IndexRedirect to="data-filters/" />
  578. <Route path=":filterType/" />
  579. </Route>
  580. <Redirect from="dynamic-sampling/" to="performance/" />
  581. <Route
  582. path="issue-grouping/"
  583. name={t('Issue Grouping')}
  584. component={make(() => import('sentry/views/settings/projectIssueGrouping'))}
  585. />
  586. <Route
  587. path="hooks/"
  588. name={t('Service Hooks')}
  589. component={make(
  590. () => import('sentry/views/settings/project/projectServiceHooks')
  591. )}
  592. />
  593. <Route
  594. path="hooks/new/"
  595. name={t('Create Service Hook')}
  596. component={make(
  597. () => import('sentry/views/settings/project/projectCreateServiceHook')
  598. )}
  599. />
  600. <Route
  601. path="hooks/:hookId/"
  602. name={t('Service Hook Details')}
  603. component={make(
  604. () => import('sentry/views/settings/project/projectServiceHookDetails')
  605. )}
  606. />
  607. <Route path="keys/" name={t('Client Keys')}>
  608. <IndexRoute
  609. component={make(() => import('sentry/views/settings/project/projectKeys/list'))}
  610. />
  611. <Route
  612. path=":keyId/"
  613. name={t('Details')}
  614. component={make(
  615. () => import('sentry/views/settings/project/projectKeys/details')
  616. )}
  617. />
  618. </Route>
  619. <Route
  620. path="loader-script/"
  621. name={t('Loader Script')}
  622. component={make(() => import('sentry/views/settings/project/loaderScript'))}
  623. />
  624. <Redirect from="csp/" to="security-headers/" />
  625. <Route path="security-headers/" name={t('Security Headers')}>
  626. <IndexRoute
  627. component={make(() => import('sentry/views/settings/projectSecurityHeaders'))}
  628. />
  629. <Route
  630. path="csp/"
  631. name={t('Content Security Policy')}
  632. component={make(
  633. () => import('sentry/views/settings/projectSecurityHeaders/csp')
  634. )}
  635. />
  636. <Route
  637. path="expect-ct/"
  638. name={t('Certificate Transparency')}
  639. component={make(
  640. () => import('sentry/views/settings/projectSecurityHeaders/expectCt')
  641. )}
  642. />
  643. <Route
  644. path="hpkp/"
  645. name={t('HPKP')}
  646. component={make(
  647. () => import('sentry/views/settings/projectSecurityHeaders/hpkp')
  648. )}
  649. />
  650. </Route>
  651. <Route path="plugins/" name={t('Legacy Integrations')}>
  652. <IndexRoute
  653. component={make(() => import('sentry/views/settings/projectPlugins'))}
  654. />
  655. <Route
  656. path=":pluginId/"
  657. name={t('Integration Details')}
  658. component={make(() => import('sentry/views/settings/projectPlugins/details'))}
  659. />
  660. </Route>
  661. </Route>
  662. );
  663. const orgSettingsRoutes = (
  664. <Route
  665. component={make(
  666. () => import('sentry/views/settings/organization/organizationSettingsLayout')
  667. )}
  668. >
  669. {hook('routes:organization')}
  670. {!USING_CUSTOMER_DOMAIN && (
  671. <IndexRoute
  672. name={t('General')}
  673. component={make(
  674. () => import('sentry/views/settings/organizationGeneralSettings')
  675. )}
  676. />
  677. )}
  678. {USING_CUSTOMER_DOMAIN && (
  679. <Route
  680. path="/settings/organization/"
  681. name={t('General')}
  682. component={make(
  683. () => import('sentry/views/settings/organizationGeneralSettings')
  684. )}
  685. />
  686. )}
  687. <Route
  688. path="projects/"
  689. name={t('Projects')}
  690. component={make(() => import('sentry/views/settings/organizationProjects'))}
  691. />
  692. <Route path="api-keys/" name={t('API Key')}>
  693. <IndexRoute
  694. component={make(() => import('sentry/views/settings/organizationApiKeys'))}
  695. />
  696. <Route
  697. path=":apiKey/"
  698. name={t('Details')}
  699. component={make(
  700. () =>
  701. import(
  702. 'sentry/views/settings/organizationApiKeys/organizationApiKeyDetails'
  703. )
  704. )}
  705. />
  706. </Route>
  707. <Route
  708. path="audit-log/"
  709. name={t('Audit Log')}
  710. component={make(() => import('sentry/views/settings/organizationAuditLog'))}
  711. />
  712. <Route
  713. path="auth/"
  714. name={t('Auth Providers')}
  715. component={make(() => import('sentry/views/settings/organizationAuth'))}
  716. />
  717. <Redirect from="members/requests" to="members/" />
  718. <Route path="members/" name={t('Members')}>
  719. <Route
  720. component={make(
  721. () =>
  722. import(
  723. 'sentry/views/settings/organizationMembers/organizationMembersWrapper'
  724. )
  725. )}
  726. >
  727. <IndexRoute
  728. component={make(
  729. () =>
  730. import(
  731. 'sentry/views/settings/organizationMembers/organizationMembersList'
  732. )
  733. )}
  734. />
  735. </Route>
  736. <Route
  737. path=":memberId/"
  738. name={t('Details')}
  739. component={make(
  740. () =>
  741. import('sentry/views/settings/organizationMembers/organizationMemberDetail')
  742. )}
  743. />
  744. </Route>
  745. <Route
  746. path="rate-limits/"
  747. name={t('Rate Limits')}
  748. component={make(() => import('sentry/views/settings/organizationRateLimits'))}
  749. />
  750. <Route
  751. path="relay/"
  752. name={t('Relay')}
  753. component={make(() => import('sentry/views/settings/organizationRelay'))}
  754. />
  755. <Route
  756. path="repos/"
  757. name={t('Repositories')}
  758. component={make(() => import('sentry/views/settings/organizationRepositories'))}
  759. />
  760. <Route
  761. path="settings/"
  762. component={make(
  763. () => import('sentry/views/settings/organizationGeneralSettings')
  764. )}
  765. />
  766. <Route path="security-and-privacy/" name={t('Security & Privacy')}>
  767. <IndexRoute
  768. component={make(
  769. () => import('sentry/views/settings/organizationSecurityAndPrivacy')
  770. )}
  771. />
  772. <Route
  773. path="advanced-data-scrubbing/:scrubbingId/"
  774. component={make(
  775. () => import('sentry/views/settings/organizationSecurityAndPrivacy')
  776. )}
  777. />
  778. </Route>
  779. <Route path="teams/" name={t('Teams')}>
  780. <IndexRoute
  781. component={make(() => import('sentry/views/settings/organizationTeams'))}
  782. />
  783. <Route
  784. path=":teamId/"
  785. name={t('Team')}
  786. component={make(
  787. () => import('sentry/views/settings/organizationTeams/teamDetails')
  788. )}
  789. >
  790. <IndexRedirect to="members/" />
  791. <Route
  792. path="members/"
  793. name={t('Members')}
  794. component={make(
  795. () => import('sentry/views/settings/organizationTeams/teamMembers')
  796. )}
  797. />
  798. <Route
  799. path="notifications/"
  800. name={t('Notifications')}
  801. component={make(
  802. () => import('sentry/views/settings/organizationTeams/teamNotifications')
  803. )}
  804. />
  805. <Route
  806. path="projects/"
  807. name={t('Projects')}
  808. component={make(
  809. () => import('sentry/views/settings/organizationTeams/teamProjects')
  810. )}
  811. />
  812. <Route
  813. path="settings/"
  814. name={t('Settings')}
  815. component={make(
  816. () => import('sentry/views/settings/organizationTeams/teamSettings')
  817. )}
  818. />
  819. </Route>
  820. </Route>
  821. <Redirect from="plugins/" to="integrations/" />
  822. <Route path="plugins/" name={t('Integrations')}>
  823. <Route
  824. path=":integrationSlug/"
  825. name={t('Integration Details')}
  826. component={make(
  827. () =>
  828. import('sentry/views/settings/organizationIntegrations/pluginDetailedView')
  829. )}
  830. />
  831. </Route>
  832. <Redirect from="sentry-apps/" to="integrations/" />
  833. <Route path="sentry-apps/" name={t('Integrations')}>
  834. <Route
  835. path=":integrationSlug"
  836. name={t('Details')}
  837. component={make(
  838. () =>
  839. import(
  840. 'sentry/views/settings/organizationIntegrations/sentryAppDetailedView'
  841. )
  842. )}
  843. />
  844. </Route>
  845. <Redirect from="document-integrations/" to="integrations/" />
  846. <Route path="document-integrations/" name={t('Integrations')}>
  847. <Route
  848. path=":integrationSlug"
  849. name={t('Details')}
  850. component={make(
  851. () =>
  852. import(
  853. 'sentry/views/settings/organizationIntegrations/docIntegrationDetailedView'
  854. )
  855. )}
  856. />
  857. </Route>
  858. <Route path="integrations/" name={t('Integrations')}>
  859. <IndexRoute
  860. component={make(
  861. () =>
  862. import(
  863. 'sentry/views/settings/organizationIntegrations/integrationListDirectory'
  864. )
  865. )}
  866. />
  867. <Route
  868. path=":integrationSlug"
  869. name={t('Integration Details')}
  870. component={make(
  871. () =>
  872. import(
  873. 'sentry/views/settings/organizationIntegrations/integrationDetailedView'
  874. )
  875. )}
  876. />
  877. <Route
  878. path=":providerKey/:integrationId/"
  879. name={t('Configure Integration')}
  880. component={make(
  881. () =>
  882. import(
  883. 'sentry/views/settings/organizationIntegrations/configureIntegration'
  884. )
  885. )}
  886. />
  887. </Route>
  888. <Route path="developer-settings/" name={t('Custom Integrations')}>
  889. <IndexRoute
  890. component={make(
  891. () => import('sentry/views/settings/organizationDeveloperSettings')
  892. )}
  893. />
  894. <Route
  895. path="new-public/"
  896. name={t('Create Integration')}
  897. component={make(
  898. () =>
  899. import(
  900. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails'
  901. )
  902. )}
  903. />
  904. <Route
  905. path="new-internal/"
  906. name={t('Create Integration')}
  907. component={make(
  908. () =>
  909. import(
  910. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails'
  911. )
  912. )}
  913. />
  914. <Route
  915. path=":appSlug/"
  916. name={t('Edit Integration')}
  917. component={make(
  918. () =>
  919. import(
  920. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails'
  921. )
  922. )}
  923. />
  924. <Route
  925. path=":appSlug/dashboard/"
  926. name={t('Integration Dashboard')}
  927. component={make(
  928. () =>
  929. import(
  930. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDashboard'
  931. )
  932. )}
  933. />
  934. </Route>
  935. <Route path="auth-tokens/" name={t('Auth Tokens')}>
  936. <IndexRoute
  937. component={make(() => import('sentry/views/settings/organizationAuthTokens'))}
  938. />
  939. <Route
  940. path="new-token/"
  941. name={t('Create New Auth Token')}
  942. component={make(
  943. () => import('sentry/views/settings/organizationAuthTokens/newAuthToken')
  944. )}
  945. />
  946. <Route
  947. path=":tokenId/"
  948. name={t('Edit Auth Token')}
  949. component={make(
  950. () => import('sentry/views/settings/organizationAuthTokens/authTokenDetails')
  951. )}
  952. />
  953. </Route>
  954. <Route
  955. path="early-features/"
  956. name={t('Early Features')}
  957. component={make(() => import('sentry/views/settings/earlyFeatures'))}
  958. />
  959. </Route>
  960. );
  961. const legacySettingsRedirects = (
  962. <Fragment>
  963. <Redirect from=":projectId/" to="projects/:projectId/" />
  964. <Redirect from=":projectId/alerts/" to="projects/:projectId/alerts/" />
  965. <Redirect from=":projectId/alerts/rules/" to="projects/:projectId/alerts/rules/" />
  966. <Redirect
  967. from=":projectId/alerts/rules/:ruleId/"
  968. to="projects/:projectId/alerts/rules/:ruleId/"
  969. />
  970. </Fragment>
  971. );
  972. const settingsRoutes = (
  973. <Route path="/settings/" name={t('Settings')} component={SettingsWrapper}>
  974. <IndexRoute component={make(() => import('sentry/views/settings/settingsIndex'))} />
  975. {accountSettingsRoutes}
  976. <Fragment>
  977. {USING_CUSTOMER_DOMAIN && (
  978. <Route
  979. name={t('Organization')}
  980. component={withDomainRequired(NoOp)}
  981. key="orgless-settings-route"
  982. >
  983. {orgSettingsRoutes}
  984. {projectSettingsRoutes}
  985. </Route>
  986. )}
  987. <Route
  988. path=":orgId/"
  989. name={t('Organization')}
  990. component={withDomainRedirect(NoOp)}
  991. key="org-settings"
  992. >
  993. {orgSettingsRoutes}
  994. {projectSettingsRoutes}
  995. {legacySettingsRedirects}
  996. </Route>
  997. </Fragment>
  998. </Route>
  999. );
  1000. const projectsRoutes = (
  1001. <Route
  1002. path="/projects/"
  1003. component={make(() => import('sentry/views/projects/'))}
  1004. withOrgPath
  1005. >
  1006. <IndexRoute component={make(() => import('sentry/views/projectsDashboard'))} />
  1007. <Route
  1008. path="new/"
  1009. component={make(() => import('sentry/views/projectInstall/newProject'))}
  1010. />
  1011. <Route
  1012. path=":projectId/"
  1013. component={make(() => import('sentry/views/projectDetail'))}
  1014. />
  1015. <Route
  1016. path=":projectId/events/:eventId/"
  1017. component={errorHandler(ProjectEventRedirect)}
  1018. />
  1019. <Route
  1020. path=":projectId/getting-started/"
  1021. component={make(
  1022. () => import('sentry/views/projectInstall/platformOrIntegration')
  1023. )}
  1024. />
  1025. </Route>
  1026. );
  1027. const dashboardRoutes = (
  1028. <Fragment>
  1029. <Fragment>
  1030. {USING_CUSTOMER_DOMAIN && (
  1031. <Route
  1032. path="/dashboards/"
  1033. component={withDomainRequired(make(() => import('sentry/views/dashboards')))}
  1034. key="orgless-dashboards-route"
  1035. >
  1036. <IndexRoute
  1037. component={make(() => import('sentry/views/dashboards/manage'))}
  1038. />
  1039. </Route>
  1040. )}
  1041. <Route
  1042. path="/organizations/:orgId/dashboards/"
  1043. component={withDomainRedirect(make(() => import('sentry/views/dashboards')))}
  1044. key="org-dashboards"
  1045. >
  1046. <IndexRoute component={make(() => import('sentry/views/dashboards/manage'))} />
  1047. </Route>
  1048. </Fragment>
  1049. <Fragment>
  1050. {USING_CUSTOMER_DOMAIN && (
  1051. <Route
  1052. path="/dashboards/new/"
  1053. component={withDomainRequired(
  1054. make(() => import('sentry/views/dashboards/create'))
  1055. )}
  1056. key="orgless-dashboards-new-route"
  1057. >
  1058. <Route
  1059. path="widget/:widgetIndex/edit/"
  1060. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1061. />
  1062. <Route
  1063. path="widget/new/"
  1064. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1065. />
  1066. </Route>
  1067. )}
  1068. <Route
  1069. path="/organizations/:orgId/dashboards/new/"
  1070. component={withDomainRedirect(
  1071. make(() => import('sentry/views/dashboards/create'))
  1072. )}
  1073. key="org-dashboards-new"
  1074. >
  1075. <Route
  1076. path="widget/:widgetIndex/edit/"
  1077. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1078. />
  1079. <Route
  1080. path="widget/new/"
  1081. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1082. />
  1083. </Route>
  1084. </Fragment>
  1085. <Fragment>
  1086. {USING_CUSTOMER_DOMAIN && (
  1087. <Route
  1088. path="/dashboards/new/:templateId"
  1089. component={withDomainRequired(
  1090. make(() => import('sentry/views/dashboards/create'))
  1091. )}
  1092. key="orgless-dashboards-new-template-route"
  1093. >
  1094. <Route
  1095. path="widget/:widgetId/"
  1096. component={make(() => import('sentry/views/dashboards/create'))}
  1097. />
  1098. </Route>
  1099. )}
  1100. <Route
  1101. path="/organizations/:orgId/dashboards/new/:templateId"
  1102. component={withDomainRedirect(
  1103. make(() => import('sentry/views/dashboards/create'))
  1104. )}
  1105. key="org-dashboards-new-template"
  1106. >
  1107. <Route
  1108. path="widget/:widgetId/"
  1109. component={make(() => import('sentry/views/dashboards/create'))}
  1110. />
  1111. </Route>
  1112. </Fragment>
  1113. <Redirect
  1114. from="/organizations/:orgId/dashboards/:dashboardId/"
  1115. to="/organizations/:orgId/dashboard/:dashboardId/"
  1116. />
  1117. {USING_CUSTOMER_DOMAIN && (
  1118. <Redirect from="/dashboards/:dashboardId/" to="/dashboard/:dashboardId/" />
  1119. )}
  1120. <Route
  1121. path="/dashboard/:dashboardId/"
  1122. component={make(() => import('sentry/views/dashboards/view'))}
  1123. withOrgPath
  1124. >
  1125. <Route
  1126. path="widget/:widgetIndex/edit/"
  1127. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1128. />
  1129. <Route
  1130. path="widget/new/"
  1131. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1132. />
  1133. <Route
  1134. path="widget/:widgetId/"
  1135. component={make(() => import('sentry/views/dashboards/view'))}
  1136. />
  1137. </Route>
  1138. </Fragment>
  1139. );
  1140. const alertChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1141. // ALERT CHILD ROUTES
  1142. return (
  1143. <Fragment>
  1144. <IndexRoute
  1145. component={make(() => import('sentry/views/alerts/list/incidents'))}
  1146. />
  1147. <Route path="rules/">
  1148. <IndexRoute
  1149. component={make(
  1150. () => import('sentry/views/alerts/list/rules/alertRulesList')
  1151. )}
  1152. />
  1153. <Route
  1154. path="details/:ruleId/"
  1155. component={make(() => import('sentry/views/alerts/rules/metric/details'))}
  1156. />
  1157. <Route
  1158. path=":projectId/"
  1159. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1160. >
  1161. <IndexRedirect
  1162. to={
  1163. forCustomerDomain
  1164. ? '/alerts/rules/'
  1165. : '/organizations/:orgId/alerts/rules/'
  1166. }
  1167. />
  1168. <Route
  1169. path=":ruleId/"
  1170. component={make(() => import('sentry/views/alerts/edit'))}
  1171. />
  1172. </Route>
  1173. <Route path=":projectId/:ruleId/details/">
  1174. <IndexRoute
  1175. component={make(
  1176. () => import('sentry/views/alerts/rules/issue/details/ruleDetails')
  1177. )}
  1178. />
  1179. </Route>
  1180. </Route>
  1181. <Route path="metric-rules/">
  1182. <IndexRedirect
  1183. to={
  1184. forCustomerDomain ? '/alerts/rules/' : '/organizations/:orgId/alerts/rules/'
  1185. }
  1186. />
  1187. <Route
  1188. path=":projectId/"
  1189. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1190. >
  1191. <IndexRedirect
  1192. to={
  1193. forCustomerDomain
  1194. ? '/alerts/rules/'
  1195. : '/organizations/:orgId/alerts/rules/'
  1196. }
  1197. />
  1198. <Route
  1199. path=":ruleId/"
  1200. component={make(() => import('sentry/views/alerts/edit'))}
  1201. />
  1202. </Route>
  1203. </Route>
  1204. <Route
  1205. path="wizard/"
  1206. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1207. >
  1208. <IndexRoute component={make(() => import('sentry/views/alerts/wizard'))} />
  1209. </Route>
  1210. <Route
  1211. path="new/"
  1212. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1213. >
  1214. <IndexRedirect
  1215. to={
  1216. forCustomerDomain
  1217. ? '/alerts/wizard/'
  1218. : '/organizations/:orgId/alerts/wizard/'
  1219. }
  1220. />
  1221. <Route
  1222. path=":alertType/"
  1223. component={make(() => import('sentry/views/alerts/create'))}
  1224. />
  1225. </Route>
  1226. <Route
  1227. path=":alertId/"
  1228. component={make(() => import('sentry/views/alerts/incidentRedirect'))}
  1229. />
  1230. <Route
  1231. path=":projectId/"
  1232. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1233. >
  1234. <Route
  1235. path="new/"
  1236. component={make(() => import('sentry/views/alerts/create'))}
  1237. />
  1238. <Route
  1239. path="wizard/"
  1240. component={make(() => import('sentry/views/alerts/wizard'))}
  1241. />
  1242. </Route>
  1243. </Fragment>
  1244. );
  1245. };
  1246. // ALERT ROUTES
  1247. const alertRoutes = (
  1248. <Fragment>
  1249. {USING_CUSTOMER_DOMAIN && (
  1250. <Route
  1251. path="/alerts/"
  1252. component={withDomainRequired(make(() => import('sentry/views/alerts')))}
  1253. key="orgless-alerts-route"
  1254. >
  1255. {alertChildRoutes({forCustomerDomain: true})}
  1256. </Route>
  1257. )}
  1258. <Route
  1259. path="/organizations/:orgId/alerts/"
  1260. component={withDomainRedirect(make(() => import('sentry/views/alerts')))}
  1261. key="org-alerts"
  1262. >
  1263. {alertChildRoutes({forCustomerDomain: false})}
  1264. </Route>
  1265. </Fragment>
  1266. );
  1267. const cronsRoutes = (
  1268. <Route
  1269. path="/crons/"
  1270. component={make(() => import('sentry/views/monitors'))}
  1271. withOrgPath
  1272. >
  1273. <IndexRoute component={make(() => import('sentry/views/monitors/overview'))} />
  1274. <Route
  1275. path="create/"
  1276. component={make(() => import('sentry/views/monitors/create'))}
  1277. />
  1278. <Redirect from=":monitorSlug/" to="/crons/" />
  1279. <Redirect from=":monitorSlug/edit/" to="/crons/" />
  1280. <Route
  1281. path=":projectId/:monitorSlug/"
  1282. component={make(() => import('sentry/views/monitors/details'))}
  1283. />
  1284. <Route
  1285. path=":projectId/:monitorSlug/edit/"
  1286. component={make(() => import('sentry/views/monitors/edit'))}
  1287. />
  1288. </Route>
  1289. );
  1290. const replayRoutes = (
  1291. <Route
  1292. path="/replays/"
  1293. component={make(() => import('sentry/views/replays/index'))}
  1294. withOrgPath
  1295. >
  1296. <IndexRoute component={make(() => import('sentry/views/replays/list'))} />
  1297. <Route
  1298. path="selectors/"
  1299. component={make(
  1300. () => import('sentry/views/replays/deadRageClick/deadRageClickList')
  1301. )}
  1302. />
  1303. <Route
  1304. path=":replaySlug/"
  1305. component={make(() => import('sentry/views/replays/details'))}
  1306. />
  1307. </Route>
  1308. );
  1309. const releasesRoutes = (
  1310. <Fragment>
  1311. <Route path="/releases/" withOrgPath>
  1312. <IndexRoute component={make(() => import('sentry/views/releases/list'))} />
  1313. <Route
  1314. path=":release/"
  1315. component={make(() => import('sentry/views/releases/detail'))}
  1316. >
  1317. <IndexRoute
  1318. component={make(() => import('sentry/views/releases/detail/overview'))}
  1319. />
  1320. <Route
  1321. path="commits/"
  1322. component={make(
  1323. () => import('sentry/views/releases/detail/commitsAndFiles/commits')
  1324. )}
  1325. />
  1326. <Route
  1327. path="files-changed/"
  1328. component={make(
  1329. () => import('sentry/views/releases/detail/commitsAndFiles/filesChanged')
  1330. )}
  1331. />
  1332. </Route>
  1333. </Route>
  1334. <Redirect
  1335. from="/releases/new-events/"
  1336. to="/organizations/:orgId/releases/:release/"
  1337. />
  1338. <Redirect
  1339. from="/releases/all-events/"
  1340. to="/organizations/:orgId/releases/:release/"
  1341. />
  1342. </Fragment>
  1343. );
  1344. const activityRoutes = (
  1345. <Route
  1346. path="/activity/"
  1347. component={make(() => import('sentry/views/organizationActivity'))}
  1348. withOrgPath
  1349. />
  1350. );
  1351. const statsRoutes = (
  1352. <Fragment>
  1353. <Route path="/stats/" withOrgPath>
  1354. <IndexRoute component={make(() => import('sentry/views/organizationStats'))} />
  1355. <Route
  1356. component={make(() => import('sentry/views/organizationStats/teamInsights'))}
  1357. >
  1358. <Route
  1359. path="issues/"
  1360. component={make(
  1361. () => import('sentry/views/organizationStats/teamInsights/issues')
  1362. )}
  1363. />
  1364. <Route
  1365. path="health/"
  1366. component={make(
  1367. () => import('sentry/views/organizationStats/teamInsights/health')
  1368. )}
  1369. />
  1370. </Route>
  1371. </Route>
  1372. <Redirect
  1373. from="/organizations/:orgId/stats/team/"
  1374. to="/organizations/:orgId/stats/issues/"
  1375. />
  1376. </Fragment>
  1377. );
  1378. // TODO(mark) Long term this /queries route should go away and /discover
  1379. // should be the canonical route for discover2. We have a redirect right now
  1380. // as /discover was for discover 1 and most of the application is linking to
  1381. // /discover/queries and not /discover
  1382. const discoverRoutes = (
  1383. <Route
  1384. path="/discover/"
  1385. component={make(() => import('sentry/views/discover'))}
  1386. withOrgPath
  1387. >
  1388. <IndexRedirect to="queries/" />
  1389. <Route
  1390. path="homepage/"
  1391. component={make(() => import('sentry/views/discover/homepage'))}
  1392. />
  1393. <Route
  1394. path="queries/"
  1395. component={make(() => import('sentry/views/discover/landing'))}
  1396. />
  1397. <Route
  1398. path="results/"
  1399. component={make(() => import('sentry/views/discover/results'))}
  1400. />
  1401. <Route
  1402. path=":eventSlug/"
  1403. component={make(() => import('sentry/views/discover/eventDetails'))}
  1404. />
  1405. </Route>
  1406. );
  1407. const llmMonitoringRoutes = (
  1408. <Route path={`/${MODULE_BASE_URLS[ModuleName.AI]}/`} withOrgPath>
  1409. <IndexRoute component={make(() => import('sentry/views/llmMonitoring/landing'))} />
  1410. <Route
  1411. path="pipeline-type/:groupId/"
  1412. component={make(
  1413. () => import('sentry/views/llmMonitoring/llmMonitoringDetailsPage')
  1414. )}
  1415. />
  1416. </Route>
  1417. );
  1418. const insightsSubRoutes = (
  1419. <Fragment>
  1420. <Route path={`${MODULE_BASE_URLS[ModuleName.DB]}/`}>
  1421. <IndexRoute
  1422. component={make(
  1423. () => import('sentry/views/performance/database/databaseLandingPage')
  1424. )}
  1425. />
  1426. <Route
  1427. path="spans/span/:groupId/"
  1428. component={make(
  1429. () => import('sentry/views/performance/database/databaseSpanSummaryPage')
  1430. )}
  1431. />
  1432. </Route>
  1433. <Route path={`${MODULE_BASE_URLS[ModuleName.HTTP]}/`}>
  1434. <IndexRoute
  1435. component={make(() => import('sentry/views/performance/http/httpLandingPage'))}
  1436. />
  1437. <Route
  1438. path="domains/"
  1439. component={make(
  1440. () => import('sentry/views/performance/http/httpDomainSummaryPage')
  1441. )}
  1442. />
  1443. </Route>
  1444. <Route path={`${MODULE_BASE_URLS[ModuleName.CACHE]}/`}>
  1445. <IndexRoute
  1446. component={make(
  1447. () => import('sentry/views/performance/cache/cacheLandingPage')
  1448. )}
  1449. />
  1450. </Route>
  1451. <Route path={`${MODULE_BASE_URLS[ModuleName.VITAL]}/`}>
  1452. <IndexRoute
  1453. component={make(
  1454. () =>
  1455. import('sentry/views/performance/browser/webVitals/webVitalsLandingPage')
  1456. )}
  1457. />
  1458. <Route
  1459. path="overview/"
  1460. component={make(
  1461. () => import('sentry/views/performance/browser/webVitals/pageOverview')
  1462. )}
  1463. />
  1464. </Route>
  1465. <Route path={`${MODULE_BASE_URLS[ModuleName.RESOURCE]}/`}>
  1466. <IndexRoute
  1467. component={make(
  1468. () => import('sentry/views/performance/browser/resources/index')
  1469. )}
  1470. />
  1471. <Route
  1472. path="spans/span/:groupId/"
  1473. component={make(
  1474. () =>
  1475. import(
  1476. 'sentry/views/performance/browser/resources/resourceSummaryPage/index'
  1477. )
  1478. )}
  1479. />
  1480. </Route>
  1481. <Route path={`${MODULE_BASE_URLS[ModuleName.QUEUE]}/`}>
  1482. <IndexRoute
  1483. component={make(
  1484. () => import('sentry/views/performance/queues/queuesLandingPage')
  1485. )}
  1486. />
  1487. <Route
  1488. path="destination/"
  1489. component={make(
  1490. () =>
  1491. import(
  1492. 'sentry/views/performance/queues/destinationSummary/destinationSummaryPage'
  1493. )
  1494. )}
  1495. />
  1496. </Route>
  1497. <Route path={`${MODULE_BASE_URLS[ModuleName.SCREEN_LOAD]}/`}>
  1498. <IndexRoute
  1499. component={make(() => import('sentry/views/performance/mobile/screenload'))}
  1500. />
  1501. <Route
  1502. path="spans/"
  1503. component={make(
  1504. () => import('sentry/views/performance/mobile/screenload/screenLoadSpans')
  1505. )}
  1506. />
  1507. </Route>
  1508. <Route path={`${MODULE_BASE_URLS[ModuleName.APP_START]}/`}>
  1509. <IndexRoute
  1510. component={make(() => import('sentry/views/performance/mobile/appStarts'))}
  1511. />
  1512. <Route
  1513. path="spans/"
  1514. component={make(
  1515. () => import('sentry/views/performance/mobile/appStarts/screenSummary')
  1516. )}
  1517. />
  1518. </Route>
  1519. <Route path={`${MODULE_BASE_URLS[ModuleName.MOBILE_UI]}/`}>
  1520. <IndexRoute
  1521. component={make(() => import('sentry/views/performance/mobile/ui'))}
  1522. />
  1523. <Route
  1524. path="spans/"
  1525. component={make(
  1526. () => import('sentry/views/performance/mobile/ui/screenSummary')
  1527. )}
  1528. />
  1529. </Route>
  1530. <Route path={`${MODULE_BASE_URLS[ModuleName.AI]}/`}>
  1531. <IndexRoute
  1532. component={make(() => import('sentry/views/llmMonitoring/landing'))}
  1533. />
  1534. <Route
  1535. path="pipeline-type/:groupId/"
  1536. component={make(
  1537. () => import('sentry/views/llmMonitoring/llmMonitoringDetailsPage')
  1538. )}
  1539. />
  1540. </Route>
  1541. </Fragment>
  1542. );
  1543. const insightsRoutes = (
  1544. <Route path="/insights/" withOrgPath>
  1545. {insightsSubRoutes}
  1546. </Route>
  1547. );
  1548. const performanceRoutes = (
  1549. <Route
  1550. path="/performance/"
  1551. component={make(() => import('sentry/views/performance'))}
  1552. withOrgPath
  1553. >
  1554. <IndexRoute component={make(() => import('sentry/views/performance/content'))} />
  1555. <Route
  1556. path="trends/"
  1557. component={make(() => import('sentry/views/performance/trends'))}
  1558. />
  1559. <Route path="traces/">
  1560. <IndexRoute component={make(() => import('sentry/views/performance/traces'))} />
  1561. </Route>
  1562. <Route path="summary/">
  1563. <IndexRoute
  1564. component={make(
  1565. () =>
  1566. import('sentry/views/performance/transactionSummary/transactionOverview')
  1567. )}
  1568. />
  1569. <Route
  1570. path="replays/"
  1571. component={make(
  1572. () => import('sentry/views/performance/transactionSummary/transactionReplays')
  1573. )}
  1574. />
  1575. <Route
  1576. path="vitals/"
  1577. component={make(
  1578. () => import('sentry/views/performance/transactionSummary/transactionVitals')
  1579. )}
  1580. />
  1581. <Route
  1582. path="tags/"
  1583. component={make(
  1584. () => import('sentry/views/performance/transactionSummary/transactionTags')
  1585. )}
  1586. />
  1587. <Route
  1588. path="events/"
  1589. component={make(
  1590. () => import('sentry/views/performance/transactionSummary/transactionEvents')
  1591. )}
  1592. />
  1593. <Route
  1594. path="anomalies/"
  1595. component={make(
  1596. () =>
  1597. import('sentry/views/performance/transactionSummary/transactionAnomalies')
  1598. )}
  1599. />
  1600. <Route
  1601. path="profiles/"
  1602. component={make(
  1603. () =>
  1604. import('sentry/views/performance/transactionSummary/transactionProfiles')
  1605. )}
  1606. />
  1607. <Route
  1608. path="aggregateWaterfall/"
  1609. component={make(
  1610. () =>
  1611. import('sentry/views/performance/transactionSummary/aggregateSpanWaterfall')
  1612. )}
  1613. />
  1614. <Route path="spans/">
  1615. <IndexRoute
  1616. component={make(
  1617. () => import('sentry/views/performance/transactionSummary/transactionSpans')
  1618. )}
  1619. />
  1620. <Route
  1621. path=":spanSlug/"
  1622. component={make(
  1623. () =>
  1624. import(
  1625. 'sentry/views/performance/transactionSummary/transactionSpans/spanDetails'
  1626. )
  1627. )}
  1628. />
  1629. </Route>
  1630. </Route>
  1631. <Route
  1632. path="vitaldetail/"
  1633. component={make(() => import('sentry/views/performance/vitalDetail'))}
  1634. />
  1635. <Route
  1636. path="trace/:traceSlug/"
  1637. component={make(() => import('sentry/views/performance/traceDetails'))}
  1638. />
  1639. {insightsSubRoutes}
  1640. <Route
  1641. path=":eventSlug/"
  1642. component={make(() => import('sentry/views/performance/transactionDetails'))}
  1643. />
  1644. </Route>
  1645. );
  1646. const userFeedbackRoutes = (
  1647. <Route
  1648. path="/user-feedback/"
  1649. component={make(() => import('sentry/views/userFeedback'))}
  1650. withOrgPath
  1651. />
  1652. );
  1653. const feedbackv2Routes = (
  1654. <Route
  1655. path="/feedback/"
  1656. component={make(() => import('sentry/views/feedback/index'))}
  1657. withOrgPath
  1658. >
  1659. <IndexRoute
  1660. component={make(() => import('sentry/views/feedback/feedbackListPage'))}
  1661. />
  1662. </Route>
  1663. );
  1664. const issueListRoutes = (
  1665. <Route path="/issues" component={errorHandler(IssueListContainer)} withOrgPath>
  1666. <IndexRoute component={errorHandler(IssueListOverview)} />
  1667. <Route path="searches/:searchId/" component={errorHandler(IssueListOverview)} />
  1668. </Route>
  1669. );
  1670. // Once org issues is complete, these routes can be nested under
  1671. // /organizations/:orgId/issues
  1672. const issueTabs = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1673. const hoc = forCustomerDomain ? withDomainRequired : x => x;
  1674. return (
  1675. <Fragment>
  1676. <IndexRoute
  1677. component={hoc(
  1678. make(() => import('sentry/views/issueDetails/groupEventDetails'))
  1679. )}
  1680. />
  1681. <Route
  1682. path={TabPaths[Tab.REPLAYS]}
  1683. component={hoc(make(() => import('sentry/views/issueDetails/groupReplays')))}
  1684. />
  1685. <Route
  1686. path={TabPaths[Tab.ACTIVITY]}
  1687. component={hoc(make(() => import('sentry/views/issueDetails/groupActivity')))}
  1688. />
  1689. <Route
  1690. path={TabPaths[Tab.EVENTS]}
  1691. component={hoc(make(() => import('sentry/views/issueDetails/groupEvents')))}
  1692. />
  1693. <Route
  1694. path={TabPaths[Tab.TAGS]}
  1695. component={hoc(make(() => import('sentry/views/issueDetails/groupTags')))}
  1696. />
  1697. <Route
  1698. path={`${TabPaths[Tab.TAGS]}:tagKey/`}
  1699. component={make(() => import('sentry/views/issueDetails/groupTagValues'))}
  1700. />
  1701. <Route
  1702. path={TabPaths[Tab.USER_FEEDBACK]}
  1703. component={hoc(
  1704. make(() => import('sentry/views/issueDetails/groupUserFeedback'))
  1705. )}
  1706. />
  1707. <Route
  1708. path={TabPaths[Tab.ATTACHMENTS]}
  1709. component={hoc(
  1710. make(() => import('sentry/views/issueDetails/groupEventAttachments'))
  1711. )}
  1712. />
  1713. <Route
  1714. path={TabPaths[Tab.SIMILAR_ISSUES]}
  1715. component={hoc(
  1716. make(() => import('sentry/views/issueDetails/groupSimilarIssues'))
  1717. )}
  1718. />
  1719. <Route
  1720. path={TabPaths[Tab.MERGED]}
  1721. component={hoc(make(() => import('sentry/views/issueDetails/groupMerged')))}
  1722. />
  1723. </Fragment>
  1724. );
  1725. };
  1726. const issueDetailsChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => (
  1727. <Fragment>
  1728. {issueTabs({forCustomerDomain})}
  1729. <Route path={`${TabPaths[Tab.EVENTS]}:eventId/`}>
  1730. {issueTabs({forCustomerDomain})}
  1731. </Route>
  1732. </Fragment>
  1733. );
  1734. const issueDetailsRoutes = (
  1735. <Fragment>
  1736. <Route
  1737. path="/organizations/:orgId/issues/:groupId/"
  1738. component={withDomainRedirect(
  1739. make(() => import('sentry/views/issueDetails/groupDetails'))
  1740. )}
  1741. key="org-issues-group-id"
  1742. >
  1743. {issueDetailsChildRoutes({forCustomerDomain: false})}
  1744. </Route>
  1745. {USING_CUSTOMER_DOMAIN && (
  1746. <Route
  1747. path="/issues/:groupId/"
  1748. component={withDomainRequired(
  1749. make(() => import('sentry/views/issueDetails/groupDetails'))
  1750. )}
  1751. key="orgless-issues-group-id-route"
  1752. >
  1753. {issueDetailsChildRoutes({forCustomerDomain: true})}
  1754. </Route>
  1755. )}
  1756. </Fragment>
  1757. );
  1758. // These are the "manage" pages. For sentry.io, these are _different_ from
  1759. // the SaaS admin routes in getsentry.
  1760. const adminManageRoutes = (
  1761. <Route
  1762. path="/manage/"
  1763. component={make(() => import('sentry/views/admin/adminLayout'))}
  1764. >
  1765. <IndexRoute component={make(() => import('sentry/views/admin/adminOverview'))} />
  1766. <Route
  1767. path="buffer/"
  1768. component={make(() => import('sentry/views/admin/adminBuffer'))}
  1769. />
  1770. <Route
  1771. path="relays/"
  1772. component={make(() => import('sentry/views/admin/adminRelays'))}
  1773. />
  1774. <Route
  1775. path="organizations/"
  1776. component={make(() => import('sentry/views/admin/adminOrganizations'))}
  1777. />
  1778. <Route
  1779. path="projects/"
  1780. component={make(() => import('sentry/views/admin/adminProjects'))}
  1781. />
  1782. <Route
  1783. path="queue/"
  1784. component={make(() => import('sentry/views/admin/adminQueue'))}
  1785. />
  1786. <Route
  1787. path="quotas/"
  1788. component={make(() => import('sentry/views/admin/adminQuotas'))}
  1789. />
  1790. <Route
  1791. path="settings/"
  1792. component={make(() => import('sentry/views/admin/adminSettings'))}
  1793. />
  1794. <Route path="users/">
  1795. <IndexRoute component={make(() => import('sentry/views/admin/adminUsers'))} />
  1796. <Route
  1797. path=":id"
  1798. component={make(() => import('sentry/views/admin/adminUserEdit'))}
  1799. />
  1800. </Route>
  1801. <Route
  1802. path="status/mail/"
  1803. component={make(() => import('sentry/views/admin/adminMail'))}
  1804. />
  1805. <Route
  1806. path="status/environment/"
  1807. component={make(() => import('sentry/views/admin/adminEnvironment'))}
  1808. />
  1809. <Route
  1810. path="status/packages/"
  1811. component={make(() => import('sentry/views/admin/adminPackages'))}
  1812. />
  1813. <Route
  1814. path="status/warnings/"
  1815. component={make(() => import('sentry/views/admin/adminWarnings'))}
  1816. />
  1817. </Route>
  1818. );
  1819. // XXX(epurkhiser): This should probably go away. It's not totally clear to
  1820. // me why we need the OrganizationRoot root container.
  1821. const legacyOrganizationRootRoutes = (
  1822. <Route component={errorHandler(OrganizationRoot)}>
  1823. <Redirect from="/organizations/:orgId/teams/new/" to="/settings/:orgId/teams/" />
  1824. <Route path="/organizations/:orgId/">
  1825. {hook('routes:organization')}
  1826. <IndexRedirect to="/organizations/:orgId/issues/" />
  1827. <Redirect from="/organizations/:orgId/teams/" to="/settings/:orgId/teams/" />
  1828. <Redirect
  1829. from="/organizations/:orgId/teams/your-teams/"
  1830. to="/settings/:orgId/teams/"
  1831. />
  1832. <Redirect
  1833. from="/organizations/:orgId/teams/all-teams/"
  1834. to="/settings/:orgId/teams/"
  1835. />
  1836. <Redirect
  1837. from="/organizations/:orgId/teams/:teamId/"
  1838. to="/settings/:orgId/teams/:teamId/"
  1839. />
  1840. <Redirect
  1841. from="/organizations/:orgId/teams/:teamId/members/"
  1842. to="/settings/:orgId/teams/:teamId/members/"
  1843. />
  1844. <Redirect
  1845. from="/organizations/:orgId/teams/:teamId/projects/"
  1846. to="/settings/:orgId/teams/:teamId/projects/"
  1847. />
  1848. <Redirect
  1849. from="/organizations/:orgId/teams/:teamId/settings/"
  1850. to="/settings/:orgId/teams/:teamId/settings/"
  1851. />
  1852. <Redirect from="/organizations/:orgId/settings/" to="/settings/:orgId/" />
  1853. <Redirect
  1854. from="/organizations/:orgId/api-keys/"
  1855. to="/settings/:orgId/api-keys/"
  1856. />
  1857. <Redirect
  1858. from="/organizations/:orgId/api-keys/:apiKey/"
  1859. to="/settings/:orgId/api-keys/:apiKey/"
  1860. />
  1861. <Redirect from="/organizations/:orgId/members/" to="/settings/:orgId/members/" />
  1862. <Redirect
  1863. from="/organizations/:orgId/members/:memberId/"
  1864. to="/settings/:orgId/members/:memberId/"
  1865. />
  1866. <Redirect
  1867. from="/organizations/:orgId/rate-limits/"
  1868. to="/settings/:orgId/rate-limits/"
  1869. />
  1870. <Redirect from="/organizations/:orgId/repos/" to="/settings/:orgId/repos/" />
  1871. </Route>
  1872. </Route>
  1873. );
  1874. const gettingStartedRoutes = (
  1875. <Fragment>
  1876. {USING_CUSTOMER_DOMAIN && (
  1877. <Fragment>
  1878. <Redirect
  1879. from="/getting-started/:projectId/"
  1880. to="/projects/:projectId/getting-started/"
  1881. />
  1882. <Redirect
  1883. from="/getting-started/:projectId/:platform/"
  1884. to="/projects/:projectId/getting-started/"
  1885. />
  1886. </Fragment>
  1887. )}
  1888. <Redirect
  1889. from="/:orgId/:projectId/getting-started/"
  1890. to="/organizations/:orgId/projects/:projectId/getting-started/"
  1891. />
  1892. <Redirect
  1893. from="/:orgId/:projectId/getting-started/:platform/"
  1894. to="/organizations/:orgId/projects/:projectId/getting-started/"
  1895. />
  1896. </Fragment>
  1897. );
  1898. const profilingRoutes = (
  1899. <Route
  1900. path="/profiling/"
  1901. component={make(() => import('sentry/views/profiling'))}
  1902. withOrgPath
  1903. >
  1904. <IndexRoute component={make(() => import('sentry/views/profiling/content'))} />
  1905. <Route
  1906. path="summary/:projectId/"
  1907. component={make(() => import('sentry/views/profiling/profileSummary'))}
  1908. />
  1909. <Route
  1910. path="profile/:projectId/differential-flamegraph/"
  1911. component={make(() => import('sentry/views/profiling/differentialFlamegraph'))}
  1912. />
  1913. <Route
  1914. path="profile/:projectId/:eventId/"
  1915. component={make(() => import('sentry/views/profiling/profilesProvider'))}
  1916. >
  1917. <Route
  1918. path="flamegraph/"
  1919. component={make(() => import('sentry/views/profiling/profileFlamechart'))}
  1920. />
  1921. </Route>
  1922. </Route>
  1923. );
  1924. const metricsRoutes = (
  1925. <Fragment>
  1926. <Route
  1927. path="/metrics/"
  1928. component={make(() => import('sentry/views/metrics'))}
  1929. withOrgPath
  1930. >
  1931. <IndexRoute component={make(() => import('sentry/views/metrics/metrics'))} />
  1932. </Route>
  1933. {/* TODO(ddm): fade this out */}
  1934. <Redirect from="/ddm/" to="/metrics/" />
  1935. </Fragment>
  1936. );
  1937. // Support for deprecated URLs (pre-Sentry 10). We just redirect users to new
  1938. // canonical URLs.
  1939. //
  1940. // XXX(epurkhiser): Can these be moved over to the legacyOrgRedirects routes,
  1941. // or do these need to be nested into the OrganizationLayout tree?
  1942. const legacyOrgRedirects = (
  1943. <Route path="/:orgId/:projectId/">
  1944. <IndexRoute
  1945. component={errorHandler(
  1946. redirectDeprecatedProjectRoute(
  1947. ({orgId, projectId}) => `/organizations/${orgId}/issues/?project=${projectId}`
  1948. )
  1949. )}
  1950. />
  1951. <Route
  1952. path="issues/"
  1953. component={errorHandler(
  1954. redirectDeprecatedProjectRoute(
  1955. ({orgId, projectId}) => `/organizations/${orgId}/issues/?project=${projectId}`
  1956. )
  1957. )}
  1958. />
  1959. <Route
  1960. path="dashboard/"
  1961. component={errorHandler(
  1962. redirectDeprecatedProjectRoute(
  1963. ({orgId, projectId}) =>
  1964. `/organizations/${orgId}/dashboards/?project=${projectId}`
  1965. )
  1966. )}
  1967. />
  1968. <Route
  1969. path="user-feedback/"
  1970. component={errorHandler(
  1971. redirectDeprecatedProjectRoute(
  1972. ({orgId, projectId}) =>
  1973. `/organizations/${orgId}/user-feedback/?project=${projectId}`
  1974. )
  1975. )}
  1976. />
  1977. <Route
  1978. path="releases/"
  1979. component={errorHandler(
  1980. redirectDeprecatedProjectRoute(
  1981. ({orgId, projectId}) =>
  1982. `/organizations/${orgId}/releases/?project=${projectId}`
  1983. )
  1984. )}
  1985. />
  1986. <Route
  1987. path="releases/:version/"
  1988. component={errorHandler(
  1989. redirectDeprecatedProjectRoute(
  1990. ({orgId, projectId, router}) =>
  1991. `/organizations/${orgId}/releases/${router.params.version}/?project=${projectId}`
  1992. )
  1993. )}
  1994. />
  1995. <Route
  1996. path="releases/:version/new-events/"
  1997. component={errorHandler(
  1998. redirectDeprecatedProjectRoute(
  1999. ({orgId, projectId, router}) =>
  2000. `/organizations/${orgId}/releases/${router.params.version}/new-events/?project=${projectId}`
  2001. )
  2002. )}
  2003. />
  2004. <Route
  2005. path="releases/:version/all-events/"
  2006. component={errorHandler(
  2007. redirectDeprecatedProjectRoute(
  2008. ({orgId, projectId, router}) =>
  2009. `/organizations/${orgId}/releases/${router.params.version}/all-events/?project=${projectId}`
  2010. )
  2011. )}
  2012. />
  2013. <Route
  2014. path="releases/:version/commits/"
  2015. component={errorHandler(
  2016. redirectDeprecatedProjectRoute(
  2017. ({orgId, projectId, router}) =>
  2018. `/organizations/${orgId}/releases/${router.params.version}/commits/?project=${projectId}`
  2019. )
  2020. )}
  2021. />
  2022. </Route>
  2023. );
  2024. const organizationRoutes = (
  2025. <Route component={errorHandler(OrganizationLayout)}>
  2026. {settingsRoutes}
  2027. {projectsRoutes}
  2028. {dashboardRoutes}
  2029. {userFeedbackRoutes}
  2030. {feedbackv2Routes}
  2031. {issueListRoutes}
  2032. {issueDetailsRoutes}
  2033. {alertRoutes}
  2034. {cronsRoutes}
  2035. {replayRoutes}
  2036. {releasesRoutes}
  2037. {activityRoutes}
  2038. {statsRoutes}
  2039. {discoverRoutes}
  2040. {performanceRoutes}
  2041. {insightsRoutes}
  2042. {llmMonitoringRoutes}
  2043. {profilingRoutes}
  2044. {metricsRoutes}
  2045. {gettingStartedRoutes}
  2046. {adminManageRoutes}
  2047. {legacyOrganizationRootRoutes}
  2048. {legacyOrgRedirects}
  2049. </Route>
  2050. );
  2051. const legacyRedirectRoutes = (
  2052. <Route path="/:orgId/">
  2053. <IndexRedirect to="/organizations/:orgId/" />
  2054. <Route path=":projectId/settings/">
  2055. <Redirect from="teams/" to="/settings/:orgId/projects/:projectId/teams/" />
  2056. <Redirect from="alerts/" to="/settings/:orgId/projects/:projectId/alerts/" />
  2057. <Redirect
  2058. from="alerts/rules/"
  2059. to="/settings/:orgId/projects/:projectId/alerts/rules/"
  2060. />
  2061. <Redirect
  2062. from="alerts/rules/new/"
  2063. to="/settings/:orgId/projects/:projectId/alerts/rules/new/"
  2064. />
  2065. <Redirect
  2066. from="alerts/rules/:ruleId/"
  2067. to="/settings/:orgId/projects/:projectId/alerts/rules/:ruleId/"
  2068. />
  2069. <Redirect
  2070. from="environments/"
  2071. to="/settings/:orgId/projects/:projectId/environments/"
  2072. />
  2073. <Redirect
  2074. from="environments/hidden/"
  2075. to="/settings/:orgId/projects/:projectId/environments/hidden/"
  2076. />
  2077. <Redirect from="tags/" to="/settings/projects/:orgId/projects/:projectId/tags/" />
  2078. <Redirect
  2079. from="issue-tracking/"
  2080. to="/settings/:orgId/projects/:projectId/issue-tracking/"
  2081. />
  2082. <Redirect
  2083. from="release-tracking/"
  2084. to="/settings/:orgId/projects/:projectId/release-tracking/"
  2085. />
  2086. <Redirect
  2087. from="ownership/"
  2088. to="/settings/:orgId/projects/:projectId/ownership/"
  2089. />
  2090. <Redirect
  2091. from="data-forwarding/"
  2092. to="/settings/:orgId/projects/:projectId/data-forwarding/"
  2093. />
  2094. <Redirect
  2095. from="debug-symbols/"
  2096. to="/settings/:orgId/projects/:projectId/debug-symbols/"
  2097. />
  2098. <Redirect
  2099. from="processing-issues/"
  2100. to="/settings/:orgId/projects/:projectId/processing-issues/"
  2101. />
  2102. <Redirect from="filters/" to="/settings/:orgId/projects/:projectId/filters/" />
  2103. <Redirect from="hooks/" to="/settings/:orgId/projects/:projectId/hooks/" />
  2104. <Redirect from="keys/" to="/settings/:orgId/projects/:projectId/keys/" />
  2105. <Redirect
  2106. from="keys/:keyId/"
  2107. to="/settings/:orgId/projects/:projectId/keys/:keyId/"
  2108. />
  2109. <Redirect
  2110. from="user-feedback/"
  2111. to="/settings/:orgId/projects/:projectId/user-feedback/"
  2112. />
  2113. <Redirect
  2114. from="security-headers/"
  2115. to="/settings/:orgId/projects/:projectId/security-headers/"
  2116. />
  2117. <Redirect
  2118. from="security-headers/csp/"
  2119. to="/settings/:orgId/projects/:projectId/security-headers/csp/"
  2120. />
  2121. <Redirect
  2122. from="security-headers/expect-ct/"
  2123. to="/settings/:orgId/projects/:projectId/security-headers/expect-ct/"
  2124. />
  2125. <Redirect
  2126. from="security-headers/hpkp/"
  2127. to="/settings/:orgId/projects/:projectId/security-headers/hpkp/"
  2128. />
  2129. <Redirect from="plugins/" to="/settings/:orgId/projects/:projectId/plugins/" />
  2130. <Redirect
  2131. from="plugins/:pluginId/"
  2132. to="/settings/:orgId/projects/:projectId/plugins/:pluginId/"
  2133. />
  2134. <Redirect
  2135. from="integrations/:providerKey/"
  2136. to="/settings/:orgId/projects/:projectId/integrations/:providerKey/"
  2137. />
  2138. </Route>
  2139. <Redirect from=":projectId/group/:groupId/" to="issues/:groupId/" />
  2140. <Redirect
  2141. from=":projectId/issues/:groupId/"
  2142. to="/organizations/:orgId/issues/:groupId/"
  2143. />
  2144. <Redirect
  2145. from=":projectId/issues/:groupId/events/"
  2146. to="/organizations/:orgId/issues/:groupId/events/"
  2147. />
  2148. <Redirect
  2149. from=":projectId/issues/:groupId/events/:eventId/"
  2150. to="/organizations/:orgId/issues/:groupId/events/:eventId/"
  2151. />
  2152. <Redirect
  2153. from=":projectId/issues/:groupId/tags/"
  2154. to="/organizations/:orgId/issues/:groupId/tags/"
  2155. />
  2156. <Redirect
  2157. from=":projectId/issues/:groupId/tags/:tagKey/"
  2158. to="/organizations/:orgId/issues/:groupId/tags/:tagKey/"
  2159. />
  2160. <Redirect
  2161. from=":projectId/issues/:groupId/feedback/"
  2162. to="/organizations/:orgId/issues/:groupId/feedback/"
  2163. />
  2164. <Redirect
  2165. from=":projectId/issues/:groupId/similar/"
  2166. to="/organizations/:orgId/issues/:groupId/similar/"
  2167. />
  2168. <Redirect
  2169. from=":projectId/issues/:groupId/merged/"
  2170. to="/organizations/:orgId/issues/:groupId/merged/"
  2171. />
  2172. <Route
  2173. path=":projectId/events/:eventId/"
  2174. component={errorHandler(ProjectEventRedirect)}
  2175. />
  2176. </Route>
  2177. );
  2178. const appRoutes = (
  2179. <Route>
  2180. {experimentalSpaRoutes}
  2181. <Route path="/" component={errorHandler(App)}>
  2182. {rootRoutes}
  2183. {organizationRoutes}
  2184. {legacyRedirectRoutes}
  2185. <Route path="*" component={errorHandler(RouteNotFound)} />
  2186. </Route>
  2187. </Route>
  2188. );
  2189. return appRoutes;
  2190. }
  2191. // We load routes both when initializing the SDK (for routing integrations) and
  2192. // when the app renders Main. Memoize to avoid rebuilding the route tree.
  2193. export const routes = memoize(buildRoutes);
  2194. // Exported for use in tests.
  2195. export {buildRoutes};
  2196. function NoOp({children}: {children: JSX.Element}) {
  2197. return children;
  2198. }