routes.tsx 71 KB

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