routes.tsx 71 KB

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