routes.tsx 78 KB

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