routes.tsx 73 KB

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