routes.tsx 77 KB

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