routes.tsx 60 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914
  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} 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. type CustomProps = {
  30. name?: string;
  31. };
  32. /**
  33. * We add some additional props to our routes
  34. */
  35. const Route = BaseRoute as React.ComponentClass<RouteProps & CustomProps>;
  36. const IndexRoute = BaseIndexRoute as React.ComponentClass<IndexRouteProps & CustomProps>;
  37. const hook = (name: HookName) => HookStore.get(name).map(cb => cb());
  38. const SafeLazyLoad = errorHandler(LazyLoad);
  39. type PromisedImport<C> = Promise<{default: C}>;
  40. type ComponentType = React.ComponentType<any>;
  41. // NOTE: makeLazyloadComponent is exported for use in the sentry.io (getsentry)
  42. // pirvate routing tree.
  43. /**
  44. * Factory function to produce a component that will render the SafeLazyLoad
  45. * _with_ the required props.
  46. */
  47. export function makeLazyloadComponent<C extends ComponentType>(
  48. resolve: () => PromisedImport<C>
  49. ) {
  50. // XXX: Assign the component to a variable so it has a displayname
  51. const RouteLazyLoad: React.FC<React.ComponentProps<C>> = props => {
  52. return <SafeLazyLoad {...props} component={resolve} />;
  53. };
  54. return RouteLazyLoad;
  55. }
  56. // Shorthand to avoid extra line wrapping
  57. const make = makeLazyloadComponent;
  58. function buildRoutes() {
  59. // Read this to understand where to add new routes, how / why the routing
  60. // tree is structured the way it is, and how the lazy-loading /
  61. // code-splitting works for pages.
  62. //
  63. // ## Formatting
  64. //
  65. // NOTE that there are intentionally NO blank lines within route tree blocks.
  66. // This helps make it easier to navigate within the file by using your
  67. // editors shortcuts to jump between 'paragraphs' of code.
  68. //
  69. // [!!] Do NOT add blank lines within route blocks to preserve this behavior!
  70. //
  71. //
  72. // ## Lazy loading
  73. //
  74. // * The `SafeLazyLoad` component
  75. //
  76. // Most routes are rendered as LazyLoad components (SafeLazyLoad is the
  77. // errorHandler wrapped version). This means the rendered component for the
  78. // route will only be loaded when the route is loaded. This helps us
  79. // "code-split" the app.
  80. //
  81. // ## Hooks
  82. //
  83. // There are a number of `hook()` routes placed within the routing tree to
  84. // allow for additional routes to be augmented into the application via the
  85. // hookStore mechanism.
  86. //
  87. //
  88. // ## The structure
  89. //
  90. // * `experimentalSpaRoutes`
  91. //
  92. // These routes are specifically for the experimental single-page-app mode,
  93. // where Sentry is run separate from Django. These are NOT part of the root
  94. // <App /> component.
  95. //
  96. // Right now these are mainly used for authentication pages. In the future
  97. // they would be used for other pages like registration.
  98. //
  99. // * `rootRoutes`
  100. //
  101. // These routes live directly under the <App /> container, and generally
  102. // are not specific to an organization.
  103. //
  104. // * `settingsRoutes`
  105. //
  106. // This is the route tree for all of `/settings/`. This route tree is
  107. // composed of a few different sub-trees.
  108. //
  109. // - `accountSettingsRoutes` User specific settings
  110. // - `orgSettingsRoutes` Specific to a organization
  111. // - `projectSettingsRoutes` Specific to a project
  112. // - `legacySettingsRedirects` Routes that used to exist in settings
  113. //
  114. // * `organizationRoutes`
  115. //
  116. // This is where a majority of the app routes live. This is wrapped with
  117. // the <OrganizationDetails /> component, which provides the sidebar and
  118. // organization context.
  119. //
  120. // Within these routes are a variety of subroutes. They are not all
  121. // listed here as the subroutes will be added and removed, and most are
  122. // self explanatory.
  123. //
  124. // * `legacyRedirectRoutes`
  125. //
  126. // This route tree contains <Redirect /> routes for many old legacy paths.
  127. //
  128. // You may also find <Redirect />'s collocated next to the feature routes
  129. // they have redirects for. A good rule here is to place 'helper' redirects
  130. // next to the routes they redirect to, and place 'legacy route' redirects
  131. // for routes that have completely changed in this tree.
  132. const experimentalSpaRoutes = EXPERIMENTAL_SPA ? (
  133. <Route path="/auth/login/" component={errorHandler(AuthLayout)}>
  134. <IndexRoute component={make(() => import('sentry/views/auth/login'))} />
  135. <Route path=":orgId/" 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 path="security-and-privacy/" name={t('Security & Privacy')}>
  402. <IndexRoute
  403. component={make(
  404. () => import('sentry/views/settings/projectSecurityAndPrivacy')
  405. )}
  406. />
  407. <Route
  408. path="advanced-data-scrubbing/:scrubbingId/"
  409. component={make(
  410. () => import('sentry/views/settings/projectSecurityAndPrivacy')
  411. )}
  412. />
  413. </Route>
  414. <Route
  415. path="debug-symbols/"
  416. name={t('Debug Information Files')}
  417. component={make(() => import('sentry/views/settings/projectDebugFiles'))}
  418. />
  419. <Route
  420. path="proguard/"
  421. name={t('ProGuard Mappings')}
  422. component={make(() => import('sentry/views/settings/projectProguard'))}
  423. />
  424. <Route
  425. path="performance/"
  426. name={t('Performance')}
  427. component={make(() => import('sentry/views/settings/projectPerformance'))}
  428. />
  429. <Route
  430. path="source-maps/"
  431. name={t('Source Maps')}
  432. component={make(() => import('sentry/views/settings/projectSourceMaps'))}
  433. >
  434. <IndexRoute
  435. component={make(() => import('sentry/views/settings/projectSourceMaps/list'))}
  436. />
  437. <Route
  438. path=":name/"
  439. name={t('Archive')}
  440. component={make(() => import('sentry/views/settings/projectSourceMaps/detail'))}
  441. />
  442. </Route>
  443. <Route
  444. path="processing-issues/"
  445. name={t('Processing Issues')}
  446. component={make(
  447. () => import('sentry/views/settings/project/projectProcessingIssues')
  448. )}
  449. />
  450. <Route
  451. path="filters/"
  452. name={t('Inbound Filters')}
  453. component={make(() => import('sentry/views/settings/project/projectFilters'))}
  454. >
  455. <IndexRedirect to="data-filters/" />
  456. <Route path=":filterType/" />
  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 path="security-and-privacy/" name={t('Security & Privacy')}>
  654. <IndexRoute
  655. component={make(
  656. () => import('sentry/views/settings/organizationSecurityAndPrivacy')
  657. )}
  658. />
  659. <Route
  660. path="advanced-data-scrubbing/:scrubbingId/"
  661. component={make(
  662. () => import('sentry/views/settings/organizationSecurityAndPrivacy')
  663. )}
  664. />
  665. </Route>
  666. <Route name={t('Teams')} path="teams/">
  667. <IndexRoute
  668. component={make(() => import('sentry/views/settings/organizationTeams'))}
  669. />
  670. <Route
  671. path=":teamId/"
  672. name={t('Team')}
  673. component={make(
  674. () => import('sentry/views/settings/organizationTeams/teamDetails')
  675. )}
  676. >
  677. <IndexRedirect to="members/" />
  678. <Route
  679. path="members/"
  680. name={t('Members')}
  681. component={make(
  682. () => import('sentry/views/settings/organizationTeams/teamMembers')
  683. )}
  684. />
  685. <Route
  686. path="notifications/"
  687. name={t('Notifications')}
  688. component={make(
  689. () => import('sentry/views/settings/organizationTeams/teamNotifications')
  690. )}
  691. />
  692. <Route
  693. path="projects/"
  694. name={t('Projects')}
  695. component={make(
  696. () => import('sentry/views/settings/organizationTeams/teamProjects')
  697. )}
  698. />
  699. <Route
  700. path="settings/"
  701. name={t('Settings')}
  702. component={make(
  703. () => import('sentry/views/settings/organizationTeams/teamSettings')
  704. )}
  705. />
  706. </Route>
  707. </Route>
  708. <Redirect from="plugins/" to="integrations/" />
  709. <Route name={t('Integrations')} path="plugins/">
  710. <Route
  711. path=":integrationSlug/"
  712. name={t('Integration Details')}
  713. component={make(
  714. () => import('sentry/views/organizationIntegrations/pluginDetailedView')
  715. )}
  716. />
  717. </Route>
  718. <Redirect from="sentry-apps/" to="integrations/" />
  719. <Route name={t('Integrations')} path="sentry-apps/">
  720. <Route
  721. path=":integrationSlug"
  722. name={t('Details')}
  723. component={make(
  724. () => import('sentry/views/organizationIntegrations/sentryAppDetailedView')
  725. )}
  726. />
  727. </Route>
  728. <Redirect from="document-integrations/" to="integrations/" />
  729. <Route name={t('Integrations')} path="document-integrations/">
  730. <Route
  731. path=":integrationSlug"
  732. name={t('Details')}
  733. component={make(
  734. () =>
  735. import('sentry/views/organizationIntegrations/docIntegrationDetailedView')
  736. )}
  737. />
  738. </Route>
  739. <Route name={t('Integrations')} path="integrations/">
  740. <IndexRoute
  741. component={make(
  742. () => import('sentry/views/organizationIntegrations/integrationListDirectory')
  743. )}
  744. />
  745. <Route
  746. path=":integrationSlug"
  747. name={t('Integration Details')}
  748. component={make(
  749. () => import('sentry/views/organizationIntegrations/integrationDetailedView')
  750. )}
  751. />
  752. <Route
  753. path=":providerKey/:integrationId/"
  754. name={t('Configure Integration')}
  755. component={make(
  756. () =>
  757. import(
  758. 'sentry/views/settings/organizationIntegrations/configureIntegration'
  759. )
  760. )}
  761. />
  762. </Route>
  763. <Redirect from="developer-settings/sentry-functions/" to="developer-settings/" />
  764. <Route name={t('Developer Settings')} path="developer-settings/">
  765. <IndexRoute
  766. component={make(
  767. () => import('sentry/views/settings/organizationDeveloperSettings')
  768. )}
  769. />
  770. <Route
  771. path="new-public/"
  772. name={t('Create Integration')}
  773. component={make(
  774. () =>
  775. import(
  776. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails'
  777. )
  778. )}
  779. />
  780. <Route
  781. path="new-internal/"
  782. name={t('Create Integration')}
  783. component={make(
  784. () =>
  785. import(
  786. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails'
  787. )
  788. )}
  789. />
  790. <Route
  791. path=":appSlug/"
  792. name={t('Edit Integration')}
  793. component={make(
  794. () =>
  795. import(
  796. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails'
  797. )
  798. )}
  799. />
  800. <Route
  801. path=":appSlug/dashboard/"
  802. name={t('Integration Dashboard')}
  803. component={make(
  804. () =>
  805. import(
  806. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDashboard'
  807. )
  808. )}
  809. />
  810. <Route path="sentry-functions/" name={t('Sentry Functions')}>
  811. <Route
  812. path="new/"
  813. name={t('Create Sentry Function')}
  814. component={make(
  815. () =>
  816. import(
  817. 'sentry/views/settings/organizationDeveloperSettings/sentryFunctionDetails'
  818. )
  819. )}
  820. />
  821. <Route
  822. path=":functionSlug/"
  823. name={t('Edit Sentry Function')}
  824. component={make(
  825. () =>
  826. import(
  827. 'sentry/views/settings/organizationDeveloperSettings/sentryFunctionDetails'
  828. )
  829. )}
  830. />
  831. </Route>
  832. </Route>
  833. </Route>
  834. );
  835. const legacySettingsRedirects = (
  836. <Fragment>
  837. <Redirect from=":projectId/" to="projects/:projectId/" />
  838. <Redirect from=":projectId/alerts/" to="projects/:projectId/alerts/" />
  839. <Redirect from=":projectId/alerts/rules/" to="projects/:projectId/alerts/rules/" />
  840. <Redirect
  841. from=":projectId/alerts/rules/:ruleId/"
  842. to="projects/:projectId/alerts/rules/:ruleId/"
  843. />
  844. </Fragment>
  845. );
  846. const settingsRoutes = (
  847. <Route path="/settings/" name={t('Settings')} component={SettingsWrapper}>
  848. <IndexRoute component={make(() => import('sentry/views/settings/settingsIndex'))} />
  849. {accountSettingsRoutes}
  850. <Route name={t('Organization')} path=":orgId/">
  851. {orgSettingsRoutes}
  852. {projectSettingsRoutes}
  853. {legacySettingsRedirects}
  854. </Route>
  855. </Route>
  856. );
  857. const projectsRoutes = (
  858. <Route path="/organizations/:orgId/projects/">
  859. <IndexRoute component={make(() => import('sentry/views/projectsDashboard'))} />
  860. <Route
  861. path="new/"
  862. component={make(() => import('sentry/views/projectInstall/newProject'))}
  863. />
  864. <Route
  865. path=":projectId/getting-started/"
  866. component={make(() => import('sentry/views/projectInstall/gettingStarted'))}
  867. >
  868. <IndexRoute
  869. component={make(() => import('sentry/views/projectInstall/overview'))}
  870. />
  871. <Route
  872. path=":platform/"
  873. component={make(
  874. () => import('sentry/views/projectInstall/platformOrIntegration')
  875. )}
  876. />
  877. </Route>
  878. <Route
  879. path=":projectId/"
  880. component={make(() => import('sentry/views/projectDetail'))}
  881. />
  882. <Route
  883. path=":projectId/events/:eventId/"
  884. component={errorHandler(ProjectEventRedirect)}
  885. />
  886. </Route>
  887. );
  888. const dashboardRoutes = (
  889. <Fragment>
  890. <Route
  891. path="/organizations/:orgId/dashboards/"
  892. component={make(() => import('sentry/views/dashboardsV2'))}
  893. >
  894. <IndexRoute component={make(() => import('sentry/views/dashboardsV2/manage'))} />
  895. </Route>
  896. <Route
  897. path="/organizations/:orgId/dashboards/new/"
  898. component={make(() => import('sentry/views/dashboardsV2/create'))}
  899. >
  900. <Route
  901. path="widget/:widgetIndex/edit/"
  902. component={make(() => import('sentry/views/dashboardsV2/widgetBuilder'))}
  903. />
  904. <Route
  905. path="widget/new/"
  906. component={make(() => import('sentry/views/dashboardsV2/widgetBuilder'))}
  907. />
  908. </Route>
  909. <Route
  910. path="/organizations/:orgId/dashboards/new/:templateId"
  911. component={make(() => import('sentry/views/dashboardsV2/create'))}
  912. >
  913. <Route
  914. path="widget/:widgetId/"
  915. component={make(() => import('sentry/views/dashboardsV2/create'))}
  916. />
  917. </Route>
  918. <Redirect
  919. from="/organizations/:orgId/dashboards/:dashboardId/"
  920. to="/organizations/:orgId/dashboard/:dashboardId/"
  921. />
  922. <Route
  923. path="/organizations/:orgId/dashboard/:dashboardId/"
  924. component={make(() => import('sentry/views/dashboardsV2/view'))}
  925. >
  926. <Route
  927. path="widget/:widgetIndex/edit/"
  928. component={make(() => import('sentry/views/dashboardsV2/widgetBuilder'))}
  929. />
  930. <Route
  931. path="widget/new/"
  932. component={make(() => import('sentry/views/dashboardsV2/widgetBuilder'))}
  933. />
  934. <Route
  935. path="widget/:widgetId/"
  936. component={make(() => import('sentry/views/dashboardsV2/view'))}
  937. />
  938. </Route>
  939. </Fragment>
  940. );
  941. const alertRoutes = (
  942. <Route
  943. path="/organizations/:orgId/alerts/"
  944. component={make(() => import('sentry/views/alerts'))}
  945. >
  946. <IndexRoute component={make(() => import('sentry/views/alerts/list/incidents'))} />
  947. <Route path="rules/">
  948. <IndexRoute component={make(() => import('sentry/views/alerts/list/rules'))} />
  949. <Route
  950. path="details/:ruleId/"
  951. component={make(() => import('sentry/views/alerts/rules/metric/details'))}
  952. />
  953. <Route
  954. path=":projectId/"
  955. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  956. >
  957. <IndexRedirect to="/organizations/:orgId/alerts/rules/" />
  958. <Route
  959. path=":ruleId/"
  960. component={make(() => import('sentry/views/alerts/edit'))}
  961. />
  962. </Route>
  963. <Route
  964. path=":projectId/:ruleId/details/"
  965. component={make(() => import('sentry/views/alerts/rules/issue/details'))}
  966. >
  967. <IndexRoute
  968. component={make(
  969. () => import('sentry/views/alerts/rules/issue/details/ruleDetails')
  970. )}
  971. />
  972. </Route>
  973. </Route>
  974. <Route path="metric-rules/">
  975. <IndexRedirect to="/organizations/:orgId/alerts/rules/" />
  976. <Route
  977. path=":projectId/"
  978. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  979. >
  980. <IndexRedirect to="/organizations/:orgId/alerts/rules/" />
  981. <Route
  982. path=":ruleId/"
  983. component={make(() => import('sentry/views/alerts/edit'))}
  984. />
  985. </Route>
  986. </Route>
  987. <Route
  988. path="wizard/"
  989. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  990. >
  991. <IndexRoute component={make(() => import('sentry/views/alerts/wizard'))} />
  992. </Route>
  993. <Route
  994. path="new/"
  995. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  996. >
  997. <IndexRedirect to="/organizations/:orgId/alerts/wizard/" />
  998. <Route
  999. path=":alertType/"
  1000. component={make(() => import('sentry/views/alerts/create'))}
  1001. />
  1002. </Route>
  1003. <Route
  1004. path=":alertId/"
  1005. component={make(() => import('sentry/views/alerts/incidentRedirect'))}
  1006. />
  1007. <Route
  1008. path=":projectId/"
  1009. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1010. >
  1011. <Route path="new/" component={make(() => import('sentry/views/alerts/create'))} />
  1012. <Route
  1013. path="wizard/"
  1014. component={make(() => import('sentry/views/alerts/wizard'))}
  1015. />
  1016. </Route>
  1017. </Route>
  1018. );
  1019. const monitorsRoutes = (
  1020. <Route
  1021. path="/organizations/:orgId/monitors/"
  1022. component={make(() => import('sentry/views/monitors'))}
  1023. >
  1024. <IndexRoute component={make(() => import('sentry/views/monitors/monitors'))} />
  1025. <Route
  1026. path="/organizations/:orgId/monitors/create/"
  1027. component={make(() => import('sentry/views/monitors/create'))}
  1028. />
  1029. <Route
  1030. path="/organizations/:orgId/monitors/:monitorId/"
  1031. component={make(() => import('sentry/views/monitors/details'))}
  1032. />
  1033. <Route
  1034. path="/organizations/:orgId/monitors/:monitorId/edit/"
  1035. component={make(() => import('sentry/views/monitors/edit'))}
  1036. />
  1037. </Route>
  1038. );
  1039. const replayRoutes = (
  1040. <Route
  1041. path="/organizations/:orgId/replays/"
  1042. component={make(() => import('sentry/views/replays'))}
  1043. >
  1044. <IndexRoute component={make(() => import('sentry/views/replays/replays'))} />
  1045. <Route
  1046. path=":replaySlug/"
  1047. component={make(() => import('sentry/views/replays/details'))}
  1048. />
  1049. </Route>
  1050. );
  1051. const releasesRoutes = (
  1052. <Route path="/organizations/:orgId/releases/">
  1053. <IndexRoute component={make(() => import('sentry/views/releases/list'))} />
  1054. <Route
  1055. path=":release/"
  1056. component={make(() => import('sentry/views/releases/detail'))}
  1057. >
  1058. <IndexRoute
  1059. component={make(() => import('sentry/views/releases/detail/overview'))}
  1060. />
  1061. <Route
  1062. path="commits/"
  1063. component={make(
  1064. () => import('sentry/views/releases/detail/commitsAndFiles/commits')
  1065. )}
  1066. />
  1067. <Route
  1068. path="files-changed/"
  1069. component={make(
  1070. () => import('sentry/views/releases/detail/commitsAndFiles/filesChanged')
  1071. )}
  1072. />
  1073. <Redirect from="new-events/" to="/organizations/:orgId/releases/:release/" />
  1074. <Redirect from="all-events/" to="/organizations/:orgId/releases/:release/" />
  1075. </Route>
  1076. </Route>
  1077. );
  1078. const activityRoutes = (
  1079. <Route
  1080. path="/organizations/:orgId/activity/"
  1081. component={make(() => import('sentry/views/organizationActivity'))}
  1082. />
  1083. );
  1084. const statsRoutes = (
  1085. <Route path="/organizations/:orgId/stats/">
  1086. <IndexRoute component={make(() => import('sentry/views/organizationStats'))} />
  1087. <Route
  1088. path="issues/"
  1089. component={make(() => import('sentry/views/organizationStats/teamInsights'))}
  1090. >
  1091. <IndexRoute
  1092. component={make(
  1093. () => import('sentry/views/organizationStats/teamInsights/issues')
  1094. )}
  1095. />
  1096. </Route>
  1097. <Route
  1098. path="health/"
  1099. component={make(() => import('sentry/views/organizationStats/teamInsights'))}
  1100. >
  1101. <IndexRoute
  1102. component={make(
  1103. () => import('sentry/views/organizationStats/teamInsights/health')
  1104. )}
  1105. />
  1106. </Route>
  1107. <Redirect from="team/" to="/organizations/:orgId/stats/issues/" />
  1108. </Route>
  1109. );
  1110. // TODO(mark) Long term this /queries route should go away and /discover
  1111. // should be the canonical route for discover2. We have a redirect right now
  1112. // as /discover was for discover 1 and most of the application is linking to
  1113. // /discover/queries and not /discover
  1114. const discoverRoutes = (
  1115. <Route
  1116. path="/organizations/:orgId/discover/"
  1117. component={make(() => import('sentry/views/eventsV2'))}
  1118. >
  1119. <IndexRedirect to="queries/" />
  1120. <Route
  1121. path="queries/"
  1122. component={make(() => import('sentry/views/eventsV2/landing'))}
  1123. />
  1124. <Route
  1125. path="results/"
  1126. component={make(() => import('sentry/views/eventsV2/results'))}
  1127. />
  1128. <Route
  1129. path=":eventSlug/"
  1130. component={make(() => import('sentry/views/eventsV2/eventDetails'))}
  1131. />
  1132. </Route>
  1133. );
  1134. const performanceRoutes = (
  1135. <Route
  1136. path="/organizations/:orgId/performance/"
  1137. component={make(() => import('sentry/views/performance'))}
  1138. >
  1139. <IndexRoute component={make(() => import('sentry/views/performance/content'))} />
  1140. <Route
  1141. path="trends/"
  1142. component={make(() => import('sentry/views/performance/trends'))}
  1143. />
  1144. <Route path="/organizations/:orgId/performance/summary/">
  1145. <IndexRoute
  1146. component={make(
  1147. () =>
  1148. import('sentry/views/performance/transactionSummary/transactionOverview')
  1149. )}
  1150. />
  1151. <Route
  1152. path="replays/"
  1153. component={make(
  1154. () => import('sentry/views/performance/transactionSummary/transactionReplays')
  1155. )}
  1156. />
  1157. <Route
  1158. path="vitals/"
  1159. component={make(
  1160. () => import('sentry/views/performance/transactionSummary/transactionVitals')
  1161. )}
  1162. />
  1163. <Route
  1164. path="tags/"
  1165. component={make(
  1166. () => import('sentry/views/performance/transactionSummary/transactionTags')
  1167. )}
  1168. />
  1169. <Route
  1170. path="events/"
  1171. component={make(
  1172. () => import('sentry/views/performance/transactionSummary/transactionEvents')
  1173. )}
  1174. />
  1175. <Route
  1176. path="anomalies/"
  1177. component={make(
  1178. () =>
  1179. import('sentry/views/performance/transactionSummary/transactionAnomalies')
  1180. )}
  1181. />
  1182. <Route path="spans/">
  1183. <IndexRoute
  1184. component={make(
  1185. () => import('sentry/views/performance/transactionSummary/transactionSpans')
  1186. )}
  1187. />
  1188. <Route
  1189. path=":spanSlug/"
  1190. component={make(
  1191. () =>
  1192. import(
  1193. 'sentry/views/performance/transactionSummary/transactionSpans/spanDetails'
  1194. )
  1195. )}
  1196. />
  1197. </Route>
  1198. </Route>
  1199. <Route
  1200. path="vitaldetail/"
  1201. component={make(() => import('sentry/views/performance/vitalDetail'))}
  1202. />
  1203. <Route
  1204. path="trace/:traceSlug/"
  1205. component={make(() => import('sentry/views/performance/traceDetails'))}
  1206. />
  1207. <Route
  1208. path=":eventSlug/"
  1209. component={make(() => import('sentry/views/performance/transactionDetails'))}
  1210. />
  1211. </Route>
  1212. );
  1213. const userFeedbackRoutes = (
  1214. <Route
  1215. path="/organizations/:orgId/user-feedback/"
  1216. component={make(() => import('sentry/views/userFeedback'))}
  1217. />
  1218. );
  1219. const issueListRoutes = (
  1220. <Route
  1221. path="/organizations/:orgId/issues/"
  1222. component={errorHandler(IssueListContainer)}
  1223. >
  1224. <Redirect from="/organizations/:orgId/" to="/organizations/:orgId/issues/" />
  1225. <IndexRoute component={errorHandler(IssueListOverview)} />
  1226. <Route path="searches/:searchId/" component={errorHandler(IssueListOverview)} />
  1227. </Route>
  1228. );
  1229. // Once org issues is complete, these routes can be nested under
  1230. // /organizations/:orgId/issues
  1231. const issueDetailsRoutes = (
  1232. <Route
  1233. path="/organizations/:orgId/issues/:groupId/"
  1234. component={make(() => import('sentry/views/organizationGroupDetails'))}
  1235. >
  1236. <IndexRoute
  1237. component={make(
  1238. () => import('sentry/views/organizationGroupDetails/groupEventDetails')
  1239. )}
  1240. props={{
  1241. currentTab: Tab.DETAILS,
  1242. isEventRoute: false,
  1243. }}
  1244. />
  1245. <Route
  1246. path="replays/"
  1247. component={make(
  1248. () => import('sentry/views/organizationGroupDetails/groupReplays')
  1249. )}
  1250. props={{
  1251. currentTab: Tab.REPLAYS,
  1252. isEventRoute: false,
  1253. }}
  1254. />
  1255. <Route
  1256. path="activity/"
  1257. component={make(
  1258. () => import('sentry/views/organizationGroupDetails/groupActivity')
  1259. )}
  1260. props={{
  1261. currentTab: Tab.ACTIVITY,
  1262. isEventRoute: false,
  1263. }}
  1264. />
  1265. <Route
  1266. path="events/"
  1267. component={make(
  1268. () => import('sentry/views/organizationGroupDetails/groupEvents')
  1269. )}
  1270. props={{
  1271. currentTab: Tab.EVENTS,
  1272. isEventRoute: false,
  1273. }}
  1274. />
  1275. <Route
  1276. path="tags/"
  1277. component={make(() => import('sentry/views/organizationGroupDetails/groupTags'))}
  1278. props={{
  1279. currentTab: Tab.TAGS,
  1280. isEventRoute: false,
  1281. }}
  1282. />
  1283. <Route
  1284. path="tags/:tagKey/"
  1285. component={make(
  1286. () => import('sentry/views/organizationGroupDetails/groupTagValues')
  1287. )}
  1288. props={{
  1289. currentTab: Tab.TAGS,
  1290. isEventRoute: false,
  1291. }}
  1292. />
  1293. <Route
  1294. path="feedback/"
  1295. component={make(
  1296. () => import('sentry/views/organizationGroupDetails/groupUserFeedback')
  1297. )}
  1298. props={{
  1299. currentTab: Tab.USER_FEEDBACK,
  1300. isEventRoute: false,
  1301. }}
  1302. />
  1303. <Route
  1304. path="attachments/"
  1305. component={make(
  1306. () => import('sentry/views/organizationGroupDetails/groupEventAttachments')
  1307. )}
  1308. props={{
  1309. currentTab: Tab.ATTACHMENTS,
  1310. isEventRoute: false,
  1311. }}
  1312. />
  1313. <Route
  1314. path="similar/"
  1315. component={make(
  1316. () => import('sentry/views/organizationGroupDetails/groupSimilarIssues')
  1317. )}
  1318. props={{
  1319. currentTab: Tab.SIMILAR_ISSUES,
  1320. isEventRoute: false,
  1321. }}
  1322. />
  1323. <Route
  1324. path="merged/"
  1325. component={make(
  1326. () => import('sentry/views/organizationGroupDetails/groupMerged')
  1327. )}
  1328. props={{
  1329. currentTab: Tab.MERGED,
  1330. isEventRoute: false,
  1331. }}
  1332. />
  1333. <Route
  1334. path="grouping/"
  1335. component={make(() => import('sentry/views/organizationGroupDetails/grouping'))}
  1336. props={{
  1337. currentTab: Tab.GROUPING,
  1338. isEventRoute: false,
  1339. }}
  1340. />
  1341. <Route path="events/:eventId/">
  1342. <IndexRoute
  1343. component={make(
  1344. () => import('sentry/views/organizationGroupDetails/groupEventDetails')
  1345. )}
  1346. props={{
  1347. currentTab: Tab.DETAILS,
  1348. isEventRoute: true,
  1349. }}
  1350. />
  1351. <Route
  1352. path="replays/"
  1353. component={make(
  1354. () => import('sentry/views/organizationGroupDetails/groupReplays')
  1355. )}
  1356. props={{
  1357. currentTab: Tab.REPLAYS,
  1358. isEventRoute: true,
  1359. }}
  1360. />
  1361. <Route
  1362. path="activity/"
  1363. component={make(
  1364. () => import('sentry/views/organizationGroupDetails/groupActivity')
  1365. )}
  1366. props={{
  1367. currentTab: Tab.ACTIVITY,
  1368. isEventRoute: true,
  1369. }}
  1370. />
  1371. <Route
  1372. path="events/"
  1373. component={make(
  1374. () => import('sentry/views/organizationGroupDetails/groupEvents')
  1375. )}
  1376. props={{
  1377. currentTab: Tab.EVENTS,
  1378. isEventRoute: true,
  1379. }}
  1380. />
  1381. <Route
  1382. path="similar/"
  1383. component={make(
  1384. () => import('sentry/views/organizationGroupDetails/groupSimilarIssues')
  1385. )}
  1386. props={{
  1387. currentTab: Tab.SIMILAR_ISSUES,
  1388. isEventRoute: true,
  1389. }}
  1390. />
  1391. <Route
  1392. path="tags/"
  1393. component={make(
  1394. () => import('sentry/views/organizationGroupDetails/groupTags')
  1395. )}
  1396. props={{
  1397. currentTab: Tab.TAGS,
  1398. isEventRoute: true,
  1399. }}
  1400. />
  1401. <Route
  1402. path="tags/:tagKey/"
  1403. component={make(
  1404. () => import('sentry/views/organizationGroupDetails/groupTagValues')
  1405. )}
  1406. props={{
  1407. currentTab: Tab.TAGS,
  1408. isEventRoute: true,
  1409. }}
  1410. />
  1411. <Route
  1412. path="feedback/"
  1413. component={make(
  1414. () => import('sentry/views/organizationGroupDetails/groupUserFeedback')
  1415. )}
  1416. props={{
  1417. currentTab: Tab.USER_FEEDBACK,
  1418. isEventRoute: true,
  1419. }}
  1420. />
  1421. <Route
  1422. path="attachments/"
  1423. component={make(
  1424. () => import('sentry/views/organizationGroupDetails/groupEventAttachments')
  1425. )}
  1426. props={{
  1427. currentTab: Tab.ATTACHMENTS,
  1428. isEventRoute: true,
  1429. }}
  1430. />
  1431. <Route
  1432. path="merged/"
  1433. component={make(
  1434. () => import('sentry/views/organizationGroupDetails/groupMerged')
  1435. )}
  1436. props={{
  1437. currentTab: Tab.MERGED,
  1438. isEventRoute: true,
  1439. }}
  1440. />
  1441. <Route
  1442. path="grouping/"
  1443. component={make(() => import('sentry/views/organizationGroupDetails/grouping'))}
  1444. props={{
  1445. currentTab: Tab.GROUPING,
  1446. isEventRoute: true,
  1447. }}
  1448. />
  1449. </Route>
  1450. </Route>
  1451. );
  1452. // These are the "manage" pages. For sentry.io, these are _different_ from
  1453. // the SaaS admin routes in getsentry.
  1454. const adminManageRoutes = (
  1455. <Route
  1456. path="/manage/"
  1457. component={make(() => import('sentry/views/admin/adminLayout'))}
  1458. >
  1459. <IndexRoute component={make(() => import('sentry/views/admin/adminOverview'))} />
  1460. <Route
  1461. path="buffer/"
  1462. component={make(() => import('sentry/views/admin/adminBuffer'))}
  1463. />
  1464. <Route
  1465. path="relays/"
  1466. component={make(() => import('sentry/views/admin/adminRelays'))}
  1467. />
  1468. <Route
  1469. path="organizations/"
  1470. component={make(() => import('sentry/views/admin/adminOrganizations'))}
  1471. />
  1472. <Route
  1473. path="projects/"
  1474. component={make(() => import('sentry/views/admin/adminProjects'))}
  1475. />
  1476. <Route
  1477. path="queue/"
  1478. component={make(() => import('sentry/views/admin/adminQueue'))}
  1479. />
  1480. <Route
  1481. path="quotas/"
  1482. component={make(() => import('sentry/views/admin/adminQuotas'))}
  1483. />
  1484. <Route
  1485. path="settings/"
  1486. component={make(() => import('sentry/views/admin/adminSettings'))}
  1487. />
  1488. <Route path="users/">
  1489. <IndexRoute component={make(() => import('sentry/views/admin/adminUsers'))} />
  1490. <Route
  1491. path=":id"
  1492. component={make(() => import('sentry/views/admin/adminUserEdit'))}
  1493. />
  1494. </Route>
  1495. <Route
  1496. path="status/mail/"
  1497. component={make(() => import('sentry/views/admin/adminMail'))}
  1498. />
  1499. <Route
  1500. path="status/environment/"
  1501. component={make(() => import('sentry/views/admin/adminEnvironment'))}
  1502. />
  1503. <Route
  1504. path="status/packages/"
  1505. component={make(() => import('sentry/views/admin/adminPackages'))}
  1506. />
  1507. <Route
  1508. path="status/warnings/"
  1509. component={make(() => import('sentry/views/admin/adminWarnings'))}
  1510. />
  1511. {hook('routes:admin')}
  1512. </Route>
  1513. );
  1514. // XXX(epurkhiser): This should probably go away. It's not totally clear to
  1515. // me why we need the OrganizationRoot root container.
  1516. const legacyOrganizationRootRoutes = (
  1517. <Route component={errorHandler(OrganizationRoot)}>
  1518. <Redirect from="/organizations/:orgId/teams/new/" to="/settings/:orgId/teams/" />
  1519. <Route path="/organizations/:orgId/">
  1520. {hook('routes:organization')}
  1521. <Redirect from="/organizations/:orgId/teams/" to="/settings/:orgId/teams/" />
  1522. <Redirect
  1523. from="/organizations/:orgId/teams/your-teams/"
  1524. to="/settings/:orgId/teams/"
  1525. />
  1526. <Redirect
  1527. from="/organizations/:orgId/teams/all-teams/"
  1528. to="/settings/:orgId/teams/"
  1529. />
  1530. <Redirect
  1531. from="/organizations/:orgId/teams/:teamId/"
  1532. to="/settings/:orgId/teams/:teamId/"
  1533. />
  1534. <Redirect
  1535. from="/organizations/:orgId/teams/:teamId/members/"
  1536. to="/settings/:orgId/teams/:teamId/members/"
  1537. />
  1538. <Redirect
  1539. from="/organizations/:orgId/teams/:teamId/projects/"
  1540. to="/settings/:orgId/teams/:teamId/projects/"
  1541. />
  1542. <Redirect
  1543. from="/organizations/:orgId/teams/:teamId/settings/"
  1544. to="/settings/:orgId/teams/:teamId/settings/"
  1545. />
  1546. <Redirect from="/organizations/:orgId/settings/" to="/settings/:orgId/" />
  1547. <Redirect
  1548. from="/organizations/:orgId/api-keys/"
  1549. to="/settings/:orgId/api-keys/"
  1550. />
  1551. <Redirect
  1552. from="/organizations/:orgId/api-keys/:apiKey/"
  1553. to="/settings/:orgId/api-keys/:apiKey/"
  1554. />
  1555. <Redirect from="/organizations/:orgId/members/" to="/settings/:orgId/members/" />
  1556. <Redirect
  1557. from="/organizations/:orgId/members/:memberId/"
  1558. to="/settings/:orgId/members/:memberId/"
  1559. />
  1560. <Redirect
  1561. from="/organizations/:orgId/rate-limits/"
  1562. to="/settings/:orgId/rate-limits/"
  1563. />
  1564. <Redirect from="/organizations/:orgId/repos/" to="/settings/:orgId/repos/" />
  1565. </Route>
  1566. </Route>
  1567. );
  1568. // XXX(epurkhiser): These also exist in the legacyOrganizationRootRoutes. Not
  1569. // sure which one here is more correct.
  1570. const legacyGettingStartedRoutes = (
  1571. <Route
  1572. path="/:orgId/:projectId/getting-started/"
  1573. component={make(() => import('sentry/views/projectInstall/gettingStarted'))}
  1574. >
  1575. <IndexRoute
  1576. component={make(() => import('sentry/views/projectInstall/overview'))}
  1577. />
  1578. <Route
  1579. path=":platform/"
  1580. component={make(
  1581. () => import('sentry/views/projectInstall/platformOrIntegration')
  1582. )}
  1583. />
  1584. </Route>
  1585. );
  1586. // Support for deprecated URLs (pre-Sentry 10). We just redirect users to new
  1587. // canonical URLs.
  1588. //
  1589. // XXX(epurkhiser): Can these be moved over to the legacyOrgRedirects routes,
  1590. // or do these need to be nested into the OrganizationDetails tree?
  1591. const legacyOrgRedirects = (
  1592. <Route path="/:orgId/:projectId/">
  1593. <IndexRoute
  1594. component={errorHandler(
  1595. redirectDeprecatedProjectRoute(
  1596. ({orgId, projectId}) => `/organizations/${orgId}/issues/?project=${projectId}`
  1597. )
  1598. )}
  1599. />
  1600. <Route
  1601. path="issues/"
  1602. component={errorHandler(
  1603. redirectDeprecatedProjectRoute(
  1604. ({orgId, projectId}) => `/organizations/${orgId}/issues/?project=${projectId}`
  1605. )
  1606. )}
  1607. />
  1608. <Route
  1609. path="dashboard/"
  1610. component={errorHandler(
  1611. redirectDeprecatedProjectRoute(
  1612. ({orgId, projectId}) =>
  1613. `/organizations/${orgId}/dashboards/?project=${projectId}`
  1614. )
  1615. )}
  1616. />
  1617. <Route
  1618. path="user-feedback/"
  1619. component={errorHandler(
  1620. redirectDeprecatedProjectRoute(
  1621. ({orgId, projectId}) =>
  1622. `/organizations/${orgId}/user-feedback/?project=${projectId}`
  1623. )
  1624. )}
  1625. />
  1626. <Route
  1627. path="releases/"
  1628. component={errorHandler(
  1629. redirectDeprecatedProjectRoute(
  1630. ({orgId, projectId}) =>
  1631. `/organizations/${orgId}/releases/?project=${projectId}`
  1632. )
  1633. )}
  1634. />
  1635. <Route
  1636. path="releases/:version/"
  1637. component={errorHandler(
  1638. redirectDeprecatedProjectRoute(
  1639. ({orgId, projectId, router}) =>
  1640. `/organizations/${orgId}/releases/${router.params.version}/?project=${projectId}`
  1641. )
  1642. )}
  1643. />
  1644. <Route
  1645. path="releases/:version/new-events/"
  1646. component={errorHandler(
  1647. redirectDeprecatedProjectRoute(
  1648. ({orgId, projectId, router}) =>
  1649. `/organizations/${orgId}/releases/${router.params.version}/new-events/?project=${projectId}`
  1650. )
  1651. )}
  1652. />
  1653. <Route
  1654. path="releases/:version/all-events/"
  1655. component={errorHandler(
  1656. redirectDeprecatedProjectRoute(
  1657. ({orgId, projectId, router}) =>
  1658. `/organizations/${orgId}/releases/${router.params.version}/all-events/?project=${projectId}`
  1659. )
  1660. )}
  1661. />
  1662. <Route
  1663. path="releases/:version/commits/"
  1664. component={errorHandler(
  1665. redirectDeprecatedProjectRoute(
  1666. ({orgId, projectId, router}) =>
  1667. `/organizations/${orgId}/releases/${router.params.version}/commits/?project=${projectId}`
  1668. )
  1669. )}
  1670. />
  1671. </Route>
  1672. );
  1673. const profilingRoutes = (
  1674. <Route
  1675. path="/organizations/:orgId/profiling/"
  1676. component={make(() => import('sentry/views/profiling'))}
  1677. >
  1678. <IndexRoute component={make(() => import('sentry/views/profiling/content'))} />
  1679. <Route
  1680. path="summary/:projectId/"
  1681. component={make(() => import('sentry/views/profiling/profileSummary'))}
  1682. />
  1683. <Route
  1684. path="profile/:projectId/:eventId"
  1685. component={make(() => import('sentry/views/profiling/profileGroupProvider'))}
  1686. >
  1687. <Route
  1688. path="details/"
  1689. component={make(() => import('sentry/views/profiling/profileDetails'))}
  1690. />
  1691. <Route
  1692. path="flamechart/"
  1693. component={make(() => import('sentry/views/profiling/profileFlamechart'))}
  1694. />
  1695. </Route>
  1696. </Route>
  1697. );
  1698. const organizationRoutes = (
  1699. <Route component={errorHandler(OrganizationDetails)}>
  1700. {settingsRoutes}
  1701. {projectsRoutes}
  1702. {dashboardRoutes}
  1703. {userFeedbackRoutes}
  1704. {issueListRoutes}
  1705. {issueDetailsRoutes}
  1706. {alertRoutes}
  1707. {monitorsRoutes}
  1708. {replayRoutes}
  1709. {releasesRoutes}
  1710. {activityRoutes}
  1711. {statsRoutes}
  1712. {discoverRoutes}
  1713. {performanceRoutes}
  1714. {profilingRoutes}
  1715. {adminManageRoutes}
  1716. {legacyOrganizationRootRoutes}
  1717. {legacyGettingStartedRoutes}
  1718. {legacyOrgRedirects}
  1719. </Route>
  1720. );
  1721. const legacyRedirectRoutes = (
  1722. <Route path="/:orgId/">
  1723. <IndexRedirect to="/organizations/:orgId/" />
  1724. <Route path=":projectId/settings/">
  1725. <Redirect from="teams/" to="/settings/:orgId/projects/:projectId/teams/" />
  1726. <Redirect from="alerts/" to="/settings/:orgId/projects/:projectId/alerts/" />
  1727. <Redirect
  1728. from="alerts/rules/"
  1729. to="/settings/:orgId/projects/:projectId/alerts/rules/"
  1730. />
  1731. <Redirect
  1732. from="alerts/rules/new/"
  1733. to="/settings/:orgId/projects/:projectId/alerts/rules/new/"
  1734. />
  1735. <Redirect
  1736. from="alerts/rules/:ruleId/"
  1737. to="/settings/:orgId/projects/:projectId/alerts/rules/:ruleId/"
  1738. />
  1739. <Redirect
  1740. from="environments/"
  1741. to="/settings/:orgId/projects/:projectId/environments/"
  1742. />
  1743. <Redirect
  1744. from="environments/hidden/"
  1745. to="/settings/:orgId/projects/:projectId/environments/hidden/"
  1746. />
  1747. <Redirect from="tags/" to="/settings/projects/:orgId/projects/:projectId/tags/" />
  1748. <Redirect
  1749. from="issue-tracking/"
  1750. to="/settings/:orgId/projects/:projectId/issue-tracking/"
  1751. />
  1752. <Redirect
  1753. from="release-tracking/"
  1754. to="/settings/:orgId/projects/:projectId/release-tracking/"
  1755. />
  1756. <Redirect
  1757. from="ownership/"
  1758. to="/settings/:orgId/projects/:projectId/ownership/"
  1759. />
  1760. <Redirect
  1761. from="data-forwarding/"
  1762. to="/settings/:orgId/projects/:projectId/data-forwarding/"
  1763. />
  1764. <Redirect
  1765. from="debug-symbols/"
  1766. to="/settings/:orgId/projects/:projectId/debug-symbols/"
  1767. />
  1768. <Redirect
  1769. from="processing-issues/"
  1770. to="/settings/:orgId/projects/:projectId/processing-issues/"
  1771. />
  1772. <Redirect from="filters/" to="/settings/:orgId/projects/:projectId/filters/" />
  1773. <Redirect from="hooks/" to="/settings/:orgId/projects/:projectId/hooks/" />
  1774. <Redirect from="keys/" to="/settings/:orgId/projects/:projectId/keys/" />
  1775. <Redirect
  1776. from="keys/:keyId/"
  1777. to="/settings/:orgId/projects/:projectId/keys/:keyId/"
  1778. />
  1779. <Redirect
  1780. from="user-feedback/"
  1781. to="/settings/:orgId/projects/:projectId/user-feedback/"
  1782. />
  1783. <Redirect
  1784. from="security-headers/"
  1785. to="/settings/:orgId/projects/:projectId/security-headers/"
  1786. />
  1787. <Redirect
  1788. from="security-headers/csp/"
  1789. to="/settings/:orgId/projects/:projectId/security-headers/csp/"
  1790. />
  1791. <Redirect
  1792. from="security-headers/expect-ct/"
  1793. to="/settings/:orgId/projects/:projectId/security-headers/expect-ct/"
  1794. />
  1795. <Redirect
  1796. from="security-headers/hpkp/"
  1797. to="/settings/:orgId/projects/:projectId/security-headers/hpkp/"
  1798. />
  1799. <Redirect from="plugins/" to="/settings/:orgId/projects/:projectId/plugins/" />
  1800. <Redirect
  1801. from="plugins/:pluginId/"
  1802. to="/settings/:orgId/projects/:projectId/plugins/:pluginId/"
  1803. />
  1804. <Redirect
  1805. from="integrations/:providerKey/"
  1806. to="/settings/:orgId/projects/:projectId/integrations/:providerKey/"
  1807. />
  1808. <Redirect from="install/" to="/settings/:orgId/projects/:projectId/install/" />
  1809. <Redirect
  1810. from="install/:platform'"
  1811. to="/settings/:orgId/projects/:projectId/install/:platform/"
  1812. />
  1813. </Route>
  1814. <Redirect from=":projectId/group/:groupId/" to="issues/:groupId/" />
  1815. <Redirect
  1816. from=":projectId/issues/:groupId/"
  1817. to="/organizations/:orgId/issues/:groupId/"
  1818. />
  1819. <Redirect
  1820. from=":projectId/issues/:groupId/events/"
  1821. to="/organizations/:orgId/issues/:groupId/events/"
  1822. />
  1823. <Redirect
  1824. from=":projectId/issues/:groupId/events/:eventId/"
  1825. to="/organizations/:orgId/issues/:groupId/events/:eventId/"
  1826. />
  1827. <Redirect
  1828. from=":projectId/issues/:groupId/tags/"
  1829. to="/organizations/:orgId/issues/:groupId/tags/"
  1830. />
  1831. <Redirect
  1832. from=":projectId/issues/:groupId/tags/:tagKey/"
  1833. to="/organizations/:orgId/issues/:groupId/tags/:tagKey/"
  1834. />
  1835. <Redirect
  1836. from=":projectId/issues/:groupId/feedback/"
  1837. to="/organizations/:orgId/issues/:groupId/feedback/"
  1838. />
  1839. <Redirect
  1840. from=":projectId/issues/:groupId/similar/"
  1841. to="/organizations/:orgId/issues/:groupId/similar/"
  1842. />
  1843. <Redirect
  1844. from=":projectId/issues/:groupId/merged/"
  1845. to="/organizations/:orgId/issues/:groupId/merged/"
  1846. />
  1847. <Route
  1848. path=":projectId/events/:eventId/"
  1849. component={errorHandler(ProjectEventRedirect)}
  1850. />
  1851. </Route>
  1852. );
  1853. const appRoutes = (
  1854. <Route>
  1855. {experimentalSpaRoutes}
  1856. <Route path="/" component={errorHandler(App)}>
  1857. {rootRoutes}
  1858. {organizationRoutes}
  1859. {legacyRedirectRoutes}
  1860. {hook('routes')}
  1861. <Route path="*" component={errorHandler(RouteNotFound)} />
  1862. </Route>
  1863. </Route>
  1864. );
  1865. return appRoutes;
  1866. }
  1867. // We load routes both when initlaizing the SDK (for routing integrations) and
  1868. // when the app renders Main. Memoize to avoid rebuilding the route tree.
  1869. export const routes = memoize(buildRoutes);