routes.tsx 79 KB

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