routes.tsx 73 KB

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