routes.tsx 74 KB

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