routes.tsx 71 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262
  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. path="spans/"
  1551. component={make(
  1552. () => import('sentry/views/performance/mobile/ui/screenSummary')
  1553. )}
  1554. />
  1555. </Route>
  1556. </Route>
  1557. <Route path="traces/">
  1558. <IndexRoute component={make(() => import('sentry/views/performance/traces'))} />
  1559. </Route>
  1560. <Route path="summary/">
  1561. <IndexRoute
  1562. component={make(
  1563. () =>
  1564. import('sentry/views/performance/transactionSummary/transactionOverview')
  1565. )}
  1566. />
  1567. <Route
  1568. path="replays/"
  1569. component={make(
  1570. () => import('sentry/views/performance/transactionSummary/transactionReplays')
  1571. )}
  1572. />
  1573. <Route
  1574. path="vitals/"
  1575. component={make(
  1576. () => import('sentry/views/performance/transactionSummary/transactionVitals')
  1577. )}
  1578. />
  1579. <Route
  1580. path="tags/"
  1581. component={make(
  1582. () => import('sentry/views/performance/transactionSummary/transactionTags')
  1583. )}
  1584. />
  1585. <Route
  1586. path="events/"
  1587. component={make(
  1588. () => import('sentry/views/performance/transactionSummary/transactionEvents')
  1589. )}
  1590. />
  1591. <Route
  1592. path="anomalies/"
  1593. component={make(
  1594. () =>
  1595. import('sentry/views/performance/transactionSummary/transactionAnomalies')
  1596. )}
  1597. />
  1598. <Route
  1599. path="profiles/"
  1600. component={make(
  1601. () =>
  1602. import('sentry/views/performance/transactionSummary/transactionProfiles')
  1603. )}
  1604. />
  1605. <Route
  1606. path="aggregateWaterfall/"
  1607. component={make(
  1608. () =>
  1609. import('sentry/views/performance/transactionSummary/aggregateSpanWaterfall')
  1610. )}
  1611. />
  1612. <Route path="spans/">
  1613. <IndexRoute
  1614. component={make(
  1615. () => import('sentry/views/performance/transactionSummary/transactionSpans')
  1616. )}
  1617. />
  1618. <Route
  1619. path=":spanSlug/"
  1620. component={make(
  1621. () =>
  1622. import(
  1623. 'sentry/views/performance/transactionSummary/transactionSpans/spanDetails'
  1624. )
  1625. )}
  1626. />
  1627. </Route>
  1628. </Route>
  1629. <Route
  1630. path="vitaldetail/"
  1631. component={make(() => import('sentry/views/performance/vitalDetail'))}
  1632. />
  1633. <Route
  1634. path="trace/:traceSlug/"
  1635. component={make(() => import('sentry/views/performance/traceDetails'))}
  1636. />
  1637. <Route
  1638. path=":eventSlug/"
  1639. component={make(() => import('sentry/views/performance/transactionDetails'))}
  1640. />
  1641. </Route>
  1642. );
  1643. const starfishRoutes = (
  1644. <Route
  1645. path="/starfish/"
  1646. component={make(() => import('sentry/views/starfish'))}
  1647. withOrgPath
  1648. >
  1649. <Redirect from="database/" to="/performance/database" />
  1650. <Route path="appStartup/">
  1651. <IndexRoute
  1652. component={make(() => import('sentry/views/performance/mobile/appStarts'))}
  1653. />
  1654. <Route
  1655. path="spans/"
  1656. component={make(
  1657. () => import('sentry/views/performance/mobile/appStarts/screenSummary')
  1658. )}
  1659. />
  1660. </Route>
  1661. </Route>
  1662. );
  1663. const userFeedbackRoutes = (
  1664. <Route
  1665. path="/user-feedback/"
  1666. component={make(() => import('sentry/views/userFeedback'))}
  1667. withOrgPath
  1668. />
  1669. );
  1670. const feedbackv2Routes = (
  1671. <Route
  1672. path="/feedback/"
  1673. component={make(() => import('sentry/views/feedback/index'))}
  1674. withOrgPath
  1675. >
  1676. <IndexRoute
  1677. component={make(() => import('sentry/views/feedback/feedbackListPage'))}
  1678. />
  1679. </Route>
  1680. );
  1681. const issueListRoutes = (
  1682. <Route path="/issues" component={errorHandler(IssueListContainer)} withOrgPath>
  1683. <IndexRoute component={errorHandler(IssueListOverview)} />
  1684. <Route path="searches/:searchId/" component={errorHandler(IssueListOverview)} />
  1685. </Route>
  1686. );
  1687. // Once org issues is complete, these routes can be nested under
  1688. // /organizations/:orgId/issues
  1689. const issueTabs = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1690. const hoc = forCustomerDomain ? withDomainRequired : x => x;
  1691. return (
  1692. <Fragment>
  1693. <IndexRoute
  1694. component={hoc(
  1695. make(() => import('sentry/views/issueDetails/groupEventDetails'))
  1696. )}
  1697. />
  1698. <Route
  1699. path={TabPaths[Tab.REPLAYS]}
  1700. component={hoc(make(() => import('sentry/views/issueDetails/groupReplays')))}
  1701. />
  1702. <Route
  1703. path={TabPaths[Tab.ACTIVITY]}
  1704. component={hoc(make(() => import('sentry/views/issueDetails/groupActivity')))}
  1705. />
  1706. <Route
  1707. path={TabPaths[Tab.EVENTS]}
  1708. component={hoc(make(() => import('sentry/views/issueDetails/groupEvents')))}
  1709. />
  1710. <Route
  1711. path={TabPaths[Tab.TAGS]}
  1712. component={hoc(make(() => import('sentry/views/issueDetails/groupTags')))}
  1713. />
  1714. <Route
  1715. path={`${TabPaths[Tab.TAGS]}:tagKey/`}
  1716. component={make(() => import('sentry/views/issueDetails/groupTagValues'))}
  1717. />
  1718. <Route
  1719. path={TabPaths[Tab.USER_FEEDBACK]}
  1720. component={hoc(
  1721. make(() => import('sentry/views/issueDetails/groupUserFeedback'))
  1722. )}
  1723. />
  1724. <Route
  1725. path={TabPaths[Tab.ATTACHMENTS]}
  1726. component={hoc(
  1727. make(() => import('sentry/views/issueDetails/groupEventAttachments'))
  1728. )}
  1729. />
  1730. <Route
  1731. path={TabPaths[Tab.SIMILAR_ISSUES]}
  1732. component={hoc(
  1733. make(() => import('sentry/views/issueDetails/groupSimilarIssues'))
  1734. )}
  1735. />
  1736. <Route
  1737. path={TabPaths[Tab.MERGED]}
  1738. component={hoc(make(() => import('sentry/views/issueDetails/groupMerged')))}
  1739. />
  1740. </Fragment>
  1741. );
  1742. };
  1743. const issueDetailsChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => (
  1744. <Fragment>
  1745. {issueTabs({forCustomerDomain})}
  1746. <Route path={`${TabPaths[Tab.EVENTS]}:eventId/`}>
  1747. {issueTabs({forCustomerDomain})}
  1748. </Route>
  1749. </Fragment>
  1750. );
  1751. const issueDetailsRoutes = (
  1752. <Fragment>
  1753. <Route
  1754. path="/organizations/:orgId/issues/:groupId/"
  1755. component={withDomainRedirect(
  1756. make(() => import('sentry/views/issueDetails/groupDetails'))
  1757. )}
  1758. key="org-issues-group-id"
  1759. >
  1760. {issueDetailsChildRoutes({forCustomerDomain: false})}
  1761. </Route>
  1762. {USING_CUSTOMER_DOMAIN && (
  1763. <Route
  1764. path="/issues/:groupId/"
  1765. component={withDomainRequired(
  1766. make(() => import('sentry/views/issueDetails/groupDetails'))
  1767. )}
  1768. key="orgless-issues-group-id-route"
  1769. >
  1770. {issueDetailsChildRoutes({forCustomerDomain: true})}
  1771. </Route>
  1772. )}
  1773. </Fragment>
  1774. );
  1775. // These are the "manage" pages. For sentry.io, these are _different_ from
  1776. // the SaaS admin routes in getsentry.
  1777. const adminManageRoutes = (
  1778. <Route
  1779. path="/manage/"
  1780. component={make(() => import('sentry/views/admin/adminLayout'))}
  1781. >
  1782. <IndexRoute component={make(() => import('sentry/views/admin/adminOverview'))} />
  1783. <Route
  1784. path="buffer/"
  1785. component={make(() => import('sentry/views/admin/adminBuffer'))}
  1786. />
  1787. <Route
  1788. path="relays/"
  1789. component={make(() => import('sentry/views/admin/adminRelays'))}
  1790. />
  1791. <Route
  1792. path="organizations/"
  1793. component={make(() => import('sentry/views/admin/adminOrganizations'))}
  1794. />
  1795. <Route
  1796. path="projects/"
  1797. component={make(() => import('sentry/views/admin/adminProjects'))}
  1798. />
  1799. <Route
  1800. path="queue/"
  1801. component={make(() => import('sentry/views/admin/adminQueue'))}
  1802. />
  1803. <Route
  1804. path="quotas/"
  1805. component={make(() => import('sentry/views/admin/adminQuotas'))}
  1806. />
  1807. <Route
  1808. path="settings/"
  1809. component={make(() => import('sentry/views/admin/adminSettings'))}
  1810. />
  1811. <Route path="users/">
  1812. <IndexRoute component={make(() => import('sentry/views/admin/adminUsers'))} />
  1813. <Route
  1814. path=":id"
  1815. component={make(() => import('sentry/views/admin/adminUserEdit'))}
  1816. />
  1817. </Route>
  1818. <Route
  1819. path="status/mail/"
  1820. component={make(() => import('sentry/views/admin/adminMail'))}
  1821. />
  1822. <Route
  1823. path="status/environment/"
  1824. component={make(() => import('sentry/views/admin/adminEnvironment'))}
  1825. />
  1826. <Route
  1827. path="status/packages/"
  1828. component={make(() => import('sentry/views/admin/adminPackages'))}
  1829. />
  1830. <Route
  1831. path="status/warnings/"
  1832. component={make(() => import('sentry/views/admin/adminWarnings'))}
  1833. />
  1834. </Route>
  1835. );
  1836. // XXX(epurkhiser): This should probably go away. It's not totally clear to
  1837. // me why we need the OrganizationRoot root container.
  1838. const legacyOrganizationRootRoutes = (
  1839. <Route component={errorHandler(OrganizationRoot)}>
  1840. <Redirect from="/organizations/:orgId/teams/new/" to="/settings/:orgId/teams/" />
  1841. <Route path="/organizations/:orgId/">
  1842. {hook('routes:organization')}
  1843. <IndexRedirect to="/organizations/:orgId/issues/" />
  1844. <Redirect from="/organizations/:orgId/teams/" to="/settings/:orgId/teams/" />
  1845. <Redirect
  1846. from="/organizations/:orgId/teams/your-teams/"
  1847. to="/settings/:orgId/teams/"
  1848. />
  1849. <Redirect
  1850. from="/organizations/:orgId/teams/all-teams/"
  1851. to="/settings/:orgId/teams/"
  1852. />
  1853. <Redirect
  1854. from="/organizations/:orgId/teams/:teamId/"
  1855. to="/settings/:orgId/teams/:teamId/"
  1856. />
  1857. <Redirect
  1858. from="/organizations/:orgId/teams/:teamId/members/"
  1859. to="/settings/:orgId/teams/:teamId/members/"
  1860. />
  1861. <Redirect
  1862. from="/organizations/:orgId/teams/:teamId/projects/"
  1863. to="/settings/:orgId/teams/:teamId/projects/"
  1864. />
  1865. <Redirect
  1866. from="/organizations/:orgId/teams/:teamId/settings/"
  1867. to="/settings/:orgId/teams/:teamId/settings/"
  1868. />
  1869. <Redirect from="/organizations/:orgId/settings/" to="/settings/:orgId/" />
  1870. <Redirect
  1871. from="/organizations/:orgId/api-keys/"
  1872. to="/settings/:orgId/api-keys/"
  1873. />
  1874. <Redirect
  1875. from="/organizations/:orgId/api-keys/:apiKey/"
  1876. to="/settings/:orgId/api-keys/:apiKey/"
  1877. />
  1878. <Redirect from="/organizations/:orgId/members/" to="/settings/:orgId/members/" />
  1879. <Redirect
  1880. from="/organizations/:orgId/members/:memberId/"
  1881. to="/settings/:orgId/members/:memberId/"
  1882. />
  1883. <Redirect
  1884. from="/organizations/:orgId/rate-limits/"
  1885. to="/settings/:orgId/rate-limits/"
  1886. />
  1887. <Redirect from="/organizations/:orgId/repos/" to="/settings/:orgId/repos/" />
  1888. </Route>
  1889. </Route>
  1890. );
  1891. const gettingStartedRoutes = (
  1892. <Fragment>
  1893. {USING_CUSTOMER_DOMAIN && (
  1894. <Fragment>
  1895. <Redirect
  1896. from="/getting-started/:projectId/"
  1897. to="/projects/:projectId/getting-started/"
  1898. />
  1899. <Redirect
  1900. from="/getting-started/:projectId/:platform/"
  1901. to="/projects/:projectId/getting-started/"
  1902. />
  1903. </Fragment>
  1904. )}
  1905. <Redirect
  1906. from="/:orgId/:projectId/getting-started/"
  1907. to="/organizations/:orgId/projects/:projectId/getting-started/"
  1908. />
  1909. <Redirect
  1910. from="/:orgId/:projectId/getting-started/:platform/"
  1911. to="/organizations/:orgId/projects/:projectId/getting-started/"
  1912. />
  1913. </Fragment>
  1914. );
  1915. const profilingRoutes = (
  1916. <Route
  1917. path="/profiling/"
  1918. component={make(() => import('sentry/views/profiling'))}
  1919. withOrgPath
  1920. >
  1921. <IndexRoute component={make(() => import('sentry/views/profiling/content'))} />
  1922. <Route
  1923. path="summary/:projectId/"
  1924. component={make(() => import('sentry/views/profiling/profileSummary'))}
  1925. />
  1926. <Route
  1927. path="profile/:projectId/differential-flamegraph/"
  1928. component={make(() => import('sentry/views/profiling/differentialFlamegraph'))}
  1929. />
  1930. <Route
  1931. path="profile/:projectId/:eventId/"
  1932. component={make(() => import('sentry/views/profiling/profilesProvider'))}
  1933. >
  1934. <Route
  1935. path="flamegraph/"
  1936. component={make(() => import('sentry/views/profiling/profileFlamechart'))}
  1937. />
  1938. </Route>
  1939. </Route>
  1940. );
  1941. const metricsRoutes = (
  1942. <Fragment>
  1943. <Route
  1944. path="/metrics/"
  1945. component={make(() => import('sentry/views/metrics'))}
  1946. withOrgPath
  1947. >
  1948. <IndexRoute component={make(() => import('sentry/views/metrics/metrics'))} />
  1949. </Route>
  1950. {/* TODO(ddm): fade this out */}
  1951. <Redirect from="/ddm/" to="/metrics/" />
  1952. </Fragment>
  1953. );
  1954. // Support for deprecated URLs (pre-Sentry 10). We just redirect users to new
  1955. // canonical URLs.
  1956. //
  1957. // XXX(epurkhiser): Can these be moved over to the legacyOrgRedirects routes,
  1958. // or do these need to be nested into the OrganizationLayout tree?
  1959. const legacyOrgRedirects = (
  1960. <Route path="/:orgId/:projectId/">
  1961. <IndexRoute
  1962. component={errorHandler(
  1963. redirectDeprecatedProjectRoute(
  1964. ({orgId, projectId}) => `/organizations/${orgId}/issues/?project=${projectId}`
  1965. )
  1966. )}
  1967. />
  1968. <Route
  1969. path="issues/"
  1970. component={errorHandler(
  1971. redirectDeprecatedProjectRoute(
  1972. ({orgId, projectId}) => `/organizations/${orgId}/issues/?project=${projectId}`
  1973. )
  1974. )}
  1975. />
  1976. <Route
  1977. path="dashboard/"
  1978. component={errorHandler(
  1979. redirectDeprecatedProjectRoute(
  1980. ({orgId, projectId}) =>
  1981. `/organizations/${orgId}/dashboards/?project=${projectId}`
  1982. )
  1983. )}
  1984. />
  1985. <Route
  1986. path="user-feedback/"
  1987. component={errorHandler(
  1988. redirectDeprecatedProjectRoute(
  1989. ({orgId, projectId}) =>
  1990. `/organizations/${orgId}/user-feedback/?project=${projectId}`
  1991. )
  1992. )}
  1993. />
  1994. <Route
  1995. path="releases/"
  1996. component={errorHandler(
  1997. redirectDeprecatedProjectRoute(
  1998. ({orgId, projectId}) =>
  1999. `/organizations/${orgId}/releases/?project=${projectId}`
  2000. )
  2001. )}
  2002. />
  2003. <Route
  2004. path="releases/:version/"
  2005. component={errorHandler(
  2006. redirectDeprecatedProjectRoute(
  2007. ({orgId, projectId, router}) =>
  2008. `/organizations/${orgId}/releases/${router.params.version}/?project=${projectId}`
  2009. )
  2010. )}
  2011. />
  2012. <Route
  2013. path="releases/:version/new-events/"
  2014. component={errorHandler(
  2015. redirectDeprecatedProjectRoute(
  2016. ({orgId, projectId, router}) =>
  2017. `/organizations/${orgId}/releases/${router.params.version}/new-events/?project=${projectId}`
  2018. )
  2019. )}
  2020. />
  2021. <Route
  2022. path="releases/:version/all-events/"
  2023. component={errorHandler(
  2024. redirectDeprecatedProjectRoute(
  2025. ({orgId, projectId, router}) =>
  2026. `/organizations/${orgId}/releases/${router.params.version}/all-events/?project=${projectId}`
  2027. )
  2028. )}
  2029. />
  2030. <Route
  2031. path="releases/:version/commits/"
  2032. component={errorHandler(
  2033. redirectDeprecatedProjectRoute(
  2034. ({orgId, projectId, router}) =>
  2035. `/organizations/${orgId}/releases/${router.params.version}/commits/?project=${projectId}`
  2036. )
  2037. )}
  2038. />
  2039. </Route>
  2040. );
  2041. const organizationRoutes = (
  2042. <Route component={errorHandler(OrganizationLayout)}>
  2043. {settingsRoutes}
  2044. {projectsRoutes}
  2045. {dashboardRoutes}
  2046. {userFeedbackRoutes}
  2047. {feedbackv2Routes}
  2048. {issueListRoutes}
  2049. {issueDetailsRoutes}
  2050. {alertRoutes}
  2051. {cronsRoutes}
  2052. {replayRoutes}
  2053. {releasesRoutes}
  2054. {releaseThresholdRoutes}
  2055. {activityRoutes}
  2056. {statsRoutes}
  2057. {discoverRoutes}
  2058. {performanceRoutes}
  2059. {aiMonitoringRoutes}
  2060. {starfishRoutes}
  2061. {profilingRoutes}
  2062. {metricsRoutes}
  2063. {gettingStartedRoutes}
  2064. {adminManageRoutes}
  2065. {legacyOrganizationRootRoutes}
  2066. {legacyOrgRedirects}
  2067. </Route>
  2068. );
  2069. const legacyRedirectRoutes = (
  2070. <Route path="/:orgId/">
  2071. <IndexRedirect to="/organizations/:orgId/" />
  2072. <Route path=":projectId/settings/">
  2073. <Redirect from="teams/" to="/settings/:orgId/projects/:projectId/teams/" />
  2074. <Redirect from="alerts/" to="/settings/:orgId/projects/:projectId/alerts/" />
  2075. <Redirect
  2076. from="alerts/rules/"
  2077. to="/settings/:orgId/projects/:projectId/alerts/rules/"
  2078. />
  2079. <Redirect
  2080. from="alerts/rules/new/"
  2081. to="/settings/:orgId/projects/:projectId/alerts/rules/new/"
  2082. />
  2083. <Redirect
  2084. from="alerts/rules/:ruleId/"
  2085. to="/settings/:orgId/projects/:projectId/alerts/rules/:ruleId/"
  2086. />
  2087. <Redirect
  2088. from="environments/"
  2089. to="/settings/:orgId/projects/:projectId/environments/"
  2090. />
  2091. <Redirect
  2092. from="environments/hidden/"
  2093. to="/settings/:orgId/projects/:projectId/environments/hidden/"
  2094. />
  2095. <Redirect from="tags/" to="/settings/projects/:orgId/projects/:projectId/tags/" />
  2096. <Redirect
  2097. from="issue-tracking/"
  2098. to="/settings/:orgId/projects/:projectId/issue-tracking/"
  2099. />
  2100. <Redirect
  2101. from="release-tracking/"
  2102. to="/settings/:orgId/projects/:projectId/release-tracking/"
  2103. />
  2104. <Redirect
  2105. from="ownership/"
  2106. to="/settings/:orgId/projects/:projectId/ownership/"
  2107. />
  2108. <Redirect
  2109. from="data-forwarding/"
  2110. to="/settings/:orgId/projects/:projectId/data-forwarding/"
  2111. />
  2112. <Redirect
  2113. from="debug-symbols/"
  2114. to="/settings/:orgId/projects/:projectId/debug-symbols/"
  2115. />
  2116. <Redirect
  2117. from="processing-issues/"
  2118. to="/settings/:orgId/projects/:projectId/processing-issues/"
  2119. />
  2120. <Redirect from="filters/" to="/settings/:orgId/projects/:projectId/filters/" />
  2121. <Redirect from="hooks/" to="/settings/:orgId/projects/:projectId/hooks/" />
  2122. <Redirect from="keys/" to="/settings/:orgId/projects/:projectId/keys/" />
  2123. <Redirect
  2124. from="keys/:keyId/"
  2125. to="/settings/:orgId/projects/:projectId/keys/:keyId/"
  2126. />
  2127. <Redirect
  2128. from="user-feedback/"
  2129. to="/settings/:orgId/projects/:projectId/user-feedback/"
  2130. />
  2131. <Redirect
  2132. from="security-headers/"
  2133. to="/settings/:orgId/projects/:projectId/security-headers/"
  2134. />
  2135. <Redirect
  2136. from="security-headers/csp/"
  2137. to="/settings/:orgId/projects/:projectId/security-headers/csp/"
  2138. />
  2139. <Redirect
  2140. from="security-headers/expect-ct/"
  2141. to="/settings/:orgId/projects/:projectId/security-headers/expect-ct/"
  2142. />
  2143. <Redirect
  2144. from="security-headers/hpkp/"
  2145. to="/settings/:orgId/projects/:projectId/security-headers/hpkp/"
  2146. />
  2147. <Redirect from="plugins/" to="/settings/:orgId/projects/:projectId/plugins/" />
  2148. <Redirect
  2149. from="plugins/:pluginId/"
  2150. to="/settings/:orgId/projects/:projectId/plugins/:pluginId/"
  2151. />
  2152. <Redirect
  2153. from="integrations/:providerKey/"
  2154. to="/settings/:orgId/projects/:projectId/integrations/:providerKey/"
  2155. />
  2156. </Route>
  2157. <Redirect from=":projectId/group/:groupId/" to="issues/:groupId/" />
  2158. <Redirect
  2159. from=":projectId/issues/:groupId/"
  2160. to="/organizations/:orgId/issues/:groupId/"
  2161. />
  2162. <Redirect
  2163. from=":projectId/issues/:groupId/events/"
  2164. to="/organizations/:orgId/issues/:groupId/events/"
  2165. />
  2166. <Redirect
  2167. from=":projectId/issues/:groupId/events/:eventId/"
  2168. to="/organizations/:orgId/issues/:groupId/events/:eventId/"
  2169. />
  2170. <Redirect
  2171. from=":projectId/issues/:groupId/tags/"
  2172. to="/organizations/:orgId/issues/:groupId/tags/"
  2173. />
  2174. <Redirect
  2175. from=":projectId/issues/:groupId/tags/:tagKey/"
  2176. to="/organizations/:orgId/issues/:groupId/tags/:tagKey/"
  2177. />
  2178. <Redirect
  2179. from=":projectId/issues/:groupId/feedback/"
  2180. to="/organizations/:orgId/issues/:groupId/feedback/"
  2181. />
  2182. <Redirect
  2183. from=":projectId/issues/:groupId/similar/"
  2184. to="/organizations/:orgId/issues/:groupId/similar/"
  2185. />
  2186. <Redirect
  2187. from=":projectId/issues/:groupId/merged/"
  2188. to="/organizations/:orgId/issues/:groupId/merged/"
  2189. />
  2190. <Route
  2191. path=":projectId/events/:eventId/"
  2192. component={errorHandler(ProjectEventRedirect)}
  2193. />
  2194. </Route>
  2195. );
  2196. const appRoutes = (
  2197. <Route>
  2198. {experimentalSpaRoutes}
  2199. <Route path="/" component={errorHandler(App)}>
  2200. {rootRoutes}
  2201. {organizationRoutes}
  2202. {legacyRedirectRoutes}
  2203. <Route path="*" component={errorHandler(RouteNotFound)} />
  2204. </Route>
  2205. </Route>
  2206. );
  2207. return appRoutes;
  2208. }
  2209. // We load routes both when initializing the SDK (for routing integrations) and
  2210. // when the app renders Main. Memoize to avoid rebuilding the route tree.
  2211. export const routes = memoize(buildRoutes);
  2212. // Exported for use in tests.
  2213. export {buildRoutes};
  2214. function NoOp({children}: {children: JSX.Element}) {
  2215. return children;
  2216. }