routes.tsx 60 KB

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