routes.tsx 72 KB

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