routes.tsx 71 KB

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