routes.tsx 71 KB

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