routes.tsx 59 KB

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