routes.tsx 72 KB

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