routes.tsx 70 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253
  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. )}
  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. )}
  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. )}
  221. <Route
  222. path="/join-request/:orgId/"
  223. component={withDomainRedirect(
  224. make(() => import('sentry/views/organizationJoinRequest'))
  225. )}
  226. key="org-join-request"
  227. />
  228. {usingCustomerDomain && (
  229. <Route
  230. path="/onboarding/"
  231. component={errorHandler(withDomainRequired(OrganizationContextContainer))}
  232. key="orgless-onboarding"
  233. >
  234. <IndexRedirect to="welcome/" />
  235. <Route
  236. path=":step/"
  237. component={make(() => import('sentry/views/onboarding'))}
  238. />
  239. </Route>
  240. )}
  241. <Route
  242. path="/onboarding/:orgId/"
  243. component={withDomainRedirect(errorHandler(OrganizationContextContainer))}
  244. key="org-onboarding"
  245. >
  246. <IndexRedirect to="welcome/" />
  247. <Route path=":step/" component={make(() => import('sentry/views/onboarding'))} />
  248. </Route>
  249. </Fragment>
  250. );
  251. const accountSettingsRoutes = (
  252. <Route
  253. path="account/"
  254. name={t('Account')}
  255. component={make(
  256. () => import('sentry/views/settings/account/accountSettingsLayout')
  257. )}
  258. >
  259. <IndexRedirect to="details/" />
  260. <Route
  261. path="details/"
  262. name={t('Details')}
  263. component={make(() => import('sentry/views/settings/account/accountDetails'))}
  264. />
  265. <Route path="notifications/" name={t('Notifications')}>
  266. <IndexRoute
  267. component={make(
  268. () =>
  269. import('sentry/views/settings/account/notifications/notificationSettings')
  270. )}
  271. />
  272. <Route
  273. path=":fineTuneType/"
  274. name={t('Fine Tune Alerts')}
  275. component={make(
  276. () => import('sentry/views/settings/account/accountNotificationFineTuning')
  277. )}
  278. />
  279. </Route>
  280. <Route
  281. path="emails/"
  282. name={t('Emails')}
  283. component={make(() => import('sentry/views/settings/account/accountEmails'))}
  284. />
  285. <Route
  286. path="authorizations/"
  287. component={make(
  288. () => import('sentry/views/settings/account/accountAuthorizations')
  289. )}
  290. />
  291. <Route path="security/" name={t('Security')}>
  292. <Route
  293. component={make(
  294. () =>
  295. import(
  296. 'sentry/views/settings/account/accountSecurity/accountSecurityWrapper'
  297. )
  298. )}
  299. >
  300. <IndexRoute
  301. component={make(
  302. () => import('sentry/views/settings/account/accountSecurity')
  303. )}
  304. />
  305. <Route
  306. path="session-history/"
  307. name={t('Session History')}
  308. component={make(
  309. () => import('sentry/views/settings/account/accountSecurity/sessionHistory')
  310. )}
  311. />
  312. <Route
  313. path="mfa/:authId/"
  314. name={t('Details')}
  315. component={make(
  316. () =>
  317. import(
  318. 'sentry/views/settings/account/accountSecurity/accountSecurityDetails'
  319. )
  320. )}
  321. />
  322. </Route>
  323. <Route
  324. path="mfa/:authId/enroll/"
  325. name={t('Enroll')}
  326. component={make(
  327. () =>
  328. import(
  329. 'sentry/views/settings/account/accountSecurity/accountSecurityEnroll'
  330. )
  331. )}
  332. />
  333. </Route>
  334. <Route
  335. path="subscriptions/"
  336. name={t('Subscriptions')}
  337. component={make(
  338. () => import('sentry/views/settings/account/accountSubscriptions')
  339. )}
  340. />
  341. <Route
  342. path="identities/"
  343. name={t('Identities')}
  344. component={make(() => import('sentry/views/settings/account/accountIdentities'))}
  345. />
  346. <Route path="api/" name={t('API')}>
  347. <IndexRedirect to="auth-tokens/" />
  348. <Route path="auth-tokens/" name={t('Auth Tokens')}>
  349. <IndexRoute
  350. component={make(() => import('sentry/views/settings/account/apiTokens'))}
  351. />
  352. <Route
  353. path="new-token/"
  354. name={t('Create New Token')}
  355. component={make(() => import('sentry/views/settings/account/apiNewToken'))}
  356. />
  357. </Route>
  358. <Route path="applications/" name={t('Applications')}>
  359. <IndexRoute
  360. component={make(
  361. () => import('sentry/views/settings/account/apiApplications')
  362. )}
  363. />
  364. <Route
  365. path=":appId/"
  366. name={t('Details')}
  367. component={make(
  368. () => import('sentry/views/settings/account/apiApplications/details')
  369. )}
  370. />
  371. </Route>
  372. {hook('routes:api')}
  373. </Route>
  374. <Route
  375. path="close-account/"
  376. name={t('Close Account')}
  377. component={make(() => import('sentry/views/settings/account/accountClose'))}
  378. />
  379. </Route>
  380. );
  381. const projectSettingsRoutes = (
  382. <Route
  383. path="projects/:projectId/"
  384. name={t('Project')}
  385. component={make(
  386. () => import('sentry/views/settings/project/projectSettingsLayout')
  387. )}
  388. >
  389. <IndexRoute
  390. name={t('General')}
  391. component={make(() => import('sentry/views/settings/projectGeneralSettings'))}
  392. />
  393. <Route
  394. path="teams/"
  395. name={t('Teams')}
  396. component={make(() => import('sentry/views/settings/project/projectTeams'))}
  397. />
  398. <Route
  399. path="alerts/"
  400. name={t('Alerts')}
  401. component={make(() => import('sentry/views/settings/projectAlerts'))}
  402. >
  403. <IndexRoute
  404. component={make(() => import('sentry/views/settings/projectAlerts/settings'))}
  405. />
  406. <Redirect from="new/" to="/organizations/:orgId/alerts/:projectId/new/" />
  407. <Redirect from="rules/" to="/organizations/:orgId/alerts/rules/" />
  408. <Redirect from="rules/new/" to="/organizations/:orgId/alerts/:projectId/new/" />
  409. <Redirect
  410. from="metric-rules/new/"
  411. to="/organizations/:orgId/alerts/:projectId/new/"
  412. />
  413. <Redirect
  414. from="rules/:ruleId/"
  415. to="/organizations/:orgId/alerts/rules/:projectId/:ruleId/"
  416. />
  417. <Redirect
  418. from="metric-rules/:ruleId/"
  419. to="/organizations/:orgId/alerts/metric-rules/:projectId/:ruleId/"
  420. />
  421. </Route>
  422. <Route
  423. path="environments/"
  424. name={t('Environments')}
  425. component={make(
  426. () => import('sentry/views/settings/project/projectEnvironments')
  427. )}
  428. >
  429. <IndexRoute />
  430. <Route path="hidden/" />
  431. </Route>
  432. <Route
  433. path="tags/"
  434. name={t('Tags')}
  435. component={make(() => import('sentry/views/settings/projectTags'))}
  436. />
  437. <Redirect from="issue-tracking/" to="/settings/:orgId/:projectId/plugins/" />
  438. <Route
  439. path="release-tracking/"
  440. name={t('Release Tracking')}
  441. component={make(
  442. () => import('sentry/views/settings/project/projectReleaseTracking')
  443. )}
  444. />
  445. <Route
  446. path="ownership/"
  447. name={t('Issue Owners')}
  448. component={make(() => import('sentry/views/settings/project/projectOwnership'))}
  449. />
  450. <Route
  451. path="data-forwarding/"
  452. name={t('Data Forwarding')}
  453. component={make(() => import('sentry/views/settings/projectDataForwarding'))}
  454. />
  455. <Route path="security-and-privacy/" name={t('Security & Privacy')}>
  456. <IndexRoute
  457. component={make(
  458. () => import('sentry/views/settings/projectSecurityAndPrivacy')
  459. )}
  460. />
  461. <Route
  462. path="advanced-data-scrubbing/:scrubbingId/"
  463. component={make(
  464. () => import('sentry/views/settings/projectSecurityAndPrivacy')
  465. )}
  466. />
  467. </Route>
  468. <Route
  469. path="debug-symbols/"
  470. name={t('Debug Information Files')}
  471. component={make(() => import('sentry/views/settings/projectDebugFiles'))}
  472. />
  473. <Route
  474. path="proguard/"
  475. name={t('ProGuard Mappings')}
  476. component={make(() => import('sentry/views/settings/projectProguard'))}
  477. />
  478. <Route
  479. path="performance/"
  480. name={t('Performance')}
  481. component={make(() => import('sentry/views/settings/projectPerformance'))}
  482. />
  483. <Route
  484. path="source-maps/"
  485. name={t('Source Maps')}
  486. component={make(() => import('sentry/views/settings/projectSourceMaps'))}
  487. >
  488. <IndexRoute
  489. component={make(() => import('sentry/views/settings/projectSourceMaps/list'))}
  490. />
  491. <Route
  492. path=":name/"
  493. name={t('Archive')}
  494. component={make(() => import('sentry/views/settings/projectSourceMaps/detail'))}
  495. />
  496. </Route>
  497. <Route
  498. path="processing-issues/"
  499. name={t('Processing Issues')}
  500. component={make(
  501. () => import('sentry/views/settings/project/projectProcessingIssues')
  502. )}
  503. />
  504. <Route
  505. path="filters/"
  506. name={t('Inbound Filters')}
  507. component={make(() => import('sentry/views/settings/project/projectFilters'))}
  508. >
  509. <IndexRedirect to="data-filters/" />
  510. <Route path=":filterType/" />
  511. </Route>
  512. <Route path="dynamic-sampling/" name={t('Dynamic Sampling')}>
  513. <IndexRoute
  514. component={make(() => import('sentry/views/settings/project/dynamicSampling'))}
  515. />
  516. <Route
  517. path="rules/:rule/"
  518. component={make(() => import('sentry/views/settings/project/dynamicSampling'))}
  519. />
  520. </Route>
  521. <Route
  522. path="issue-grouping/"
  523. name={t('Issue Grouping')}
  524. component={make(() => import('sentry/views/settings/projectIssueGrouping'))}
  525. />
  526. <Route
  527. path="hooks/"
  528. name={t('Service Hooks')}
  529. component={make(
  530. () => import('sentry/views/settings/project/projectServiceHooks')
  531. )}
  532. />
  533. <Route
  534. path="hooks/new/"
  535. name={t('Create Service Hook')}
  536. component={make(
  537. () => import('sentry/views/settings/project/projectCreateServiceHook')
  538. )}
  539. />
  540. <Route
  541. path="hooks/:hookId/"
  542. name={t('Service Hook Details')}
  543. component={make(
  544. () => import('sentry/views/settings/project/projectServiceHookDetails')
  545. )}
  546. />
  547. <Route path="keys/" name={t('Client Keys')}>
  548. <IndexRoute
  549. component={make(() => import('sentry/views/settings/project/projectKeys/list'))}
  550. />
  551. <Route
  552. path=":keyId/"
  553. name={t('Details')}
  554. component={make(
  555. () => import('sentry/views/settings/project/projectKeys/details')
  556. )}
  557. />
  558. </Route>
  559. <Route
  560. path="user-feedback/"
  561. name={t('User Feedback')}
  562. component={make(
  563. () => import('sentry/views/settings/project/projectUserFeedback')
  564. )}
  565. />
  566. <Redirect from="csp/" to="security-headers/" />
  567. <Route path="security-headers/" name={t('Security Headers')}>
  568. <IndexRoute
  569. component={make(() => import('sentry/views/settings/projectSecurityHeaders'))}
  570. />
  571. <Route
  572. path="csp/"
  573. name={t('Content Security Policy')}
  574. component={make(
  575. () => import('sentry/views/settings/projectSecurityHeaders/csp')
  576. )}
  577. />
  578. <Route
  579. path="expect-ct/"
  580. name={t('Certificate Transparency')}
  581. component={make(
  582. () => import('sentry/views/settings/projectSecurityHeaders/expectCt')
  583. )}
  584. />
  585. <Route
  586. path="hpkp/"
  587. name={t('HPKP')}
  588. component={make(
  589. () => import('sentry/views/settings/projectSecurityHeaders/hpkp')
  590. )}
  591. />
  592. </Route>
  593. <Route path="plugins/" name={t('Legacy Integrations')}>
  594. <IndexRoute
  595. component={make(() => import('sentry/views/settings/projectPlugins'))}
  596. />
  597. <Route
  598. path=":pluginId/"
  599. name={t('Integration Details')}
  600. component={make(() => import('sentry/views/settings/projectPlugins/details'))}
  601. />
  602. </Route>
  603. <Route path="install/" name={t('Configuration')}>
  604. <IndexRoute
  605. component={make(() => import('sentry/views/projectInstall/overview'))}
  606. />
  607. <Route
  608. path=":platform/"
  609. name={t('Docs')}
  610. component={make(
  611. () => import('sentry/views/projectInstall/platformOrIntegration')
  612. )}
  613. />
  614. </Route>
  615. </Route>
  616. );
  617. const orgSettingsRoutes = (
  618. <Route
  619. component={make(
  620. () => import('sentry/views/settings/organization/organizationSettingsLayout')
  621. )}
  622. >
  623. {hook('routes:organization')}
  624. {!usingCustomerDomain && (
  625. <IndexRoute
  626. name={t('General')}
  627. component={make(
  628. () => import('sentry/views/settings/organizationGeneralSettings')
  629. )}
  630. />
  631. )}
  632. {usingCustomerDomain && (
  633. <Route
  634. path="/settings/organization/"
  635. name={t('General')}
  636. component={make(
  637. () => import('sentry/views/settings/organizationGeneralSettings')
  638. )}
  639. />
  640. )}
  641. <Route
  642. path="projects/"
  643. name={t('Projects')}
  644. component={make(() => import('sentry/views/settings/organizationProjects'))}
  645. />
  646. <Route path="api-keys/" name={t('API Key')}>
  647. <IndexRoute
  648. component={make(() => import('sentry/views/settings/organizationApiKeys'))}
  649. />
  650. <Route
  651. path=":apiKey/"
  652. name={t('Details')}
  653. component={make(
  654. () =>
  655. import(
  656. 'sentry/views/settings/organizationApiKeys/organizationApiKeyDetails'
  657. )
  658. )}
  659. />
  660. </Route>
  661. <Route
  662. path="audit-log/"
  663. name={t('Audit Log')}
  664. component={make(() => import('sentry/views/settings/organizationAuditLog'))}
  665. />
  666. <Route
  667. path="auth/"
  668. name={t('Auth Providers')}
  669. component={make(() => import('sentry/views/settings/organizationAuth'))}
  670. />
  671. <Redirect from="members/requests" to="members/" />
  672. <Route path="members/" name={t('Members')}>
  673. <Route
  674. component={make(
  675. () =>
  676. import(
  677. 'sentry/views/settings/organizationMembers/organizationMembersWrapper'
  678. )
  679. )}
  680. >
  681. <IndexRoute
  682. component={make(
  683. () =>
  684. import(
  685. 'sentry/views/settings/organizationMembers/organizationMembersList'
  686. )
  687. )}
  688. />
  689. </Route>
  690. <Route
  691. path=":memberId/"
  692. name={t('Details')}
  693. component={make(
  694. () =>
  695. import('sentry/views/settings/organizationMembers/organizationMemberDetail')
  696. )}
  697. />
  698. </Route>
  699. <Route
  700. path="rate-limits/"
  701. name={t('Rate Limits')}
  702. component={make(() => import('sentry/views/settings/organizationRateLimits'))}
  703. />
  704. <Route
  705. path="relay/"
  706. name={t('Relay')}
  707. component={make(() => import('sentry/views/settings/organizationRelay'))}
  708. />
  709. <Route
  710. path="repos/"
  711. name={t('Repositories')}
  712. component={make(() => import('sentry/views/settings/organizationRepositories'))}
  713. />
  714. <Route
  715. path="settings/"
  716. component={make(
  717. () => import('sentry/views/settings/organizationGeneralSettings')
  718. )}
  719. />
  720. <Route path="security-and-privacy/" name={t('Security & Privacy')}>
  721. <IndexRoute
  722. component={make(
  723. () => import('sentry/views/settings/organizationSecurityAndPrivacy')
  724. )}
  725. />
  726. <Route
  727. path="advanced-data-scrubbing/:scrubbingId/"
  728. component={make(
  729. () => import('sentry/views/settings/organizationSecurityAndPrivacy')
  730. )}
  731. />
  732. </Route>
  733. <Route path="teams/" name={t('Teams')}>
  734. <IndexRoute
  735. component={make(() => import('sentry/views/settings/organizationTeams'))}
  736. />
  737. <Route
  738. path=":teamId/"
  739. name={t('Team')}
  740. component={make(
  741. () => import('sentry/views/settings/organizationTeams/teamDetails')
  742. )}
  743. >
  744. <IndexRedirect to="members/" />
  745. <Route
  746. path="members/"
  747. name={t('Members')}
  748. component={make(
  749. () => import('sentry/views/settings/organizationTeams/teamMembers')
  750. )}
  751. />
  752. <Route
  753. path="notifications/"
  754. name={t('Notifications')}
  755. component={make(
  756. () => import('sentry/views/settings/organizationTeams/teamNotifications')
  757. )}
  758. />
  759. <Route
  760. path="projects/"
  761. name={t('Projects')}
  762. component={make(
  763. () => import('sentry/views/settings/organizationTeams/teamProjects')
  764. )}
  765. />
  766. <Route
  767. path="settings/"
  768. name={t('Settings')}
  769. component={make(
  770. () => import('sentry/views/settings/organizationTeams/teamSettings')
  771. )}
  772. />
  773. </Route>
  774. </Route>
  775. <Redirect from="plugins/" to="integrations/" />
  776. <Route path="plugins/" name={t('Integrations')}>
  777. <Route
  778. path=":integrationSlug/"
  779. name={t('Integration Details')}
  780. component={make(
  781. () =>
  782. import('sentry/views/settings/organizationIntegrations/pluginDetailedView')
  783. )}
  784. />
  785. </Route>
  786. <Redirect from="sentry-apps/" to="integrations/" />
  787. <Route path="sentry-apps/" name={t('Integrations')}>
  788. <Route
  789. path=":integrationSlug"
  790. name={t('Details')}
  791. component={make(
  792. () =>
  793. import(
  794. 'sentry/views/settings/organizationIntegrations/sentryAppDetailedView'
  795. )
  796. )}
  797. />
  798. </Route>
  799. <Redirect from="document-integrations/" to="integrations/" />
  800. <Route path="document-integrations/" name={t('Integrations')}>
  801. <Route
  802. path=":integrationSlug"
  803. name={t('Details')}
  804. component={make(
  805. () =>
  806. import(
  807. 'sentry/views/settings/organizationIntegrations/docIntegrationDetailedView'
  808. )
  809. )}
  810. />
  811. </Route>
  812. <Route path="integrations/" name={t('Integrations')}>
  813. <IndexRoute
  814. component={make(
  815. () =>
  816. import(
  817. 'sentry/views/settings/organizationIntegrations/integrationListDirectory'
  818. )
  819. )}
  820. />
  821. <Route
  822. path=":integrationSlug"
  823. name={t('Integration Details')}
  824. component={make(
  825. () =>
  826. import(
  827. 'sentry/views/settings/organizationIntegrations/integrationDetailedView'
  828. )
  829. )}
  830. />
  831. <Route
  832. path=":providerKey/:integrationId/"
  833. name={t('Configure Integration')}
  834. component={make(
  835. () =>
  836. import(
  837. 'sentry/views/settings/organizationIntegrations/configureIntegration'
  838. )
  839. )}
  840. />
  841. </Route>
  842. <Redirect from="developer-settings/sentry-functions/" to="developer-settings/" />
  843. <Route path="developer-settings/" name={t('Developer Settings')}>
  844. <IndexRoute
  845. component={make(
  846. () => import('sentry/views/settings/organizationDeveloperSettings')
  847. )}
  848. />
  849. <Route
  850. path="new-public/"
  851. name={t('Create Integration')}
  852. component={make(
  853. () =>
  854. import(
  855. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails'
  856. )
  857. )}
  858. />
  859. <Route
  860. path="new-internal/"
  861. name={t('Create Integration')}
  862. component={make(
  863. () =>
  864. import(
  865. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails'
  866. )
  867. )}
  868. />
  869. <Route
  870. path=":appSlug/"
  871. name={t('Edit Integration')}
  872. component={make(
  873. () =>
  874. import(
  875. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails'
  876. )
  877. )}
  878. />
  879. <Route
  880. path=":appSlug/dashboard/"
  881. name={t('Integration Dashboard')}
  882. component={make(
  883. () =>
  884. import(
  885. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDashboard'
  886. )
  887. )}
  888. />
  889. <Route path="sentry-functions/" name={t('Sentry Functions')}>
  890. <Route
  891. path="new/"
  892. name={t('Create Sentry Function')}
  893. component={make(
  894. () =>
  895. import(
  896. 'sentry/views/settings/organizationDeveloperSettings/sentryFunctionDetails'
  897. )
  898. )}
  899. />
  900. <Route
  901. path=":functionSlug/"
  902. name={t('Edit Sentry Function')}
  903. component={make(
  904. () =>
  905. import(
  906. 'sentry/views/settings/organizationDeveloperSettings/sentryFunctionDetails'
  907. )
  908. )}
  909. />
  910. </Route>
  911. </Route>
  912. </Route>
  913. );
  914. const legacySettingsRedirects = (
  915. <Fragment>
  916. <Redirect from=":projectId/" to="projects/:projectId/" />
  917. <Redirect from=":projectId/alerts/" to="projects/:projectId/alerts/" />
  918. <Redirect from=":projectId/alerts/rules/" to="projects/:projectId/alerts/rules/" />
  919. <Redirect
  920. from=":projectId/alerts/rules/:ruleId/"
  921. to="projects/:projectId/alerts/rules/:ruleId/"
  922. />
  923. </Fragment>
  924. );
  925. const settingsRoutes = (
  926. <Route path="/settings/" name={t('Settings')} component={SettingsWrapper}>
  927. <IndexRoute component={make(() => import('sentry/views/settings/settingsIndex'))} />
  928. {accountSettingsRoutes}
  929. <Fragment>
  930. {usingCustomerDomain && (
  931. <Route
  932. name={t('Organization')}
  933. component={withDomainRequired(NoOp)}
  934. key="orgless-settings-route"
  935. >
  936. {orgSettingsRoutes}
  937. {projectSettingsRoutes}
  938. </Route>
  939. )}
  940. <Route
  941. path=":orgId/"
  942. name={t('Organization')}
  943. component={withDomainRedirect(NoOp)}
  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. )}
  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. )}
  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. )}
  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. )}
  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. )}
  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. )}
  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. )}
  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. )}
  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. )}
  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. )}
  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. )}
  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. )}
  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. )}
  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. )}
  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. )}
  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. )}
  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. )}
  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. )}
  1887. <Route
  1888. path="/:orgId/:projectId/getting-started/"
  1889. component={withDomainRedirect(
  1890. make(() => import('sentry/views/projectInstall/gettingStarted'))
  1891. )}
  1892. key="org-getting-started"
  1893. >
  1894. {gettingStartedChildRoutes}
  1895. </Route>
  1896. </Fragment>
  1897. );
  1898. // Support for deprecated URLs (pre-Sentry 10). We just redirect users to new
  1899. // canonical URLs.
  1900. //
  1901. // XXX(epurkhiser): Can these be moved over to the legacyOrgRedirects routes,
  1902. // or do these need to be nested into the OrganizationDetails tree?
  1903. const legacyOrgRedirects = (
  1904. <Route path="/:orgId/:projectId/">
  1905. <IndexRoute
  1906. component={errorHandler(
  1907. redirectDeprecatedProjectRoute(
  1908. ({orgId, projectId}) => `/organizations/${orgId}/issues/?project=${projectId}`
  1909. )
  1910. )}
  1911. />
  1912. <Route
  1913. path="issues/"
  1914. component={errorHandler(
  1915. redirectDeprecatedProjectRoute(
  1916. ({orgId, projectId}) => `/organizations/${orgId}/issues/?project=${projectId}`
  1917. )
  1918. )}
  1919. />
  1920. <Route
  1921. path="dashboard/"
  1922. component={errorHandler(
  1923. redirectDeprecatedProjectRoute(
  1924. ({orgId, projectId}) =>
  1925. `/organizations/${orgId}/dashboards/?project=${projectId}`
  1926. )
  1927. )}
  1928. />
  1929. <Route
  1930. path="user-feedback/"
  1931. component={errorHandler(
  1932. redirectDeprecatedProjectRoute(
  1933. ({orgId, projectId}) =>
  1934. `/organizations/${orgId}/user-feedback/?project=${projectId}`
  1935. )
  1936. )}
  1937. />
  1938. <Route
  1939. path="releases/"
  1940. component={errorHandler(
  1941. redirectDeprecatedProjectRoute(
  1942. ({orgId, projectId}) =>
  1943. `/organizations/${orgId}/releases/?project=${projectId}`
  1944. )
  1945. )}
  1946. />
  1947. <Route
  1948. path="releases/:version/"
  1949. component={errorHandler(
  1950. redirectDeprecatedProjectRoute(
  1951. ({orgId, projectId, router}) =>
  1952. `/organizations/${orgId}/releases/${router.params.version}/?project=${projectId}`
  1953. )
  1954. )}
  1955. />
  1956. <Route
  1957. path="releases/:version/new-events/"
  1958. component={errorHandler(
  1959. redirectDeprecatedProjectRoute(
  1960. ({orgId, projectId, router}) =>
  1961. `/organizations/${orgId}/releases/${router.params.version}/new-events/?project=${projectId}`
  1962. )
  1963. )}
  1964. />
  1965. <Route
  1966. path="releases/:version/all-events/"
  1967. component={errorHandler(
  1968. redirectDeprecatedProjectRoute(
  1969. ({orgId, projectId, router}) =>
  1970. `/organizations/${orgId}/releases/${router.params.version}/all-events/?project=${projectId}`
  1971. )
  1972. )}
  1973. />
  1974. <Route
  1975. path="releases/:version/commits/"
  1976. component={errorHandler(
  1977. redirectDeprecatedProjectRoute(
  1978. ({orgId, projectId, router}) =>
  1979. `/organizations/${orgId}/releases/${router.params.version}/commits/?project=${projectId}`
  1980. )
  1981. )}
  1982. />
  1983. </Route>
  1984. );
  1985. const profilingChildRoutes = (
  1986. <Fragment>
  1987. <IndexRoute component={make(() => import('sentry/views/profiling/content'))} />
  1988. <Route
  1989. path="summary/:projectId/"
  1990. component={make(() => import('sentry/views/profiling/profileSummary'))}
  1991. />
  1992. <Route
  1993. path="profile/:projectId/:eventId/"
  1994. component={make(() => import('sentry/views/profiling/profilesProvider'))}
  1995. >
  1996. <Route
  1997. path="details/"
  1998. component={make(() => import('sentry/views/profiling/profileDetails'))}
  1999. />
  2000. <Route
  2001. path="flamechart/"
  2002. component={make(() => import('sentry/views/profiling/profileFlamechart'))}
  2003. />
  2004. </Route>
  2005. </Fragment>
  2006. );
  2007. const profilingRoutes = (
  2008. <Fragment>
  2009. {usingCustomerDomain && (
  2010. <Route
  2011. path="/profiling/"
  2012. component={withDomainRequired(make(() => import('sentry/views/profiling')))}
  2013. key="orgless-profiling-route"
  2014. >
  2015. {profilingChildRoutes}
  2016. </Route>
  2017. )}
  2018. <Route
  2019. path="/organizations/:orgId/profiling/"
  2020. component={withDomainRedirect(make(() => import('sentry/views/profiling')))}
  2021. key="org-profiling"
  2022. >
  2023. {profilingChildRoutes}
  2024. </Route>
  2025. </Fragment>
  2026. );
  2027. const organizationRoutes = (
  2028. <Route component={errorHandler(OrganizationDetails)}>
  2029. {settingsRoutes}
  2030. {projectsRoutes}
  2031. {dashboardRoutes}
  2032. {userFeedbackRoutes}
  2033. {issueListRoutes}
  2034. {issueDetailsRoutes}
  2035. {alertRoutes}
  2036. {cronsRoutes}
  2037. {replayRoutes}
  2038. {releasesRoutes}
  2039. {activityRoutes}
  2040. {statsRoutes}
  2041. {discoverRoutes}
  2042. {performanceRoutes}
  2043. {profilingRoutes}
  2044. {adminManageRoutes}
  2045. {gettingStartedRoutes}
  2046. {legacyOrganizationRootRoutes}
  2047. {legacyOrgRedirects}
  2048. </Route>
  2049. );
  2050. const legacyRedirectRoutes = (
  2051. <Route path="/:orgId/">
  2052. <IndexRedirect to="/organizations/:orgId/" />
  2053. <Route path=":projectId/settings/">
  2054. <Redirect from="teams/" to="/settings/:orgId/projects/:projectId/teams/" />
  2055. <Redirect from="alerts/" to="/settings/:orgId/projects/:projectId/alerts/" />
  2056. <Redirect
  2057. from="alerts/rules/"
  2058. to="/settings/:orgId/projects/:projectId/alerts/rules/"
  2059. />
  2060. <Redirect
  2061. from="alerts/rules/new/"
  2062. to="/settings/:orgId/projects/:projectId/alerts/rules/new/"
  2063. />
  2064. <Redirect
  2065. from="alerts/rules/:ruleId/"
  2066. to="/settings/:orgId/projects/:projectId/alerts/rules/:ruleId/"
  2067. />
  2068. <Redirect
  2069. from="environments/"
  2070. to="/settings/:orgId/projects/:projectId/environments/"
  2071. />
  2072. <Redirect
  2073. from="environments/hidden/"
  2074. to="/settings/:orgId/projects/:projectId/environments/hidden/"
  2075. />
  2076. <Redirect from="tags/" to="/settings/projects/:orgId/projects/:projectId/tags/" />
  2077. <Redirect
  2078. from="issue-tracking/"
  2079. to="/settings/:orgId/projects/:projectId/issue-tracking/"
  2080. />
  2081. <Redirect
  2082. from="release-tracking/"
  2083. to="/settings/:orgId/projects/:projectId/release-tracking/"
  2084. />
  2085. <Redirect
  2086. from="ownership/"
  2087. to="/settings/:orgId/projects/:projectId/ownership/"
  2088. />
  2089. <Redirect
  2090. from="data-forwarding/"
  2091. to="/settings/:orgId/projects/:projectId/data-forwarding/"
  2092. />
  2093. <Redirect
  2094. from="debug-symbols/"
  2095. to="/settings/:orgId/projects/:projectId/debug-symbols/"
  2096. />
  2097. <Redirect
  2098. from="processing-issues/"
  2099. to="/settings/:orgId/projects/:projectId/processing-issues/"
  2100. />
  2101. <Redirect from="filters/" to="/settings/:orgId/projects/:projectId/filters/" />
  2102. <Redirect from="hooks/" to="/settings/:orgId/projects/:projectId/hooks/" />
  2103. <Redirect from="keys/" to="/settings/:orgId/projects/:projectId/keys/" />
  2104. <Redirect
  2105. from="keys/:keyId/"
  2106. to="/settings/:orgId/projects/:projectId/keys/:keyId/"
  2107. />
  2108. <Redirect
  2109. from="user-feedback/"
  2110. to="/settings/:orgId/projects/:projectId/user-feedback/"
  2111. />
  2112. <Redirect
  2113. from="security-headers/"
  2114. to="/settings/:orgId/projects/:projectId/security-headers/"
  2115. />
  2116. <Redirect
  2117. from="security-headers/csp/"
  2118. to="/settings/:orgId/projects/:projectId/security-headers/csp/"
  2119. />
  2120. <Redirect
  2121. from="security-headers/expect-ct/"
  2122. to="/settings/:orgId/projects/:projectId/security-headers/expect-ct/"
  2123. />
  2124. <Redirect
  2125. from="security-headers/hpkp/"
  2126. to="/settings/:orgId/projects/:projectId/security-headers/hpkp/"
  2127. />
  2128. <Redirect from="plugins/" to="/settings/:orgId/projects/:projectId/plugins/" />
  2129. <Redirect
  2130. from="plugins/:pluginId/"
  2131. to="/settings/:orgId/projects/:projectId/plugins/:pluginId/"
  2132. />
  2133. <Redirect
  2134. from="integrations/:providerKey/"
  2135. to="/settings/:orgId/projects/:projectId/integrations/:providerKey/"
  2136. />
  2137. <Redirect from="install/" to="/settings/:orgId/projects/:projectId/install/" />
  2138. <Redirect
  2139. from="install/:platform'"
  2140. to="/settings/:orgId/projects/:projectId/install/:platform/"
  2141. />
  2142. </Route>
  2143. <Redirect from=":projectId/group/:groupId/" to="issues/:groupId/" />
  2144. <Redirect
  2145. from=":projectId/issues/:groupId/"
  2146. to="/organizations/:orgId/issues/:groupId/"
  2147. />
  2148. <Redirect
  2149. from=":projectId/issues/:groupId/events/"
  2150. to="/organizations/:orgId/issues/:groupId/events/"
  2151. />
  2152. <Redirect
  2153. from=":projectId/issues/:groupId/events/:eventId/"
  2154. to="/organizations/:orgId/issues/:groupId/events/:eventId/"
  2155. />
  2156. <Redirect
  2157. from=":projectId/issues/:groupId/tags/"
  2158. to="/organizations/:orgId/issues/:groupId/tags/"
  2159. />
  2160. <Redirect
  2161. from=":projectId/issues/:groupId/tags/:tagKey/"
  2162. to="/organizations/:orgId/issues/:groupId/tags/:tagKey/"
  2163. />
  2164. <Redirect
  2165. from=":projectId/issues/:groupId/feedback/"
  2166. to="/organizations/:orgId/issues/:groupId/feedback/"
  2167. />
  2168. <Redirect
  2169. from=":projectId/issues/:groupId/similar/"
  2170. to="/organizations/:orgId/issues/:groupId/similar/"
  2171. />
  2172. <Redirect
  2173. from=":projectId/issues/:groupId/merged/"
  2174. to="/organizations/:orgId/issues/:groupId/merged/"
  2175. />
  2176. <Route
  2177. path=":projectId/events/:eventId/"
  2178. component={errorHandler(ProjectEventRedirect)}
  2179. />
  2180. </Route>
  2181. );
  2182. const appRoutes = (
  2183. <Route>
  2184. {experimentalSpaRoutes}
  2185. <Route path="/" component={errorHandler(App)}>
  2186. {rootRoutes}
  2187. {organizationRoutes}
  2188. {legacyRedirectRoutes}
  2189. <Route path="*" component={errorHandler(RouteNotFound)} />
  2190. </Route>
  2191. </Route>
  2192. );
  2193. return appRoutes;
  2194. }
  2195. // We load routes both when initializing the SDK (for routing integrations) and
  2196. // when the app renders Main. Memoize to avoid rebuilding the route tree.
  2197. export const routes = memoize(buildRoutes);
  2198. function NoOp(props: {children: React.ReactNode}) {
  2199. return <Fragment>{props.children}</Fragment>;
  2200. }