routes.tsx 72 KB

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