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>
  658. );
  659. const orgSettingsRoutes = (
  660. <Route
  661. component={make(
  662. () => import('sentry/views/settings/organization/organizationSettingsLayout')
  663. )}
  664. >
  665. {hook('routes:organization')}
  666. {!usingCustomerDomain && (
  667. <IndexRoute
  668. name={t('General')}
  669. component={make(
  670. () => import('sentry/views/settings/organizationGeneralSettings')
  671. )}
  672. />
  673. )}
  674. {usingCustomerDomain && (
  675. <Route
  676. path="/settings/organization/"
  677. name={t('General')}
  678. component={make(
  679. () => import('sentry/views/settings/organizationGeneralSettings')
  680. )}
  681. />
  682. )}
  683. <Route
  684. path="projects/"
  685. name={t('Projects')}
  686. component={make(() => import('sentry/views/settings/organizationProjects'))}
  687. />
  688. <Route path="api-keys/" name={t('API Key')}>
  689. <IndexRoute
  690. component={make(() => import('sentry/views/settings/organizationApiKeys'))}
  691. />
  692. <Route
  693. path=":apiKey/"
  694. name={t('Details')}
  695. component={make(
  696. () =>
  697. import(
  698. 'sentry/views/settings/organizationApiKeys/organizationApiKeyDetails'
  699. )
  700. )}
  701. />
  702. </Route>
  703. <Route
  704. path="audit-log/"
  705. name={t('Audit Log')}
  706. component={make(() => import('sentry/views/settings/organizationAuditLog'))}
  707. />
  708. <Route
  709. path="auth/"
  710. name={t('Auth Providers')}
  711. component={make(() => import('sentry/views/settings/organizationAuth'))}
  712. />
  713. <Redirect from="members/requests" to="members/" />
  714. <Route path="members/" name={t('Members')}>
  715. <Route
  716. component={make(
  717. () =>
  718. import(
  719. 'sentry/views/settings/organizationMembers/organizationMembersWrapper'
  720. )
  721. )}
  722. >
  723. <IndexRoute
  724. component={make(
  725. () =>
  726. import(
  727. 'sentry/views/settings/organizationMembers/organizationMembersList'
  728. )
  729. )}
  730. />
  731. </Route>
  732. <Route
  733. path=":memberId/"
  734. name={t('Details')}
  735. component={make(
  736. () =>
  737. import('sentry/views/settings/organizationMembers/organizationMemberDetail')
  738. )}
  739. />
  740. </Route>
  741. <Route
  742. path="rate-limits/"
  743. name={t('Rate Limits')}
  744. component={make(() => import('sentry/views/settings/organizationRateLimits'))}
  745. />
  746. <Route
  747. path="relay/"
  748. name={t('Relay')}
  749. component={make(() => import('sentry/views/settings/organizationRelay'))}
  750. />
  751. <Route
  752. path="repos/"
  753. name={t('Repositories')}
  754. component={make(() => import('sentry/views/settings/organizationRepositories'))}
  755. />
  756. <Route
  757. path="settings/"
  758. component={make(
  759. () => import('sentry/views/settings/organizationGeneralSettings')
  760. )}
  761. />
  762. <Route path="security-and-privacy/" name={t('Security & Privacy')}>
  763. <IndexRoute
  764. component={make(
  765. () => import('sentry/views/settings/organizationSecurityAndPrivacy')
  766. )}
  767. />
  768. <Route
  769. path="advanced-data-scrubbing/:scrubbingId/"
  770. component={make(
  771. () => import('sentry/views/settings/organizationSecurityAndPrivacy')
  772. )}
  773. />
  774. </Route>
  775. <Route path="teams/" name={t('Teams')}>
  776. <IndexRoute
  777. component={make(() => import('sentry/views/settings/organizationTeams'))}
  778. />
  779. <Route
  780. path=":teamId/"
  781. name={t('Team')}
  782. component={make(
  783. () => import('sentry/views/settings/organizationTeams/teamDetails')
  784. )}
  785. >
  786. <IndexRedirect to="members/" />
  787. <Route
  788. path="members/"
  789. name={t('Members')}
  790. component={make(
  791. () => import('sentry/views/settings/organizationTeams/teamMembers')
  792. )}
  793. />
  794. <Route
  795. path="notifications/"
  796. name={t('Notifications')}
  797. component={make(
  798. () => import('sentry/views/settings/organizationTeams/teamNotifications')
  799. )}
  800. />
  801. <Route
  802. path="projects/"
  803. name={t('Projects')}
  804. component={make(
  805. () => import('sentry/views/settings/organizationTeams/teamProjects')
  806. )}
  807. />
  808. <Route
  809. path="settings/"
  810. name={t('Settings')}
  811. component={make(
  812. () => import('sentry/views/settings/organizationTeams/teamSettings')
  813. )}
  814. />
  815. </Route>
  816. </Route>
  817. <Redirect from="plugins/" to="integrations/" />
  818. <Route path="plugins/" name={t('Integrations')}>
  819. <Route
  820. path=":integrationSlug/"
  821. name={t('Integration Details')}
  822. component={make(
  823. () =>
  824. import('sentry/views/settings/organizationIntegrations/pluginDetailedView')
  825. )}
  826. />
  827. </Route>
  828. <Redirect from="sentry-apps/" to="integrations/" />
  829. <Route path="sentry-apps/" name={t('Integrations')}>
  830. <Route
  831. path=":integrationSlug"
  832. name={t('Details')}
  833. component={make(
  834. () =>
  835. import(
  836. 'sentry/views/settings/organizationIntegrations/sentryAppDetailedView'
  837. )
  838. )}
  839. />
  840. </Route>
  841. <Redirect from="document-integrations/" to="integrations/" />
  842. <Route path="document-integrations/" name={t('Integrations')}>
  843. <Route
  844. path=":integrationSlug"
  845. name={t('Details')}
  846. component={make(
  847. () =>
  848. import(
  849. 'sentry/views/settings/organizationIntegrations/docIntegrationDetailedView'
  850. )
  851. )}
  852. />
  853. </Route>
  854. <Route path="integrations/" name={t('Integrations')}>
  855. <IndexRoute
  856. component={make(
  857. () =>
  858. import(
  859. 'sentry/views/settings/organizationIntegrations/integrationListDirectory'
  860. )
  861. )}
  862. />
  863. <Route
  864. path=":integrationSlug"
  865. name={t('Integration Details')}
  866. component={make(
  867. () =>
  868. import(
  869. 'sentry/views/settings/organizationIntegrations/integrationDetailedView'
  870. )
  871. )}
  872. />
  873. <Route
  874. path=":providerKey/:integrationId/"
  875. name={t('Configure Integration')}
  876. component={make(
  877. () =>
  878. import(
  879. 'sentry/views/settings/organizationIntegrations/configureIntegration'
  880. )
  881. )}
  882. />
  883. </Route>
  884. <Redirect from="developer-settings/sentry-functions/" to="developer-settings/" />
  885. <Route path="developer-settings/" name={t('Developer Settings')}>
  886. <IndexRoute
  887. component={make(
  888. () => import('sentry/views/settings/organizationDeveloperSettings')
  889. )}
  890. />
  891. <Route
  892. path="new-public/"
  893. name={t('Create Integration')}
  894. component={make(
  895. () =>
  896. import(
  897. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails'
  898. )
  899. )}
  900. />
  901. <Route
  902. path="new-internal/"
  903. name={t('Create Integration')}
  904. component={make(
  905. () =>
  906. import(
  907. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails'
  908. )
  909. )}
  910. />
  911. <Route
  912. path=":appSlug/"
  913. name={t('Edit Integration')}
  914. component={make(
  915. () =>
  916. import(
  917. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDetails'
  918. )
  919. )}
  920. />
  921. <Route
  922. path=":appSlug/dashboard/"
  923. name={t('Integration Dashboard')}
  924. component={make(
  925. () =>
  926. import(
  927. 'sentry/views/settings/organizationDeveloperSettings/sentryApplicationDashboard'
  928. )
  929. )}
  930. />
  931. <Route path="sentry-functions/" name={t('Sentry Functions')}>
  932. <Route
  933. path="new/"
  934. name={t('Create Sentry Function')}
  935. component={make(
  936. () =>
  937. import(
  938. 'sentry/views/settings/organizationDeveloperSettings/sentryFunctionDetails'
  939. )
  940. )}
  941. />
  942. <Route
  943. path=":functionSlug/"
  944. name={t('Edit Sentry Function')}
  945. component={make(
  946. () =>
  947. import(
  948. 'sentry/views/settings/organizationDeveloperSettings/sentryFunctionDetails'
  949. )
  950. )}
  951. />
  952. </Route>
  953. </Route>
  954. </Route>
  955. );
  956. const legacySettingsRedirects = (
  957. <Fragment>
  958. <Redirect from=":projectId/" to="projects/:projectId/" />
  959. <Redirect from=":projectId/alerts/" to="projects/:projectId/alerts/" />
  960. <Redirect from=":projectId/alerts/rules/" to="projects/:projectId/alerts/rules/" />
  961. <Redirect
  962. from=":projectId/alerts/rules/:ruleId/"
  963. to="projects/:projectId/alerts/rules/:ruleId/"
  964. />
  965. </Fragment>
  966. );
  967. const settingsRoutes = (
  968. <Route path="/settings/" name={t('Settings')} component={SettingsWrapper}>
  969. <IndexRoute component={make(() => import('sentry/views/settings/settingsIndex'))} />
  970. {accountSettingsRoutes}
  971. <Fragment>
  972. {usingCustomerDomain && (
  973. <Route
  974. name={t('Organization')}
  975. component={withDomainRequired(NoOp)}
  976. key="orgless-settings-route"
  977. >
  978. {orgSettingsRoutes}
  979. {projectSettingsRoutes}
  980. </Route>
  981. )}
  982. <Route
  983. path=":orgId/"
  984. name={t('Organization')}
  985. component={withDomainRedirect(NoOp)}
  986. key="org-settings"
  987. >
  988. {orgSettingsRoutes}
  989. {projectSettingsRoutes}
  990. {legacySettingsRedirects}
  991. </Route>
  992. </Fragment>
  993. </Route>
  994. );
  995. const projectsChildRoutes = (
  996. <Fragment>
  997. <IndexRoute component={make(() => import('sentry/views/projectsDashboard'))} />
  998. <Route
  999. path="new/"
  1000. component={make(() => import('sentry/views/projectInstall/newProject'))}
  1001. />
  1002. <Route
  1003. path=":projectId/getting-started/"
  1004. component={make(() => import('sentry/views/projectInstall/gettingStarted'))}
  1005. >
  1006. <IndexRoute
  1007. component={make(async () => {
  1008. const {ProjectInstallOverview} = await import(
  1009. 'sentry/views/projectInstall/overview'
  1010. );
  1011. return {
  1012. default: ProjectInstallOverview,
  1013. };
  1014. })}
  1015. />
  1016. <Route
  1017. path=":platform/"
  1018. component={make(
  1019. () => import('sentry/views/projectInstall/platformOrIntegration')
  1020. )}
  1021. />
  1022. </Route>
  1023. <Route
  1024. path=":projectId/"
  1025. component={make(() => import('sentry/views/projectDetail'))}
  1026. />
  1027. <Route
  1028. path=":projectId/events/:eventId/"
  1029. component={errorHandler(ProjectEventRedirect)}
  1030. />
  1031. </Fragment>
  1032. );
  1033. const projectsRoutes = (
  1034. <Fragment>
  1035. {usingCustomerDomain && (
  1036. <Route
  1037. path="/projects/"
  1038. component={withDomainRequired(NoOp)}
  1039. key="orgless-projects-route"
  1040. >
  1041. {projectsChildRoutes}
  1042. </Route>
  1043. )}
  1044. <Route
  1045. path="/organizations/:orgId/projects/"
  1046. component={withDomainRedirect(NoOp)}
  1047. key="org-projects"
  1048. >
  1049. {projectsChildRoutes}
  1050. </Route>
  1051. </Fragment>
  1052. );
  1053. const dashboardWidgetRoutes = (
  1054. <Fragment>
  1055. <Route
  1056. path="widget/:widgetIndex/edit/"
  1057. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1058. />
  1059. <Route
  1060. path="widget/new/"
  1061. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1062. />
  1063. <Route
  1064. path="widget/:widgetId/"
  1065. component={make(() => import('sentry/views/dashboards/view'))}
  1066. />
  1067. </Fragment>
  1068. );
  1069. const dashboardRoutes = (
  1070. <Fragment>
  1071. <Fragment>
  1072. {usingCustomerDomain && (
  1073. <Route
  1074. path="/dashboards/"
  1075. component={withDomainRequired(make(() => import('sentry/views/dashboards')))}
  1076. key="orgless-dashboards-route"
  1077. >
  1078. <IndexRoute
  1079. component={make(() => import('sentry/views/dashboards/manage'))}
  1080. />
  1081. </Route>
  1082. )}
  1083. <Route
  1084. path="/organizations/:orgId/dashboards/"
  1085. component={withDomainRedirect(make(() => import('sentry/views/dashboards')))}
  1086. key="org-dashboards"
  1087. >
  1088. <IndexRoute component={make(() => import('sentry/views/dashboards/manage'))} />
  1089. </Route>
  1090. </Fragment>
  1091. <Fragment>
  1092. {usingCustomerDomain && (
  1093. <Route
  1094. path="/dashboards/new/"
  1095. component={withDomainRequired(
  1096. make(() => import('sentry/views/dashboards/create'))
  1097. )}
  1098. key="orgless-dashboards-new-route"
  1099. >
  1100. <Route
  1101. path="widget/:widgetIndex/edit/"
  1102. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1103. />
  1104. <Route
  1105. path="widget/new/"
  1106. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1107. />
  1108. </Route>
  1109. )}
  1110. <Route
  1111. path="/organizations/:orgId/dashboards/new/"
  1112. component={withDomainRedirect(
  1113. make(() => import('sentry/views/dashboards/create'))
  1114. )}
  1115. key="org-dashboards-new"
  1116. >
  1117. <Route
  1118. path="widget/:widgetIndex/edit/"
  1119. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1120. />
  1121. <Route
  1122. path="widget/new/"
  1123. component={make(() => import('sentry/views/dashboards/widgetBuilder'))}
  1124. />
  1125. </Route>
  1126. </Fragment>
  1127. <Fragment>
  1128. {usingCustomerDomain && (
  1129. <Route
  1130. path="/dashboards/new/:templateId"
  1131. component={withDomainRequired(
  1132. make(() => import('sentry/views/dashboards/create'))
  1133. )}
  1134. key="orgless-dashboards-new-template-route"
  1135. >
  1136. <Route
  1137. path="widget/:widgetId/"
  1138. component={make(() => import('sentry/views/dashboards/create'))}
  1139. />
  1140. </Route>
  1141. )}
  1142. <Route
  1143. path="/organizations/:orgId/dashboards/new/:templateId"
  1144. component={withDomainRedirect(
  1145. make(() => import('sentry/views/dashboards/create'))
  1146. )}
  1147. key="org-dashboards-new-template"
  1148. >
  1149. <Route
  1150. path="widget/:widgetId/"
  1151. component={make(() => import('sentry/views/dashboards/create'))}
  1152. />
  1153. </Route>
  1154. </Fragment>
  1155. <Redirect
  1156. from="/organizations/:orgId/dashboards/:dashboardId/"
  1157. to="/organizations/:orgId/dashboard/:dashboardId/"
  1158. />
  1159. {usingCustomerDomain && (
  1160. <Redirect from="/dashboards/:dashboardId/" to="/dashboard/:dashboardId/" />
  1161. )}
  1162. <Fragment>
  1163. {usingCustomerDomain && (
  1164. <Route
  1165. path="/dashboard/:dashboardId/"
  1166. component={withDomainRequired(
  1167. make(() => import('sentry/views/dashboards/view'))
  1168. )}
  1169. key="orgless-dashboards-dashboard-id-route"
  1170. >
  1171. {dashboardWidgetRoutes}
  1172. </Route>
  1173. )}
  1174. <Route
  1175. path="/organizations/:orgId/dashboard/:dashboardId/"
  1176. component={withDomainRedirect(
  1177. make(() => import('sentry/views/dashboards/view'))
  1178. )}
  1179. key="org-dashboards-dashboard-id"
  1180. >
  1181. {dashboardWidgetRoutes}
  1182. </Route>
  1183. </Fragment>
  1184. </Fragment>
  1185. );
  1186. const alertChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1187. return (
  1188. <Fragment>
  1189. <IndexRoute
  1190. component={make(() => import('sentry/views/alerts/list/incidents'))}
  1191. />
  1192. <Route path="rules/">
  1193. <IndexRoute component={make(() => import('sentry/views/alerts/list/rules'))} />
  1194. <Route
  1195. path="details/:ruleId/"
  1196. component={make(() => import('sentry/views/alerts/rules/metric/details'))}
  1197. />
  1198. <Route
  1199. path=":projectId/"
  1200. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1201. >
  1202. <IndexRedirect
  1203. to={
  1204. forCustomerDomain
  1205. ? '/alerts/rules/'
  1206. : '/organizations/:orgId/alerts/rules/'
  1207. }
  1208. />
  1209. <Route
  1210. path=":ruleId/"
  1211. component={make(() => import('sentry/views/alerts/edit'))}
  1212. />
  1213. </Route>
  1214. <Route path=":projectId/:ruleId/details/">
  1215. <IndexRoute
  1216. component={make(
  1217. () => import('sentry/views/alerts/rules/issue/details/ruleDetails')
  1218. )}
  1219. />
  1220. </Route>
  1221. </Route>
  1222. <Route path="metric-rules/">
  1223. <IndexRedirect
  1224. to={
  1225. forCustomerDomain ? '/alerts/rules/' : '/organizations/:orgId/alerts/rules/'
  1226. }
  1227. />
  1228. <Route
  1229. path=":projectId/"
  1230. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1231. >
  1232. <IndexRedirect
  1233. to={
  1234. forCustomerDomain
  1235. ? '/alerts/rules/'
  1236. : '/organizations/:orgId/alerts/rules/'
  1237. }
  1238. />
  1239. <Route
  1240. path=":ruleId/"
  1241. component={make(() => import('sentry/views/alerts/edit'))}
  1242. />
  1243. </Route>
  1244. </Route>
  1245. <Route
  1246. path="wizard/"
  1247. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1248. >
  1249. <IndexRoute component={make(() => import('sentry/views/alerts/wizard'))} />
  1250. </Route>
  1251. <Route
  1252. path="new/"
  1253. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1254. >
  1255. <IndexRedirect
  1256. to={
  1257. forCustomerDomain
  1258. ? '/alerts/wizard/'
  1259. : '/organizations/:orgId/alerts/wizard/'
  1260. }
  1261. />
  1262. <Route
  1263. path=":alertType/"
  1264. component={make(() => import('sentry/views/alerts/create'))}
  1265. />
  1266. </Route>
  1267. <Route
  1268. path=":alertId/"
  1269. component={make(() => import('sentry/views/alerts/incidentRedirect'))}
  1270. />
  1271. <Route
  1272. path=":projectId/"
  1273. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1274. >
  1275. <Route
  1276. path="new/"
  1277. component={make(() => import('sentry/views/alerts/create'))}
  1278. />
  1279. <Route
  1280. path="wizard/"
  1281. component={make(() => import('sentry/views/alerts/wizard'))}
  1282. />
  1283. </Route>
  1284. </Fragment>
  1285. );
  1286. };
  1287. const alertRoutes = (
  1288. <Fragment>
  1289. {usingCustomerDomain && (
  1290. <Route
  1291. path="/alerts/"
  1292. component={withDomainRequired(make(() => import('sentry/views/alerts')))}
  1293. key="orgless-alerts-route"
  1294. >
  1295. {alertChildRoutes({forCustomerDomain: true})}
  1296. </Route>
  1297. )}
  1298. <Route
  1299. path="/organizations/:orgId/alerts/"
  1300. component={withDomainRedirect(make(() => import('sentry/views/alerts')))}
  1301. key="org-alerts"
  1302. >
  1303. {alertChildRoutes({forCustomerDomain: false})}
  1304. </Route>
  1305. </Fragment>
  1306. );
  1307. const cronsChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1308. return (
  1309. <Fragment>
  1310. <IndexRoute component={make(() => import('sentry/views/monitors/monitors'))} />
  1311. <Route
  1312. path={
  1313. forCustomerDomain ? '/crons/create/' : '/organizations/:orgId/crons/create/'
  1314. }
  1315. component={make(() => import('sentry/views/monitors/create'))}
  1316. key={forCustomerDomain ? 'orgless-monitors-create' : 'org-monitors-create'}
  1317. />
  1318. <Route
  1319. path={
  1320. forCustomerDomain
  1321. ? '/crons/:monitorSlug/'
  1322. : '/organizations/:orgId/crons/:monitorSlug/'
  1323. }
  1324. component={make(() => import('sentry/views/monitors/details'))}
  1325. key={
  1326. forCustomerDomain ? 'orgless-monitors-monitor-id' : 'org-monitors-monitor-id'
  1327. }
  1328. />
  1329. <Route
  1330. path={
  1331. forCustomerDomain
  1332. ? '/crons/:monitorSlug/edit/'
  1333. : '/organizations/:orgId/crons/:monitorSlug/edit/'
  1334. }
  1335. component={make(() => import('sentry/views/monitors/edit'))}
  1336. key={forCustomerDomain ? 'orgless-monitors-edit' : 'org-monitors-edit'}
  1337. />
  1338. </Fragment>
  1339. );
  1340. };
  1341. const cronsRoutes = (
  1342. <Fragment>
  1343. {usingCustomerDomain && (
  1344. <Route
  1345. path="/crons/"
  1346. component={withDomainRequired(make(() => import('sentry/views/monitors')))}
  1347. key="orgless-monitors-route"
  1348. >
  1349. {cronsChildRoutes({forCustomerDomain: true})}
  1350. </Route>
  1351. )}
  1352. <Route
  1353. path="/organizations/:orgId/crons/"
  1354. component={withDomainRedirect(make(() => import('sentry/views/monitors')))}
  1355. key="org-monitors"
  1356. >
  1357. {cronsChildRoutes({forCustomerDomain: false})}
  1358. </Route>
  1359. </Fragment>
  1360. );
  1361. const replayChildRoutes = (
  1362. <Fragment>
  1363. <IndexRoute component={make(() => import('sentry/views/replays/list/container'))} />
  1364. <Route
  1365. path=":replaySlug/"
  1366. component={make(() => import('sentry/views/replays/details'))}
  1367. />
  1368. </Fragment>
  1369. );
  1370. const replayRoutes = (
  1371. <Fragment>
  1372. {usingCustomerDomain && (
  1373. <Route
  1374. path="/replays/"
  1375. component={withDomainRequired(make(() => import('sentry/views/replays')))}
  1376. key="orgless-replays-route"
  1377. >
  1378. {replayChildRoutes}
  1379. </Route>
  1380. )}
  1381. <Route
  1382. path="/organizations/:orgId/replays/"
  1383. component={withDomainRedirect(make(() => import('sentry/views/replays')))}
  1384. key="org-replays"
  1385. >
  1386. {replayChildRoutes}
  1387. </Route>
  1388. </Fragment>
  1389. );
  1390. const releasesChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1391. return (
  1392. <Fragment>
  1393. <IndexRoute component={make(() => import('sentry/views/releases/list'))} />
  1394. <Route
  1395. path=":release/"
  1396. component={make(() => import('sentry/views/releases/detail'))}
  1397. >
  1398. <IndexRoute
  1399. component={make(() => import('sentry/views/releases/detail/overview'))}
  1400. />
  1401. <Route
  1402. path="commits/"
  1403. component={make(
  1404. () => import('sentry/views/releases/detail/commitsAndFiles/commits')
  1405. )}
  1406. />
  1407. <Route
  1408. path="files-changed/"
  1409. component={make(
  1410. () => import('sentry/views/releases/detail/commitsAndFiles/filesChanged')
  1411. )}
  1412. />
  1413. {forCustomerDomain ? null : (
  1414. <Fragment>
  1415. <Redirect
  1416. from="new-events/"
  1417. to="/organizations/:orgId/releases/:release/"
  1418. />
  1419. <Redirect
  1420. from="all-events/"
  1421. to="/organizations/:orgId/releases/:release/"
  1422. />
  1423. </Fragment>
  1424. )}
  1425. </Route>
  1426. </Fragment>
  1427. );
  1428. };
  1429. const releasesRoutes = (
  1430. <Fragment>
  1431. {usingCustomerDomain && (
  1432. <Route
  1433. path="/releases/"
  1434. component={withDomainRequired(NoOp)}
  1435. key="orgless-releases-route"
  1436. >
  1437. {releasesChildRoutes({forCustomerDomain: true})}
  1438. </Route>
  1439. )}
  1440. <Route
  1441. path="/organizations/:orgId/releases/"
  1442. component={withDomainRedirect(NoOp)}
  1443. key="org-releases"
  1444. >
  1445. {releasesChildRoutes({forCustomerDomain: false})}
  1446. </Route>
  1447. </Fragment>
  1448. );
  1449. const activityRoutes = (
  1450. <Fragment>
  1451. {usingCustomerDomain && (
  1452. <Route
  1453. path="/activity/"
  1454. component={withDomainRequired(
  1455. make(() => import('sentry/views/organizationActivity'))
  1456. )}
  1457. key="orgless-activity-route"
  1458. />
  1459. )}
  1460. <Route
  1461. path="/organizations/:orgId/activity/"
  1462. component={withDomainRedirect(
  1463. make(() => import('sentry/views/organizationActivity'))
  1464. )}
  1465. key="org-activity"
  1466. />
  1467. </Fragment>
  1468. );
  1469. const statsChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1470. return (
  1471. <Fragment>
  1472. <IndexRoute component={make(() => import('sentry/views/organizationStats'))} />
  1473. <Route
  1474. path="issues/"
  1475. component={make(() => import('sentry/views/organizationStats/teamInsights'))}
  1476. >
  1477. <IndexRoute
  1478. component={make(
  1479. () => import('sentry/views/organizationStats/teamInsights/issues')
  1480. )}
  1481. />
  1482. </Route>
  1483. <Route
  1484. path="health/"
  1485. component={make(() => import('sentry/views/organizationStats/teamInsights'))}
  1486. >
  1487. <IndexRoute
  1488. component={make(
  1489. () => import('sentry/views/organizationStats/teamInsights/health')
  1490. )}
  1491. />
  1492. </Route>
  1493. {forCustomerDomain ? null : (
  1494. <Redirect from="team/" to="/organizations/:orgId/stats/issues/" />
  1495. )}
  1496. </Fragment>
  1497. );
  1498. };
  1499. const statsRoutes = (
  1500. <Fragment>
  1501. {usingCustomerDomain && (
  1502. <Route
  1503. path="/stats/"
  1504. component={withDomainRequired(NoOp)}
  1505. key="orgless-stats-route"
  1506. >
  1507. {statsChildRoutes({forCustomerDomain: true})}
  1508. </Route>
  1509. )}
  1510. <Route
  1511. path="/organizations/:orgId/stats/"
  1512. component={withDomainRedirect(NoOp)}
  1513. key="org-stats"
  1514. >
  1515. {statsChildRoutes({forCustomerDomain: false})}
  1516. </Route>
  1517. </Fragment>
  1518. );
  1519. // TODO(mark) Long term this /queries route should go away and /discover
  1520. // should be the canonical route for discover2. We have a redirect right now
  1521. // as /discover was for discover 1 and most of the application is linking to
  1522. // /discover/queries and not /discover
  1523. const discoverChildRoutes = (
  1524. <Fragment>
  1525. <IndexRedirect to="queries/" />
  1526. <Route
  1527. path="homepage/"
  1528. component={make(() => import('sentry/views/discover/homepage'))}
  1529. />
  1530. <Route
  1531. path="queries/"
  1532. component={make(() => import('sentry/views/discover/landing'))}
  1533. />
  1534. <Route
  1535. path="results/"
  1536. component={make(() => import('sentry/views/discover/results'))}
  1537. />
  1538. <Route
  1539. path=":eventSlug/"
  1540. component={make(() => import('sentry/views/discover/eventDetails'))}
  1541. />
  1542. </Fragment>
  1543. );
  1544. const discoverRoutes = (
  1545. <Fragment>
  1546. {usingCustomerDomain && (
  1547. <Route
  1548. path="/discover/"
  1549. component={withDomainRequired(make(() => import('sentry/views/discover')))}
  1550. key="orgless-discover-route"
  1551. >
  1552. {discoverChildRoutes}
  1553. </Route>
  1554. )}
  1555. <Route
  1556. path="/organizations/:orgId/discover/"
  1557. component={withDomainRedirect(make(() => import('sentry/views/discover')))}
  1558. key="org-discover-route"
  1559. >
  1560. {discoverChildRoutes}
  1561. </Route>
  1562. </Fragment>
  1563. );
  1564. const performanceChildRoutes = (
  1565. <Fragment>
  1566. <IndexRoute component={make(() => import('sentry/views/performance/content'))} />
  1567. <Route
  1568. path="trends/"
  1569. component={make(() => import('sentry/views/performance/trends'))}
  1570. />
  1571. <Route path="summary/">
  1572. <IndexRoute
  1573. component={make(
  1574. () =>
  1575. import('sentry/views/performance/transactionSummary/transactionOverview')
  1576. )}
  1577. />
  1578. <Route
  1579. path="replays/"
  1580. component={make(
  1581. () => import('sentry/views/performance/transactionSummary/transactionReplays')
  1582. )}
  1583. />
  1584. <Route
  1585. path="vitals/"
  1586. component={make(
  1587. () => import('sentry/views/performance/transactionSummary/transactionVitals')
  1588. )}
  1589. />
  1590. <Route
  1591. path="tags/"
  1592. component={make(
  1593. () => import('sentry/views/performance/transactionSummary/transactionTags')
  1594. )}
  1595. />
  1596. <Route
  1597. path="events/"
  1598. component={make(
  1599. () => import('sentry/views/performance/transactionSummary/transactionEvents')
  1600. )}
  1601. />
  1602. <Route
  1603. path="anomalies/"
  1604. component={make(
  1605. () =>
  1606. import('sentry/views/performance/transactionSummary/transactionAnomalies')
  1607. )}
  1608. />
  1609. <Route
  1610. path="profiles/"
  1611. component={make(
  1612. () =>
  1613. import('sentry/views/performance/transactionSummary/transactionProfiles')
  1614. )}
  1615. />
  1616. <Route path="spans/">
  1617. <IndexRoute
  1618. component={make(
  1619. () => import('sentry/views/performance/transactionSummary/transactionSpans')
  1620. )}
  1621. />
  1622. <Route
  1623. path=":spanSlug/"
  1624. component={make(
  1625. () =>
  1626. import(
  1627. 'sentry/views/performance/transactionSummary/transactionSpans/spanDetails'
  1628. )
  1629. )}
  1630. />
  1631. </Route>
  1632. </Route>
  1633. <Route
  1634. path="vitaldetail/"
  1635. component={make(() => import('sentry/views/performance/vitalDetail'))}
  1636. />
  1637. <Route
  1638. path="trace/:traceSlug/"
  1639. component={make(() => import('sentry/views/performance/traceDetails'))}
  1640. />
  1641. <Route
  1642. path=":eventSlug/"
  1643. component={make(() => import('sentry/views/performance/transactionDetails'))}
  1644. />
  1645. </Fragment>
  1646. );
  1647. const performanceRoutes = (
  1648. <Fragment>
  1649. {usingCustomerDomain && (
  1650. <Route
  1651. path="/performance/"
  1652. component={withDomainRequired(make(() => import('sentry/views/performance')))}
  1653. key="orgless-performance-route"
  1654. >
  1655. {performanceChildRoutes}
  1656. </Route>
  1657. )}
  1658. <Route
  1659. path="/organizations/:orgId/performance/"
  1660. component={withDomainRedirect(make(() => import('sentry/views/performance')))}
  1661. key="org-performance"
  1662. >
  1663. {performanceChildRoutes}
  1664. </Route>
  1665. </Fragment>
  1666. );
  1667. const starfishChildRoutes = (
  1668. <Fragment>
  1669. <IndexRoute
  1670. component={make(() => import('sentry/views/starfish/views/webServiceView'))}
  1671. />
  1672. <Route
  1673. path="failure-detail/:slug/"
  1674. component={make(
  1675. () => import('sentry/views/starfish/views/webServiceView/endpointFailureEvents')
  1676. )}
  1677. />
  1678. <Route
  1679. path="endpoint-overview/"
  1680. component={make(
  1681. () => import('sentry/views/starfish/views/webServiceView/endpointOverview')
  1682. )}
  1683. />
  1684. <Route
  1685. path="database/"
  1686. component={make(() => import('sentry/views/starfish/modules/databaseModule'))}
  1687. />
  1688. <Route
  1689. path="api/"
  1690. component={make(() => import('sentry/views/starfish/modules/APIModule'))}
  1691. />
  1692. <Route
  1693. path="spans/"
  1694. component={make(() => import('sentry/views/starfish/views/spans'))}
  1695. />
  1696. <Route
  1697. path="span/:groupId/"
  1698. component={make(() => import('sentry/views/starfish/views/spanSummary'))}
  1699. />
  1700. </Fragment>
  1701. );
  1702. const starfishRoutes = (
  1703. <Fragment>
  1704. {usingCustomerDomain && (
  1705. <Route
  1706. path="/starfish/"
  1707. component={withDomainRequired(make(() => import('sentry/views/starfish')))}
  1708. key="orgless-starfish-route"
  1709. >
  1710. {starfishChildRoutes}
  1711. </Route>
  1712. )}
  1713. <Route
  1714. path="/organizations/:orgId/starfish/"
  1715. component={withDomainRedirect(make(() => import('sentry/views/starfish/')))}
  1716. key="org-starfish"
  1717. >
  1718. {starfishChildRoutes}
  1719. </Route>
  1720. </Fragment>
  1721. );
  1722. const userFeedbackRoutes = (
  1723. <Fragment>
  1724. {usingCustomerDomain && (
  1725. <Route
  1726. path="/user-feedback/"
  1727. component={withDomainRequired(make(() => import('sentry/views/userFeedback')))}
  1728. key="orgless-user-feedback-route"
  1729. />
  1730. )}
  1731. <Route
  1732. path="/organizations/:orgId/user-feedback/"
  1733. component={withDomainRedirect(make(() => import('sentry/views/userFeedback')))}
  1734. key="org-user-feedback"
  1735. />
  1736. </Fragment>
  1737. );
  1738. const issueListRoutes = (
  1739. <Fragment>
  1740. {usingCustomerDomain && (
  1741. <Route
  1742. path="/issues/(searches/:searchId/)"
  1743. component={withDomainRequired(errorHandler(IssueListContainer))}
  1744. key="orgless-issues-route"
  1745. >
  1746. <IndexRoute component={errorHandler(IssueListOverview)} />
  1747. </Route>
  1748. )}
  1749. <Route
  1750. path="/organizations/:orgId/issues/(searches/:searchId/)"
  1751. component={withDomainRedirect(errorHandler(IssueListContainer))}
  1752. key="org-issues"
  1753. >
  1754. <Redirect from="/organizations/:orgId/" to="/organizations/:orgId/issues/" />
  1755. <IndexRoute component={errorHandler(IssueListOverview)} />
  1756. </Route>
  1757. </Fragment>
  1758. );
  1759. // Once org issues is complete, these routes can be nested under
  1760. // /organizations/:orgId/issues
  1761. const issueTabs = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1762. const hoc = forCustomerDomain ? withDomainRequired : x => x;
  1763. return (
  1764. <Fragment>
  1765. <IndexRoute
  1766. component={hoc(
  1767. make(() => import('sentry/views/issueDetails/groupEventDetails'))
  1768. )}
  1769. />
  1770. <Route
  1771. path={TabPaths[Tab.REPLAYS]}
  1772. component={hoc(make(() => import('sentry/views/issueDetails/groupReplays')))}
  1773. />
  1774. <Route
  1775. path={TabPaths[Tab.ACTIVITY]}
  1776. component={hoc(make(() => import('sentry/views/issueDetails/groupActivity')))}
  1777. />
  1778. <Route
  1779. path={TabPaths[Tab.EVENTS]}
  1780. component={hoc(make(() => import('sentry/views/issueDetails/groupEvents')))}
  1781. />
  1782. <Route
  1783. path={TabPaths[Tab.TAGS]}
  1784. component={hoc(make(() => import('sentry/views/issueDetails/groupTags')))}
  1785. />
  1786. <Route
  1787. path={`${TabPaths[Tab.TAGS]}:tagKey/`}
  1788. component={make(() => import('sentry/views/issueDetails/groupTagValues'))}
  1789. />
  1790. <Route
  1791. path={TabPaths[Tab.USER_FEEDBACK]}
  1792. component={hoc(
  1793. make(() => import('sentry/views/issueDetails/groupUserFeedback'))
  1794. )}
  1795. />
  1796. <Route
  1797. path={TabPaths[Tab.ATTACHMENTS]}
  1798. component={hoc(
  1799. make(() => import('sentry/views/issueDetails/groupEventAttachments'))
  1800. )}
  1801. />
  1802. <Route
  1803. path={TabPaths[Tab.SIMILAR_ISSUES]}
  1804. component={hoc(
  1805. make(() => import('sentry/views/issueDetails/groupSimilarIssues'))
  1806. )}
  1807. />
  1808. <Route
  1809. path={TabPaths[Tab.MERGED]}
  1810. component={hoc(make(() => import('sentry/views/issueDetails/groupMerged')))}
  1811. />
  1812. <Route
  1813. path={TabPaths[Tab.GROUPING]}
  1814. component={hoc(make(() => import('sentry/views/issueDetails/grouping')))}
  1815. />
  1816. </Fragment>
  1817. );
  1818. };
  1819. const issueDetailsChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => (
  1820. <Fragment>
  1821. {issueTabs({forCustomerDomain})}
  1822. <Route path={`${TabPaths[Tab.EVENTS]}:eventId/`}>
  1823. {issueTabs({forCustomerDomain})}
  1824. </Route>
  1825. </Fragment>
  1826. );
  1827. const issueDetailsRoutes = (
  1828. <Fragment>
  1829. <Route
  1830. path="/organizations/:orgId/issues/:groupId/"
  1831. component={withDomainRedirect(make(() => import('sentry/views/issueDetails')))}
  1832. key="org-issues-group-id"
  1833. >
  1834. {issueDetailsChildRoutes({forCustomerDomain: false})}
  1835. </Route>
  1836. {usingCustomerDomain && (
  1837. <Route
  1838. path="/issues/:groupId/"
  1839. component={withDomainRequired(make(() => import('sentry/views/issueDetails')))}
  1840. key="orgless-issues-group-id-route"
  1841. >
  1842. {issueDetailsChildRoutes({forCustomerDomain: true})}
  1843. </Route>
  1844. )}
  1845. </Fragment>
  1846. );
  1847. // These are the "manage" pages. For sentry.io, these are _different_ from
  1848. // the SaaS admin routes in getsentry.
  1849. const adminManageRoutes = (
  1850. <Route
  1851. path="/manage/"
  1852. component={make(() => import('sentry/views/admin/adminLayout'))}
  1853. >
  1854. <IndexRoute component={make(() => import('sentry/views/admin/adminOverview'))} />
  1855. <Route
  1856. path="buffer/"
  1857. component={make(() => import('sentry/views/admin/adminBuffer'))}
  1858. />
  1859. <Route
  1860. path="relays/"
  1861. component={make(() => import('sentry/views/admin/adminRelays'))}
  1862. />
  1863. <Route
  1864. path="organizations/"
  1865. component={make(() => import('sentry/views/admin/adminOrganizations'))}
  1866. />
  1867. <Route
  1868. path="projects/"
  1869. component={make(() => import('sentry/views/admin/adminProjects'))}
  1870. />
  1871. <Route
  1872. path="queue/"
  1873. component={make(() => import('sentry/views/admin/adminQueue'))}
  1874. />
  1875. <Route
  1876. path="quotas/"
  1877. component={make(() => import('sentry/views/admin/adminQuotas'))}
  1878. />
  1879. <Route
  1880. path="settings/"
  1881. component={make(() => import('sentry/views/admin/adminSettings'))}
  1882. />
  1883. <Route path="users/">
  1884. <IndexRoute component={make(() => import('sentry/views/admin/adminUsers'))} />
  1885. <Route
  1886. path=":id"
  1887. component={make(() => import('sentry/views/admin/adminUserEdit'))}
  1888. />
  1889. </Route>
  1890. <Route
  1891. path="status/mail/"
  1892. component={make(() => import('sentry/views/admin/adminMail'))}
  1893. />
  1894. <Route
  1895. path="status/environment/"
  1896. component={make(() => import('sentry/views/admin/adminEnvironment'))}
  1897. />
  1898. <Route
  1899. path="status/packages/"
  1900. component={make(() => import('sentry/views/admin/adminPackages'))}
  1901. />
  1902. <Route
  1903. path="status/warnings/"
  1904. component={make(() => import('sentry/views/admin/adminWarnings'))}
  1905. />
  1906. </Route>
  1907. );
  1908. // XXX(epurkhiser): This should probably go away. It's not totally clear to
  1909. // me why we need the OrganizationRoot root container.
  1910. const legacyOrganizationRootRoutes = (
  1911. <Route component={errorHandler(OrganizationRoot)}>
  1912. <Redirect from="/organizations/:orgId/teams/new/" to="/settings/:orgId/teams/" />
  1913. <Route path="/organizations/:orgId/">
  1914. {hook('routes:organization')}
  1915. <Redirect from="/organizations/:orgId/teams/" to="/settings/:orgId/teams/" />
  1916. <Redirect
  1917. from="/organizations/:orgId/teams/your-teams/"
  1918. to="/settings/:orgId/teams/"
  1919. />
  1920. <Redirect
  1921. from="/organizations/:orgId/teams/all-teams/"
  1922. to="/settings/:orgId/teams/"
  1923. />
  1924. <Redirect
  1925. from="/organizations/:orgId/teams/:teamId/"
  1926. to="/settings/:orgId/teams/:teamId/"
  1927. />
  1928. <Redirect
  1929. from="/organizations/:orgId/teams/:teamId/members/"
  1930. to="/settings/:orgId/teams/:teamId/members/"
  1931. />
  1932. <Redirect
  1933. from="/organizations/:orgId/teams/:teamId/projects/"
  1934. to="/settings/:orgId/teams/:teamId/projects/"
  1935. />
  1936. <Redirect
  1937. from="/organizations/:orgId/teams/:teamId/settings/"
  1938. to="/settings/:orgId/teams/:teamId/settings/"
  1939. />
  1940. <Redirect from="/organizations/:orgId/settings/" to="/settings/:orgId/" />
  1941. <Redirect
  1942. from="/organizations/:orgId/api-keys/"
  1943. to="/settings/:orgId/api-keys/"
  1944. />
  1945. <Redirect
  1946. from="/organizations/:orgId/api-keys/:apiKey/"
  1947. to="/settings/:orgId/api-keys/:apiKey/"
  1948. />
  1949. <Redirect from="/organizations/:orgId/members/" to="/settings/:orgId/members/" />
  1950. <Redirect
  1951. from="/organizations/:orgId/members/:memberId/"
  1952. to="/settings/:orgId/members/:memberId/"
  1953. />
  1954. <Redirect
  1955. from="/organizations/:orgId/rate-limits/"
  1956. to="/settings/:orgId/rate-limits/"
  1957. />
  1958. <Redirect from="/organizations/:orgId/repos/" to="/settings/:orgId/repos/" />
  1959. </Route>
  1960. </Route>
  1961. );
  1962. const gettingStartedChildRoutes = (
  1963. <Fragment>
  1964. <IndexRoute
  1965. component={make(async () => {
  1966. const {ProjectInstallOverview} = await import(
  1967. 'sentry/views/projectInstall/overview'
  1968. );
  1969. return {
  1970. default: ProjectInstallOverview,
  1971. };
  1972. })}
  1973. />
  1974. <Route
  1975. path=":platform/"
  1976. component={make(
  1977. () => import('sentry/views/projectInstall/platformOrIntegration')
  1978. )}
  1979. />
  1980. </Fragment>
  1981. );
  1982. const gettingStartedRoutes = (
  1983. <Fragment>
  1984. {usingCustomerDomain && (
  1985. <Route
  1986. path="/getting-started/:projectId/"
  1987. component={withDomainRequired(
  1988. make(() => import('sentry/views/projectInstall/gettingStarted'))
  1989. )}
  1990. key="orgless-getting-started-route"
  1991. >
  1992. {gettingStartedChildRoutes}
  1993. </Route>
  1994. )}
  1995. <Route
  1996. path="/:orgId/:projectId/getting-started/"
  1997. component={withDomainRedirect(
  1998. make(() => import('sentry/views/projectInstall/gettingStarted'))
  1999. )}
  2000. key="org-getting-started"
  2001. >
  2002. {gettingStartedChildRoutes}
  2003. </Route>
  2004. </Fragment>
  2005. );
  2006. const profilingChildRoutes = (
  2007. <Fragment>
  2008. <IndexRoute component={make(() => import('sentry/views/profiling/content'))} />
  2009. <Route
  2010. path="summary/:projectId/"
  2011. component={make(() => import('sentry/views/profiling/profileSummary'))}
  2012. />
  2013. <Route
  2014. path="profile/:projectId/:eventId/"
  2015. component={make(() => import('sentry/views/profiling/profilesProvider'))}
  2016. >
  2017. <Route
  2018. path="flamechart/"
  2019. component={make(() => import('sentry/views/profiling/profileFlamechart'))}
  2020. />
  2021. </Route>
  2022. </Fragment>
  2023. );
  2024. const profilingRoutes = (
  2025. <Fragment>
  2026. {usingCustomerDomain && (
  2027. <Route
  2028. path="/profiling/"
  2029. component={withDomainRequired(make(() => import('sentry/views/profiling')))}
  2030. key="orgless-profiling-route"
  2031. >
  2032. {profilingChildRoutes}
  2033. </Route>
  2034. )}
  2035. <Route
  2036. path="/organizations/:orgId/profiling/"
  2037. component={withDomainRedirect(make(() => import('sentry/views/profiling')))}
  2038. key="org-profiling"
  2039. >
  2040. {profilingChildRoutes}
  2041. </Route>
  2042. </Fragment>
  2043. );
  2044. // Support for deprecated URLs (pre-Sentry 10). We just redirect users to new
  2045. // canonical URLs.
  2046. //
  2047. // XXX(epurkhiser): Can these be moved over to the legacyOrgRedirects routes,
  2048. // or do these need to be nested into the OrganizationDetails tree?
  2049. const legacyOrgRedirects = (
  2050. <Route path="/:orgId/:projectId/">
  2051. <IndexRoute
  2052. component={errorHandler(
  2053. redirectDeprecatedProjectRoute(
  2054. ({orgId, projectId}) => `/organizations/${orgId}/issues/?project=${projectId}`
  2055. )
  2056. )}
  2057. />
  2058. <Route
  2059. path="issues/"
  2060. component={errorHandler(
  2061. redirectDeprecatedProjectRoute(
  2062. ({orgId, projectId}) => `/organizations/${orgId}/issues/?project=${projectId}`
  2063. )
  2064. )}
  2065. />
  2066. <Route
  2067. path="dashboard/"
  2068. component={errorHandler(
  2069. redirectDeprecatedProjectRoute(
  2070. ({orgId, projectId}) =>
  2071. `/organizations/${orgId}/dashboards/?project=${projectId}`
  2072. )
  2073. )}
  2074. />
  2075. <Route
  2076. path="user-feedback/"
  2077. component={errorHandler(
  2078. redirectDeprecatedProjectRoute(
  2079. ({orgId, projectId}) =>
  2080. `/organizations/${orgId}/user-feedback/?project=${projectId}`
  2081. )
  2082. )}
  2083. />
  2084. <Route
  2085. path="releases/"
  2086. component={errorHandler(
  2087. redirectDeprecatedProjectRoute(
  2088. ({orgId, projectId}) =>
  2089. `/organizations/${orgId}/releases/?project=${projectId}`
  2090. )
  2091. )}
  2092. />
  2093. <Route
  2094. path="releases/:version/"
  2095. component={errorHandler(
  2096. redirectDeprecatedProjectRoute(
  2097. ({orgId, projectId, router}) =>
  2098. `/organizations/${orgId}/releases/${router.params.version}/?project=${projectId}`
  2099. )
  2100. )}
  2101. />
  2102. <Route
  2103. path="releases/:version/new-events/"
  2104. component={errorHandler(
  2105. redirectDeprecatedProjectRoute(
  2106. ({orgId, projectId, router}) =>
  2107. `/organizations/${orgId}/releases/${router.params.version}/new-events/?project=${projectId}`
  2108. )
  2109. )}
  2110. />
  2111. <Route
  2112. path="releases/:version/all-events/"
  2113. component={errorHandler(
  2114. redirectDeprecatedProjectRoute(
  2115. ({orgId, projectId, router}) =>
  2116. `/organizations/${orgId}/releases/${router.params.version}/all-events/?project=${projectId}`
  2117. )
  2118. )}
  2119. />
  2120. <Route
  2121. path="releases/:version/commits/"
  2122. component={errorHandler(
  2123. redirectDeprecatedProjectRoute(
  2124. ({orgId, projectId, router}) =>
  2125. `/organizations/${orgId}/releases/${router.params.version}/commits/?project=${projectId}`
  2126. )
  2127. )}
  2128. />
  2129. </Route>
  2130. );
  2131. const organizationRoutes = (
  2132. <Route component={errorHandler(OrganizationDetails)}>
  2133. {settingsRoutes}
  2134. {projectsRoutes}
  2135. {dashboardRoutes}
  2136. {userFeedbackRoutes}
  2137. {issueListRoutes}
  2138. {issueDetailsRoutes}
  2139. {alertRoutes}
  2140. {cronsRoutes}
  2141. {replayRoutes}
  2142. {releasesRoutes}
  2143. {activityRoutes}
  2144. {statsRoutes}
  2145. {discoverRoutes}
  2146. {performanceRoutes}
  2147. {starfishRoutes}
  2148. {profilingRoutes}
  2149. {adminManageRoutes}
  2150. {gettingStartedRoutes}
  2151. {legacyOrganizationRootRoutes}
  2152. {legacyOrgRedirects}
  2153. </Route>
  2154. );
  2155. const legacyRedirectRoutes = (
  2156. <Route path="/:orgId/">
  2157. <IndexRedirect to="/organizations/:orgId/" />
  2158. <Route path=":projectId/settings/">
  2159. <Redirect from="teams/" to="/settings/:orgId/projects/:projectId/teams/" />
  2160. <Redirect from="alerts/" to="/settings/:orgId/projects/:projectId/alerts/" />
  2161. <Redirect
  2162. from="alerts/rules/"
  2163. to="/settings/:orgId/projects/:projectId/alerts/rules/"
  2164. />
  2165. <Redirect
  2166. from="alerts/rules/new/"
  2167. to="/settings/:orgId/projects/:projectId/alerts/rules/new/"
  2168. />
  2169. <Redirect
  2170. from="alerts/rules/:ruleId/"
  2171. to="/settings/:orgId/projects/:projectId/alerts/rules/:ruleId/"
  2172. />
  2173. <Redirect
  2174. from="environments/"
  2175. to="/settings/:orgId/projects/:projectId/environments/"
  2176. />
  2177. <Redirect
  2178. from="environments/hidden/"
  2179. to="/settings/:orgId/projects/:projectId/environments/hidden/"
  2180. />
  2181. <Redirect from="tags/" to="/settings/projects/:orgId/projects/:projectId/tags/" />
  2182. <Redirect
  2183. from="issue-tracking/"
  2184. to="/settings/:orgId/projects/:projectId/issue-tracking/"
  2185. />
  2186. <Redirect
  2187. from="release-tracking/"
  2188. to="/settings/:orgId/projects/:projectId/release-tracking/"
  2189. />
  2190. <Redirect
  2191. from="ownership/"
  2192. to="/settings/:orgId/projects/:projectId/ownership/"
  2193. />
  2194. <Redirect
  2195. from="data-forwarding/"
  2196. to="/settings/:orgId/projects/:projectId/data-forwarding/"
  2197. />
  2198. <Redirect
  2199. from="debug-symbols/"
  2200. to="/settings/:orgId/projects/:projectId/debug-symbols/"
  2201. />
  2202. <Redirect
  2203. from="processing-issues/"
  2204. to="/settings/:orgId/projects/:projectId/processing-issues/"
  2205. />
  2206. <Redirect from="filters/" to="/settings/:orgId/projects/:projectId/filters/" />
  2207. <Redirect from="hooks/" to="/settings/:orgId/projects/:projectId/hooks/" />
  2208. <Redirect from="keys/" to="/settings/:orgId/projects/:projectId/keys/" />
  2209. <Redirect
  2210. from="keys/:keyId/"
  2211. to="/settings/:orgId/projects/:projectId/keys/:keyId/"
  2212. />
  2213. <Redirect
  2214. from="user-feedback/"
  2215. to="/settings/:orgId/projects/:projectId/user-feedback/"
  2216. />
  2217. <Redirect
  2218. from="security-headers/"
  2219. to="/settings/:orgId/projects/:projectId/security-headers/"
  2220. />
  2221. <Redirect
  2222. from="security-headers/csp/"
  2223. to="/settings/:orgId/projects/:projectId/security-headers/csp/"
  2224. />
  2225. <Redirect
  2226. from="security-headers/expect-ct/"
  2227. to="/settings/:orgId/projects/:projectId/security-headers/expect-ct/"
  2228. />
  2229. <Redirect
  2230. from="security-headers/hpkp/"
  2231. to="/settings/:orgId/projects/:projectId/security-headers/hpkp/"
  2232. />
  2233. <Redirect from="plugins/" to="/settings/:orgId/projects/:projectId/plugins/" />
  2234. <Redirect
  2235. from="plugins/:pluginId/"
  2236. to="/settings/:orgId/projects/:projectId/plugins/:pluginId/"
  2237. />
  2238. <Redirect
  2239. from="integrations/:providerKey/"
  2240. to="/settings/:orgId/projects/:projectId/integrations/:providerKey/"
  2241. />
  2242. <Redirect
  2243. from="/settings/projects/:projectId/install/"
  2244. to="/getting-started/:projectId/"
  2245. />
  2246. <Redirect
  2247. from="/settings/projects/:projectId/install/:platform/"
  2248. to="/getting-started/:projectId/:platform/"
  2249. />
  2250. </Route>
  2251. <Redirect from=":projectId/group/:groupId/" to="issues/:groupId/" />
  2252. <Redirect
  2253. from=":projectId/issues/:groupId/"
  2254. to="/organizations/:orgId/issues/:groupId/"
  2255. />
  2256. <Redirect
  2257. from=":projectId/issues/:groupId/events/"
  2258. to="/organizations/:orgId/issues/:groupId/events/"
  2259. />
  2260. <Redirect
  2261. from=":projectId/issues/:groupId/events/:eventId/"
  2262. to="/organizations/:orgId/issues/:groupId/events/:eventId/"
  2263. />
  2264. <Redirect
  2265. from=":projectId/issues/:groupId/tags/"
  2266. to="/organizations/:orgId/issues/:groupId/tags/"
  2267. />
  2268. <Redirect
  2269. from=":projectId/issues/:groupId/tags/:tagKey/"
  2270. to="/organizations/:orgId/issues/:groupId/tags/:tagKey/"
  2271. />
  2272. <Redirect
  2273. from=":projectId/issues/:groupId/feedback/"
  2274. to="/organizations/:orgId/issues/:groupId/feedback/"
  2275. />
  2276. <Redirect
  2277. from=":projectId/issues/:groupId/similar/"
  2278. to="/organizations/:orgId/issues/:groupId/similar/"
  2279. />
  2280. <Redirect
  2281. from=":projectId/issues/:groupId/merged/"
  2282. to="/organizations/:orgId/issues/:groupId/merged/"
  2283. />
  2284. <Route
  2285. path=":projectId/events/:eventId/"
  2286. component={errorHandler(ProjectEventRedirect)}
  2287. />
  2288. </Route>
  2289. );
  2290. const appRoutes = (
  2291. <Route>
  2292. {experimentalSpaRoutes}
  2293. <Route path="/" component={errorHandler(App)}>
  2294. {rootRoutes}
  2295. {organizationRoutes}
  2296. {legacyRedirectRoutes}
  2297. <Route path="*" component={errorHandler(RouteNotFound)} />
  2298. </Route>
  2299. </Route>
  2300. );
  2301. return appRoutes;
  2302. }
  2303. // We load routes both when initializing the SDK (for routing integrations) and
  2304. // when the app renders Main. Memoize to avoid rebuilding the route tree.
  2305. export const routes = memoize(buildRoutes);
  2306. // Exported for use in tests.
  2307. export {buildRoutes};
  2308. function NoOp(props: {children: React.ReactNode}) {
  2309. return <Fragment>{props.children}</Fragment>;
  2310. }