routes.tsx 60 KB

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