routes.tsx 70 KB

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