routes.tsx 59 KB

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