routes.tsx 73 KB

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