routes.tsx 72 KB

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