routes.tsx 59 KB

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