routes.tsx 76 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433
  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 component={make(() => import('sentry/views/alerts/list/rules'))} />
  1183. <Route
  1184. path="details/:ruleId/"
  1185. component={make(() => import('sentry/views/alerts/rules/metric/details'))}
  1186. />
  1187. <Route
  1188. path=":projectId/"
  1189. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1190. >
  1191. <IndexRedirect
  1192. to={
  1193. forCustomerDomain
  1194. ? '/alerts/rules/'
  1195. : '/organizations/:orgId/alerts/rules/'
  1196. }
  1197. />
  1198. <Route
  1199. path=":ruleId/"
  1200. component={make(() => import('sentry/views/alerts/edit'))}
  1201. />
  1202. </Route>
  1203. <Route path=":projectId/:ruleId/details/">
  1204. <IndexRoute
  1205. component={make(
  1206. () => import('sentry/views/alerts/rules/issue/details/ruleDetails')
  1207. )}
  1208. />
  1209. </Route>
  1210. </Route>
  1211. <Route path="metric-rules/">
  1212. <IndexRedirect
  1213. to={
  1214. forCustomerDomain ? '/alerts/rules/' : '/organizations/:orgId/alerts/rules/'
  1215. }
  1216. />
  1217. <Route
  1218. path=":projectId/"
  1219. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1220. >
  1221. <IndexRedirect
  1222. to={
  1223. forCustomerDomain
  1224. ? '/alerts/rules/'
  1225. : '/organizations/:orgId/alerts/rules/'
  1226. }
  1227. />
  1228. <Route
  1229. path=":ruleId/"
  1230. component={make(() => import('sentry/views/alerts/edit'))}
  1231. />
  1232. </Route>
  1233. </Route>
  1234. <Route
  1235. path="wizard/"
  1236. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1237. >
  1238. <IndexRoute component={make(() => import('sentry/views/alerts/wizard'))} />
  1239. </Route>
  1240. <Route
  1241. path="new/"
  1242. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1243. >
  1244. <IndexRedirect
  1245. to={
  1246. forCustomerDomain
  1247. ? '/alerts/wizard/'
  1248. : '/organizations/:orgId/alerts/wizard/'
  1249. }
  1250. />
  1251. <Route
  1252. path=":alertType/"
  1253. component={make(() => import('sentry/views/alerts/create'))}
  1254. />
  1255. </Route>
  1256. <Route
  1257. path=":alertId/"
  1258. component={make(() => import('sentry/views/alerts/incidentRedirect'))}
  1259. />
  1260. <Route
  1261. path=":projectId/"
  1262. component={make(() => import('sentry/views/alerts/builder/projectProvider'))}
  1263. >
  1264. <Route
  1265. path="new/"
  1266. component={make(() => import('sentry/views/alerts/create'))}
  1267. />
  1268. <Route
  1269. path="wizard/"
  1270. component={make(() => import('sentry/views/alerts/wizard'))}
  1271. />
  1272. </Route>
  1273. </Fragment>
  1274. );
  1275. };
  1276. const alertRoutes = (
  1277. <Fragment>
  1278. {usingCustomerDomain && (
  1279. <Route
  1280. path="/alerts/"
  1281. component={withDomainRequired(make(() => import('sentry/views/alerts')))}
  1282. key="orgless-alerts-route"
  1283. >
  1284. {alertChildRoutes({forCustomerDomain: true})}
  1285. </Route>
  1286. )}
  1287. <Route
  1288. path="/organizations/:orgId/alerts/"
  1289. component={withDomainRedirect(make(() => import('sentry/views/alerts')))}
  1290. key="org-alerts"
  1291. >
  1292. {alertChildRoutes({forCustomerDomain: false})}
  1293. </Route>
  1294. </Fragment>
  1295. );
  1296. const cronsChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1297. return (
  1298. <Fragment>
  1299. <IndexRoute component={make(() => import('sentry/views/monitors/overview'))} />
  1300. <Route
  1301. path={
  1302. forCustomerDomain ? '/crons/create/' : '/organizations/:orgId/crons/create/'
  1303. }
  1304. component={make(() => import('sentry/views/monitors/create'))}
  1305. key={forCustomerDomain ? 'orgless-monitors-create' : 'org-monitors-create'}
  1306. />
  1307. <Route
  1308. path={
  1309. forCustomerDomain
  1310. ? '/crons/:monitorSlug/'
  1311. : '/organizations/:orgId/crons/:monitorSlug/'
  1312. }
  1313. component={make(() => import('sentry/views/monitors/details'))}
  1314. key={
  1315. forCustomerDomain ? 'orgless-monitors-monitor-id' : 'org-monitors-monitor-id'
  1316. }
  1317. />
  1318. <Route
  1319. path={
  1320. forCustomerDomain
  1321. ? '/crons/:monitorSlug/edit/'
  1322. : '/organizations/:orgId/crons/:monitorSlug/edit/'
  1323. }
  1324. component={make(() => import('sentry/views/monitors/edit'))}
  1325. key={forCustomerDomain ? 'orgless-monitors-edit' : 'org-monitors-edit'}
  1326. />
  1327. </Fragment>
  1328. );
  1329. };
  1330. const cronsRoutes = (
  1331. <Fragment>
  1332. {usingCustomerDomain && (
  1333. <Route
  1334. path="/crons/"
  1335. component={withDomainRequired(make(() => import('sentry/views/monitors')))}
  1336. key="orgless-monitors-route"
  1337. >
  1338. {cronsChildRoutes({forCustomerDomain: true})}
  1339. </Route>
  1340. )}
  1341. <Route
  1342. path="/organizations/:orgId/crons/"
  1343. component={withDomainRedirect(make(() => import('sentry/views/monitors')))}
  1344. key="org-monitors"
  1345. >
  1346. {cronsChildRoutes({forCustomerDomain: false})}
  1347. </Route>
  1348. </Fragment>
  1349. );
  1350. const replayChildRoutes = (
  1351. <Fragment>
  1352. <IndexRoute component={make(() => import('sentry/views/replays/list'))} />
  1353. <Route
  1354. path="dead-clicks/"
  1355. component={make(() => import('sentry/views/replays/deadRageClick/deadClickList'))}
  1356. />
  1357. <Route
  1358. path="rage-clicks/"
  1359. component={make(() => import('sentry/views/replays/deadRageClick/rageClickList'))}
  1360. />
  1361. <Route
  1362. path=":replaySlug/"
  1363. component={make(() => import('sentry/views/replays/details'))}
  1364. />
  1365. </Fragment>
  1366. );
  1367. const replayRoutes = (
  1368. <Fragment>
  1369. {usingCustomerDomain && (
  1370. <Route
  1371. path="/replays/"
  1372. component={withDomainRequired(make(() => import('sentry/views/replays/index')))}
  1373. key="orgless-replays-route"
  1374. >
  1375. {replayChildRoutes}
  1376. </Route>
  1377. )}
  1378. <Route
  1379. path="/organizations/:orgId/replays/"
  1380. component={withDomainRedirect(make(() => import('sentry/views/replays/index')))}
  1381. key="org-replays"
  1382. >
  1383. {replayChildRoutes}
  1384. </Route>
  1385. </Fragment>
  1386. );
  1387. const releasesChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1388. return (
  1389. <Fragment>
  1390. <IndexRoute component={make(() => import('sentry/views/releases/list'))} />
  1391. <Route
  1392. path=":release/"
  1393. component={make(() => import('sentry/views/releases/detail'))}
  1394. >
  1395. <IndexRoute
  1396. component={make(() => import('sentry/views/releases/detail/overview'))}
  1397. />
  1398. <Route
  1399. path="commits/"
  1400. component={make(
  1401. () => import('sentry/views/releases/detail/commitsAndFiles/commits')
  1402. )}
  1403. />
  1404. <Route
  1405. path="files-changed/"
  1406. component={make(
  1407. () => import('sentry/views/releases/detail/commitsAndFiles/filesChanged')
  1408. )}
  1409. />
  1410. {forCustomerDomain ? null : (
  1411. <Fragment>
  1412. <Redirect
  1413. from="new-events/"
  1414. to="/organizations/:orgId/releases/:release/"
  1415. />
  1416. <Redirect
  1417. from="all-events/"
  1418. to="/organizations/:orgId/releases/:release/"
  1419. />
  1420. </Fragment>
  1421. )}
  1422. </Route>
  1423. </Fragment>
  1424. );
  1425. };
  1426. const releasesRoutes = (
  1427. <Fragment>
  1428. {usingCustomerDomain && (
  1429. <Route
  1430. path="/releases/"
  1431. component={withDomainRequired(NoOp)}
  1432. key="orgless-releases-route"
  1433. >
  1434. {releasesChildRoutes({forCustomerDomain: true})}
  1435. </Route>
  1436. )}
  1437. <Route
  1438. path="/organizations/:orgId/releases/"
  1439. component={withDomainRedirect(NoOp)}
  1440. key="org-releases"
  1441. >
  1442. {releasesChildRoutes({forCustomerDomain: false})}
  1443. </Route>
  1444. </Fragment>
  1445. );
  1446. const activityRoutes = (
  1447. <Fragment>
  1448. {usingCustomerDomain && (
  1449. <Route
  1450. path="/activity/"
  1451. component={withDomainRequired(
  1452. make(() => import('sentry/views/organizationActivity'))
  1453. )}
  1454. key="orgless-activity-route"
  1455. />
  1456. )}
  1457. <Route
  1458. path="/organizations/:orgId/activity/"
  1459. component={withDomainRedirect(
  1460. make(() => import('sentry/views/organizationActivity'))
  1461. )}
  1462. key="org-activity"
  1463. />
  1464. </Fragment>
  1465. );
  1466. const statsChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1467. return (
  1468. <Fragment>
  1469. <IndexRoute component={make(() => import('sentry/views/organizationStats'))} />
  1470. <Route
  1471. path="issues/"
  1472. component={make(() => import('sentry/views/organizationStats/teamInsights'))}
  1473. >
  1474. <IndexRoute
  1475. component={make(
  1476. () => import('sentry/views/organizationStats/teamInsights/issues')
  1477. )}
  1478. />
  1479. </Route>
  1480. <Route
  1481. path="health/"
  1482. component={make(() => import('sentry/views/organizationStats/teamInsights'))}
  1483. >
  1484. <IndexRoute
  1485. component={make(
  1486. () => import('sentry/views/organizationStats/teamInsights/health')
  1487. )}
  1488. />
  1489. </Route>
  1490. {forCustomerDomain ? null : (
  1491. <Redirect from="team/" to="/organizations/:orgId/stats/issues/" />
  1492. )}
  1493. </Fragment>
  1494. );
  1495. };
  1496. const statsRoutes = (
  1497. <Fragment>
  1498. {usingCustomerDomain && (
  1499. <Route
  1500. path="/stats/"
  1501. component={withDomainRequired(NoOp)}
  1502. key="orgless-stats-route"
  1503. >
  1504. {statsChildRoutes({forCustomerDomain: true})}
  1505. </Route>
  1506. )}
  1507. <Route
  1508. path="/organizations/:orgId/stats/"
  1509. component={withDomainRedirect(NoOp)}
  1510. key="org-stats"
  1511. >
  1512. {statsChildRoutes({forCustomerDomain: false})}
  1513. </Route>
  1514. </Fragment>
  1515. );
  1516. // TODO(mark) Long term this /queries route should go away and /discover
  1517. // should be the canonical route for discover2. We have a redirect right now
  1518. // as /discover was for discover 1 and most of the application is linking to
  1519. // /discover/queries and not /discover
  1520. const discoverChildRoutes = (
  1521. <Fragment>
  1522. <IndexRedirect to="queries/" />
  1523. <Route
  1524. path="homepage/"
  1525. component={make(() => import('sentry/views/discover/homepage'))}
  1526. />
  1527. <Route
  1528. path="queries/"
  1529. component={make(() => import('sentry/views/discover/landing'))}
  1530. />
  1531. <Route
  1532. path="results/"
  1533. component={make(() => import('sentry/views/discover/results'))}
  1534. />
  1535. <Route
  1536. path=":eventSlug/"
  1537. component={make(() => import('sentry/views/discover/eventDetails'))}
  1538. />
  1539. </Fragment>
  1540. );
  1541. const discoverRoutes = (
  1542. <Fragment>
  1543. {usingCustomerDomain && (
  1544. <Route
  1545. path="/discover/"
  1546. component={withDomainRequired(make(() => import('sentry/views/discover')))}
  1547. key="orgless-discover-route"
  1548. >
  1549. {discoverChildRoutes}
  1550. </Route>
  1551. )}
  1552. <Route
  1553. path="/organizations/:orgId/discover/"
  1554. component={withDomainRedirect(make(() => import('sentry/views/discover')))}
  1555. key="org-discover-route"
  1556. >
  1557. {discoverChildRoutes}
  1558. </Route>
  1559. </Fragment>
  1560. );
  1561. const performanceChildRoutes = (
  1562. <Fragment>
  1563. <IndexRoute component={make(() => import('sentry/views/performance/content'))} />
  1564. <Route
  1565. path="trends/"
  1566. component={make(() => import('sentry/views/performance/trends'))}
  1567. />
  1568. <Route path="database/">
  1569. <IndexRoute
  1570. component={make(
  1571. () => import('sentry/views/performance/database/databaseLandingPage')
  1572. )}
  1573. />
  1574. <Route
  1575. path="spans/span/:groupId/"
  1576. component={make(
  1577. () => import('sentry/views/performance/database/databaseSpanSummaryPage')
  1578. )}
  1579. />
  1580. </Route>
  1581. <Route path="browser/">
  1582. <Route path="interactions/">
  1583. <IndexRoute
  1584. component={make(
  1585. () => import('sentry/views/performance/browser/interactionsLandingPage')
  1586. )}
  1587. />
  1588. <Route
  1589. path="summary/"
  1590. component={make(
  1591. () => import('sentry/views/performance/browser/interactionSummary/index')
  1592. )}
  1593. />
  1594. </Route>
  1595. <Route
  1596. path="pageloads/"
  1597. component={make(
  1598. () =>
  1599. import('sentry/views/performance/browser/webVitals/webVitalsLandingPage')
  1600. )}
  1601. />
  1602. </Route>
  1603. <Route path="summary/">
  1604. <IndexRoute
  1605. component={make(
  1606. () =>
  1607. import('sentry/views/performance/transactionSummary/transactionOverview')
  1608. )}
  1609. />
  1610. <Route
  1611. path="replays/"
  1612. component={make(
  1613. () => import('sentry/views/performance/transactionSummary/transactionReplays')
  1614. )}
  1615. />
  1616. <Route
  1617. path="vitals/"
  1618. component={make(
  1619. () => import('sentry/views/performance/transactionSummary/transactionVitals')
  1620. )}
  1621. />
  1622. <Route
  1623. path="tags/"
  1624. component={make(
  1625. () => import('sentry/views/performance/transactionSummary/transactionTags')
  1626. )}
  1627. />
  1628. <Route
  1629. path="events/"
  1630. component={make(
  1631. () => import('sentry/views/performance/transactionSummary/transactionEvents')
  1632. )}
  1633. />
  1634. <Route
  1635. path="anomalies/"
  1636. component={make(
  1637. () =>
  1638. import('sentry/views/performance/transactionSummary/transactionAnomalies')
  1639. )}
  1640. />
  1641. <Route
  1642. path="profiles/"
  1643. component={make(
  1644. () =>
  1645. import('sentry/views/performance/transactionSummary/transactionProfiles')
  1646. )}
  1647. />
  1648. <Route path="spans/">
  1649. <IndexRoute
  1650. component={make(
  1651. () => import('sentry/views/performance/transactionSummary/transactionSpans')
  1652. )}
  1653. />
  1654. <Route
  1655. path=":spanSlug/"
  1656. component={make(
  1657. () =>
  1658. import(
  1659. 'sentry/views/performance/transactionSummary/transactionSpans/spanDetails'
  1660. )
  1661. )}
  1662. />
  1663. </Route>
  1664. </Route>
  1665. <Route
  1666. path="vitaldetail/"
  1667. component={make(() => import('sentry/views/performance/vitalDetail'))}
  1668. />
  1669. <Route
  1670. path="trace/:traceSlug/"
  1671. component={make(() => import('sentry/views/performance/traceDetails'))}
  1672. />
  1673. <Route
  1674. path=":eventSlug/"
  1675. component={make(() => import('sentry/views/performance/transactionDetails'))}
  1676. />
  1677. </Fragment>
  1678. );
  1679. const performanceRoutes = (
  1680. <Fragment>
  1681. {usingCustomerDomain && (
  1682. <Route
  1683. path="/performance/"
  1684. component={withDomainRequired(make(() => import('sentry/views/performance')))}
  1685. key="orgless-performance-route"
  1686. >
  1687. {performanceChildRoutes}
  1688. </Route>
  1689. )}
  1690. <Route
  1691. path="/organizations/:orgId/performance/"
  1692. component={withDomainRedirect(make(() => import('sentry/views/performance')))}
  1693. key="org-performance"
  1694. >
  1695. {performanceChildRoutes}
  1696. </Route>
  1697. </Fragment>
  1698. );
  1699. const starfishChildRoutes = (
  1700. <Fragment>
  1701. <IndexRoute
  1702. component={make(() => import('sentry/views/starfish/views/webServiceView'))}
  1703. />
  1704. <Route path="endpoint-overview/">
  1705. <IndexRoute
  1706. component={make(
  1707. () => import('sentry/views/starfish/views/webServiceView/endpointOverview')
  1708. )}
  1709. />
  1710. <Route
  1711. path="span/:groupId/"
  1712. component={make(() => import('sentry/views/starfish/views/spanSummaryPage'))}
  1713. />
  1714. </Route>
  1715. <Redirect from="database/" to="/performance/database" />
  1716. <Route path="initialization/">
  1717. <IndexRoute
  1718. component={make(
  1719. () => import('sentry/views/starfish/modules/mobile/initialization')
  1720. )}
  1721. />
  1722. </Route>
  1723. <Route path="pageload/">
  1724. <IndexRoute
  1725. component={make(() => import('sentry/views/starfish/modules/mobile/pageload'))}
  1726. />
  1727. </Route>
  1728. <Route path="responsiveness/">
  1729. <IndexRoute
  1730. component={make(
  1731. () => import('sentry/views/starfish/modules/mobile/responsiveness')
  1732. )}
  1733. />
  1734. </Route>
  1735. <Route path="spans/">
  1736. <IndexRoute component={make(() => import('sentry/views/starfish/views/spans'))} />
  1737. <Route
  1738. path="span/:groupId/"
  1739. component={make(() => import('sentry/views/starfish/views/spanSummaryPage'))}
  1740. />
  1741. </Route>
  1742. </Fragment>
  1743. );
  1744. const starfishRoutes = (
  1745. <Fragment>
  1746. {usingCustomerDomain && (
  1747. <Route
  1748. path="/starfish/"
  1749. component={withDomainRequired(make(() => import('sentry/views/starfish')))}
  1750. key="orgless-starfish-route"
  1751. >
  1752. {starfishChildRoutes}
  1753. </Route>
  1754. )}
  1755. <Route
  1756. path="/organizations/:orgId/starfish/"
  1757. component={withDomainRedirect(make(() => import('sentry/views/starfish/')))}
  1758. key="org-starfish"
  1759. >
  1760. {starfishChildRoutes}
  1761. </Route>
  1762. </Fragment>
  1763. );
  1764. const userFeedbackRoutes = (
  1765. <Fragment>
  1766. {usingCustomerDomain && (
  1767. <Route
  1768. path="/user-feedback/"
  1769. component={withDomainRequired(make(() => import('sentry/views/userFeedback')))}
  1770. key="orgless-user-feedback-route"
  1771. />
  1772. )}
  1773. <Route
  1774. path="/organizations/:orgId/user-feedback/"
  1775. component={withDomainRedirect(make(() => import('sentry/views/userFeedback')))}
  1776. key="org-user-feedback"
  1777. />
  1778. </Fragment>
  1779. );
  1780. const feedbackChildRoutes = (
  1781. <Fragment>
  1782. <IndexRoute
  1783. component={make(() => import('sentry/views/feedback/feedbackListPage'))}
  1784. />
  1785. <Route
  1786. path=":feedbackSlug/"
  1787. component={make(() => import('sentry/views/feedback/feedbackDetailsPage'))}
  1788. />
  1789. </Fragment>
  1790. );
  1791. const feedbackv2Routes = (
  1792. <Fragment>
  1793. {usingCustomerDomain && (
  1794. <Route
  1795. path="/feedback/"
  1796. component={withDomainRequired(
  1797. make(() => import('sentry/views/feedback/index'))
  1798. )}
  1799. key="orgless-feedback-list-route"
  1800. >
  1801. {feedbackChildRoutes}
  1802. </Route>
  1803. )}
  1804. <Route
  1805. path="/organizations/:orgId/feedback/"
  1806. component={withDomainRedirect(make(() => import('sentry/views/feedback/index')))}
  1807. key="org-feedback-list-route"
  1808. >
  1809. {feedbackChildRoutes}
  1810. </Route>
  1811. </Fragment>
  1812. );
  1813. const issueListRoutes = (
  1814. <Fragment>
  1815. {usingCustomerDomain && (
  1816. <Route
  1817. path="/issues/(searches/:searchId/)"
  1818. component={withDomainRequired(errorHandler(IssueListContainer))}
  1819. key="orgless-issues-route"
  1820. >
  1821. <IndexRoute component={errorHandler(IssueListOverview)} />
  1822. </Route>
  1823. )}
  1824. <Route
  1825. path="/organizations/:orgId/issues/(searches/:searchId/)"
  1826. component={withDomainRedirect(errorHandler(IssueListContainer))}
  1827. key="org-issues"
  1828. >
  1829. <Redirect from="/organizations/:orgId/" to="/organizations/:orgId/issues/" />
  1830. <IndexRoute component={errorHandler(IssueListOverview)} />
  1831. </Route>
  1832. </Fragment>
  1833. );
  1834. // Once org issues is complete, these routes can be nested under
  1835. // /organizations/:orgId/issues
  1836. const issueTabs = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
  1837. const hoc = forCustomerDomain ? withDomainRequired : x => x;
  1838. return (
  1839. <Fragment>
  1840. <IndexRoute
  1841. component={hoc(
  1842. make(() => import('sentry/views/issueDetails/groupEventDetails'))
  1843. )}
  1844. />
  1845. <Route
  1846. path={TabPaths[Tab.REPLAYS]}
  1847. component={hoc(make(() => import('sentry/views/issueDetails/groupReplays')))}
  1848. />
  1849. <Route
  1850. path={TabPaths[Tab.ACTIVITY]}
  1851. component={hoc(make(() => import('sentry/views/issueDetails/groupActivity')))}
  1852. />
  1853. <Route
  1854. path={TabPaths[Tab.EVENTS]}
  1855. component={hoc(make(() => import('sentry/views/issueDetails/groupEvents')))}
  1856. />
  1857. <Route
  1858. path={TabPaths[Tab.TAGS]}
  1859. component={hoc(make(() => import('sentry/views/issueDetails/groupTags')))}
  1860. />
  1861. <Route
  1862. path={`${TabPaths[Tab.TAGS]}:tagKey/`}
  1863. component={make(() => import('sentry/views/issueDetails/groupTagValues'))}
  1864. />
  1865. <Route
  1866. path={TabPaths[Tab.USER_FEEDBACK]}
  1867. component={hoc(
  1868. make(() => import('sentry/views/issueDetails/groupUserFeedback'))
  1869. )}
  1870. />
  1871. <Route
  1872. path={TabPaths[Tab.ATTACHMENTS]}
  1873. component={hoc(
  1874. make(() => import('sentry/views/issueDetails/groupEventAttachments'))
  1875. )}
  1876. />
  1877. <Route
  1878. path={TabPaths[Tab.SIMILAR_ISSUES]}
  1879. component={hoc(
  1880. make(() => import('sentry/views/issueDetails/groupSimilarIssues'))
  1881. )}
  1882. />
  1883. <Route
  1884. path={TabPaths[Tab.MERGED]}
  1885. component={hoc(make(() => import('sentry/views/issueDetails/groupMerged')))}
  1886. />
  1887. </Fragment>
  1888. );
  1889. };
  1890. const issueDetailsChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => (
  1891. <Fragment>
  1892. {issueTabs({forCustomerDomain})}
  1893. <Route path={`${TabPaths[Tab.EVENTS]}:eventId/`}>
  1894. {issueTabs({forCustomerDomain})}
  1895. </Route>
  1896. </Fragment>
  1897. );
  1898. const issueDetailsRoutes = (
  1899. <Fragment>
  1900. <Route
  1901. path="/organizations/:orgId/issues/:groupId/"
  1902. component={withDomainRedirect(make(() => import('sentry/views/issueDetails')))}
  1903. key="org-issues-group-id"
  1904. >
  1905. {issueDetailsChildRoutes({forCustomerDomain: false})}
  1906. </Route>
  1907. {usingCustomerDomain && (
  1908. <Route
  1909. path="/issues/:groupId/"
  1910. component={withDomainRequired(make(() => import('sentry/views/issueDetails')))}
  1911. key="orgless-issues-group-id-route"
  1912. >
  1913. {issueDetailsChildRoutes({forCustomerDomain: true})}
  1914. </Route>
  1915. )}
  1916. </Fragment>
  1917. );
  1918. // These are the "manage" pages. For sentry.io, these are _different_ from
  1919. // the SaaS admin routes in getsentry.
  1920. const adminManageRoutes = (
  1921. <Route
  1922. path="/manage/"
  1923. component={make(() => import('sentry/views/admin/adminLayout'))}
  1924. >
  1925. <IndexRoute component={make(() => import('sentry/views/admin/adminOverview'))} />
  1926. <Route
  1927. path="buffer/"
  1928. component={make(() => import('sentry/views/admin/adminBuffer'))}
  1929. />
  1930. <Route
  1931. path="relays/"
  1932. component={make(() => import('sentry/views/admin/adminRelays'))}
  1933. />
  1934. <Route
  1935. path="organizations/"
  1936. component={make(() => import('sentry/views/admin/adminOrganizations'))}
  1937. />
  1938. <Route
  1939. path="projects/"
  1940. component={make(() => import('sentry/views/admin/adminProjects'))}
  1941. />
  1942. <Route
  1943. path="queue/"
  1944. component={make(() => import('sentry/views/admin/adminQueue'))}
  1945. />
  1946. <Route
  1947. path="quotas/"
  1948. component={make(() => import('sentry/views/admin/adminQuotas'))}
  1949. />
  1950. <Route
  1951. path="settings/"
  1952. component={make(() => import('sentry/views/admin/adminSettings'))}
  1953. />
  1954. <Route path="users/">
  1955. <IndexRoute component={make(() => import('sentry/views/admin/adminUsers'))} />
  1956. <Route
  1957. path=":id"
  1958. component={make(() => import('sentry/views/admin/adminUserEdit'))}
  1959. />
  1960. </Route>
  1961. <Route
  1962. path="status/mail/"
  1963. component={make(() => import('sentry/views/admin/adminMail'))}
  1964. />
  1965. <Route
  1966. path="status/environment/"
  1967. component={make(() => import('sentry/views/admin/adminEnvironment'))}
  1968. />
  1969. <Route
  1970. path="status/packages/"
  1971. component={make(() => import('sentry/views/admin/adminPackages'))}
  1972. />
  1973. <Route
  1974. path="status/warnings/"
  1975. component={make(() => import('sentry/views/admin/adminWarnings'))}
  1976. />
  1977. </Route>
  1978. );
  1979. // XXX(epurkhiser): This should probably go away. It's not totally clear to
  1980. // me why we need the OrganizationRoot root container.
  1981. const legacyOrganizationRootRoutes = (
  1982. <Route component={errorHandler(OrganizationRoot)}>
  1983. <Redirect from="/organizations/:orgId/teams/new/" to="/settings/:orgId/teams/" />
  1984. <Route path="/organizations/:orgId/">
  1985. {hook('routes:organization')}
  1986. <Redirect from="/organizations/:orgId/teams/" to="/settings/:orgId/teams/" />
  1987. <Redirect
  1988. from="/organizations/:orgId/teams/your-teams/"
  1989. to="/settings/:orgId/teams/"
  1990. />
  1991. <Redirect
  1992. from="/organizations/:orgId/teams/all-teams/"
  1993. to="/settings/:orgId/teams/"
  1994. />
  1995. <Redirect
  1996. from="/organizations/:orgId/teams/:teamId/"
  1997. to="/settings/:orgId/teams/:teamId/"
  1998. />
  1999. <Redirect
  2000. from="/organizations/:orgId/teams/:teamId/members/"
  2001. to="/settings/:orgId/teams/:teamId/members/"
  2002. />
  2003. <Redirect
  2004. from="/organizations/:orgId/teams/:teamId/projects/"
  2005. to="/settings/:orgId/teams/:teamId/projects/"
  2006. />
  2007. <Redirect
  2008. from="/organizations/:orgId/teams/:teamId/settings/"
  2009. to="/settings/:orgId/teams/:teamId/settings/"
  2010. />
  2011. <Redirect from="/organizations/:orgId/settings/" to="/settings/:orgId/" />
  2012. <Redirect
  2013. from="/organizations/:orgId/api-keys/"
  2014. to="/settings/:orgId/api-keys/"
  2015. />
  2016. <Redirect
  2017. from="/organizations/:orgId/api-keys/:apiKey/"
  2018. to="/settings/:orgId/api-keys/:apiKey/"
  2019. />
  2020. <Redirect from="/organizations/:orgId/members/" to="/settings/:orgId/members/" />
  2021. <Redirect
  2022. from="/organizations/:orgId/members/:memberId/"
  2023. to="/settings/:orgId/members/:memberId/"
  2024. />
  2025. <Redirect
  2026. from="/organizations/:orgId/rate-limits/"
  2027. to="/settings/:orgId/rate-limits/"
  2028. />
  2029. <Redirect from="/organizations/:orgId/repos/" to="/settings/:orgId/repos/" />
  2030. </Route>
  2031. </Route>
  2032. );
  2033. const gettingStartedRoutes = (
  2034. <Fragment>
  2035. {usingCustomerDomain && (
  2036. <Fragment>
  2037. <Redirect
  2038. from="/getting-started/:projectId/"
  2039. to="/projects/:projectId/getting-started/"
  2040. />
  2041. <Redirect
  2042. from="/getting-started/:projectId/:platform/"
  2043. to="/projects/:projectId/getting-started/"
  2044. />
  2045. </Fragment>
  2046. )}
  2047. <Redirect
  2048. from="/:orgId/:projectId/getting-started/"
  2049. to="/organizations/:orgId/projects/:projectId/getting-started/"
  2050. />
  2051. <Redirect
  2052. from="/:orgId/:projectId/getting-started/:platform/"
  2053. to="/organizations/:orgId/projects/:projectId/getting-started/"
  2054. />
  2055. </Fragment>
  2056. );
  2057. const profilingChildRoutes = (
  2058. <Fragment>
  2059. <IndexRoute component={make(() => import('sentry/views/profiling/content'))} />
  2060. <Route
  2061. path="summary/:projectId/"
  2062. component={make(() => import('sentry/views/profiling/profileSummary'))}
  2063. />
  2064. <Route
  2065. path="profile/:projectId/:eventId/"
  2066. component={make(() => import('sentry/views/profiling/profilesProvider'))}
  2067. >
  2068. {/* @TODO Remove flamechart route name */}
  2069. <Route
  2070. path="flamechart/"
  2071. component={make(() => import('sentry/views/profiling/profileFlamechart'))}
  2072. />
  2073. <Route
  2074. path="flamegraph/"
  2075. component={make(() => import('sentry/views/profiling/profileFlamechart'))}
  2076. />
  2077. </Route>
  2078. </Fragment>
  2079. );
  2080. const profilingRoutes = (
  2081. <Fragment>
  2082. {usingCustomerDomain && (
  2083. <Route
  2084. path="/profiling/"
  2085. component={withDomainRequired(make(() => import('sentry/views/profiling')))}
  2086. key="orgless-profiling-route"
  2087. >
  2088. {profilingChildRoutes}
  2089. </Route>
  2090. )}
  2091. <Route
  2092. path="/organizations/:orgId/profiling/"
  2093. component={withDomainRedirect(make(() => import('sentry/views/profiling')))}
  2094. key="org-profiling"
  2095. >
  2096. {profilingChildRoutes}
  2097. </Route>
  2098. </Fragment>
  2099. );
  2100. const ddmChildRoutes = (
  2101. <Fragment>
  2102. <IndexRoute component={make(() => import('sentry/views/ddm/ddm'))} />
  2103. </Fragment>
  2104. );
  2105. const ddmRoutes = (
  2106. <Fragment>
  2107. {usingCustomerDomain && (
  2108. <Route
  2109. path="/ddm/"
  2110. component={withDomainRequired(make(() => import('sentry/views/ddm')))}
  2111. key="orgless-ddm-route"
  2112. >
  2113. {ddmChildRoutes}
  2114. </Route>
  2115. )}
  2116. <Route
  2117. path="/organizations/:orgId/ddm/"
  2118. component={withDomainRedirect(make(() => import('sentry/views/ddm')))}
  2119. key="org-ddm"
  2120. >
  2121. {ddmChildRoutes}
  2122. </Route>
  2123. </Fragment>
  2124. );
  2125. // Support for deprecated URLs (pre-Sentry 10). We just redirect users to new
  2126. // canonical URLs.
  2127. //
  2128. // XXX(epurkhiser): Can these be moved over to the legacyOrgRedirects routes,
  2129. // or do these need to be nested into the OrganizationDetails tree?
  2130. const legacyOrgRedirects = (
  2131. <Route path="/:orgId/:projectId/">
  2132. <IndexRoute
  2133. component={errorHandler(
  2134. redirectDeprecatedProjectRoute(
  2135. ({orgId, projectId}) => `/organizations/${orgId}/issues/?project=${projectId}`
  2136. )
  2137. )}
  2138. />
  2139. <Route
  2140. path="issues/"
  2141. component={errorHandler(
  2142. redirectDeprecatedProjectRoute(
  2143. ({orgId, projectId}) => `/organizations/${orgId}/issues/?project=${projectId}`
  2144. )
  2145. )}
  2146. />
  2147. <Route
  2148. path="dashboard/"
  2149. component={errorHandler(
  2150. redirectDeprecatedProjectRoute(
  2151. ({orgId, projectId}) =>
  2152. `/organizations/${orgId}/dashboards/?project=${projectId}`
  2153. )
  2154. )}
  2155. />
  2156. <Route
  2157. path="user-feedback/"
  2158. component={errorHandler(
  2159. redirectDeprecatedProjectRoute(
  2160. ({orgId, projectId}) =>
  2161. `/organizations/${orgId}/user-feedback/?project=${projectId}`
  2162. )
  2163. )}
  2164. />
  2165. <Route
  2166. path="releases/"
  2167. component={errorHandler(
  2168. redirectDeprecatedProjectRoute(
  2169. ({orgId, projectId}) =>
  2170. `/organizations/${orgId}/releases/?project=${projectId}`
  2171. )
  2172. )}
  2173. />
  2174. <Route
  2175. path="releases/:version/"
  2176. component={errorHandler(
  2177. redirectDeprecatedProjectRoute(
  2178. ({orgId, projectId, router}) =>
  2179. `/organizations/${orgId}/releases/${router.params.version}/?project=${projectId}`
  2180. )
  2181. )}
  2182. />
  2183. <Route
  2184. path="releases/:version/new-events/"
  2185. component={errorHandler(
  2186. redirectDeprecatedProjectRoute(
  2187. ({orgId, projectId, router}) =>
  2188. `/organizations/${orgId}/releases/${router.params.version}/new-events/?project=${projectId}`
  2189. )
  2190. )}
  2191. />
  2192. <Route
  2193. path="releases/:version/all-events/"
  2194. component={errorHandler(
  2195. redirectDeprecatedProjectRoute(
  2196. ({orgId, projectId, router}) =>
  2197. `/organizations/${orgId}/releases/${router.params.version}/all-events/?project=${projectId}`
  2198. )
  2199. )}
  2200. />
  2201. <Route
  2202. path="releases/:version/commits/"
  2203. component={errorHandler(
  2204. redirectDeprecatedProjectRoute(
  2205. ({orgId, projectId, router}) =>
  2206. `/organizations/${orgId}/releases/${router.params.version}/commits/?project=${projectId}`
  2207. )
  2208. )}
  2209. />
  2210. </Route>
  2211. );
  2212. const organizationRoutes = (
  2213. <Route component={errorHandler(OrganizationDetails)}>
  2214. {settingsRoutes}
  2215. {projectsRoutes}
  2216. {dashboardRoutes}
  2217. {userFeedbackRoutes}
  2218. {feedbackv2Routes}
  2219. {issueListRoutes}
  2220. {issueDetailsRoutes}
  2221. {alertRoutes}
  2222. {cronsRoutes}
  2223. {replayRoutes}
  2224. {releasesRoutes}
  2225. {activityRoutes}
  2226. {statsRoutes}
  2227. {discoverRoutes}
  2228. {performanceRoutes}
  2229. {starfishRoutes}
  2230. {profilingRoutes}
  2231. {ddmRoutes}
  2232. {gettingStartedRoutes}
  2233. {adminManageRoutes}
  2234. {legacyOrganizationRootRoutes}
  2235. {legacyOrgRedirects}
  2236. </Route>
  2237. );
  2238. const legacyRedirectRoutes = (
  2239. <Route path="/:orgId/">
  2240. <IndexRedirect to="/organizations/:orgId/" />
  2241. <Route path=":projectId/settings/">
  2242. <Redirect from="teams/" to="/settings/:orgId/projects/:projectId/teams/" />
  2243. <Redirect from="alerts/" to="/settings/:orgId/projects/:projectId/alerts/" />
  2244. <Redirect
  2245. from="alerts/rules/"
  2246. to="/settings/:orgId/projects/:projectId/alerts/rules/"
  2247. />
  2248. <Redirect
  2249. from="alerts/rules/new/"
  2250. to="/settings/:orgId/projects/:projectId/alerts/rules/new/"
  2251. />
  2252. <Redirect
  2253. from="alerts/rules/:ruleId/"
  2254. to="/settings/:orgId/projects/:projectId/alerts/rules/:ruleId/"
  2255. />
  2256. <Redirect
  2257. from="environments/"
  2258. to="/settings/:orgId/projects/:projectId/environments/"
  2259. />
  2260. <Redirect
  2261. from="environments/hidden/"
  2262. to="/settings/:orgId/projects/:projectId/environments/hidden/"
  2263. />
  2264. <Redirect from="tags/" to="/settings/projects/:orgId/projects/:projectId/tags/" />
  2265. <Redirect
  2266. from="issue-tracking/"
  2267. to="/settings/:orgId/projects/:projectId/issue-tracking/"
  2268. />
  2269. <Redirect
  2270. from="release-tracking/"
  2271. to="/settings/:orgId/projects/:projectId/release-tracking/"
  2272. />
  2273. <Redirect
  2274. from="ownership/"
  2275. to="/settings/:orgId/projects/:projectId/ownership/"
  2276. />
  2277. <Redirect
  2278. from="data-forwarding/"
  2279. to="/settings/:orgId/projects/:projectId/data-forwarding/"
  2280. />
  2281. <Redirect
  2282. from="debug-symbols/"
  2283. to="/settings/:orgId/projects/:projectId/debug-symbols/"
  2284. />
  2285. <Redirect
  2286. from="processing-issues/"
  2287. to="/settings/:orgId/projects/:projectId/processing-issues/"
  2288. />
  2289. <Redirect from="filters/" to="/settings/:orgId/projects/:projectId/filters/" />
  2290. <Redirect from="hooks/" to="/settings/:orgId/projects/:projectId/hooks/" />
  2291. <Redirect from="keys/" to="/settings/:orgId/projects/:projectId/keys/" />
  2292. <Redirect
  2293. from="keys/:keyId/"
  2294. to="/settings/:orgId/projects/:projectId/keys/:keyId/"
  2295. />
  2296. <Redirect
  2297. from="user-feedback/"
  2298. to="/settings/:orgId/projects/:projectId/user-feedback/"
  2299. />
  2300. <Redirect
  2301. from="security-headers/"
  2302. to="/settings/:orgId/projects/:projectId/security-headers/"
  2303. />
  2304. <Redirect
  2305. from="security-headers/csp/"
  2306. to="/settings/:orgId/projects/:projectId/security-headers/csp/"
  2307. />
  2308. <Redirect
  2309. from="security-headers/expect-ct/"
  2310. to="/settings/:orgId/projects/:projectId/security-headers/expect-ct/"
  2311. />
  2312. <Redirect
  2313. from="security-headers/hpkp/"
  2314. to="/settings/:orgId/projects/:projectId/security-headers/hpkp/"
  2315. />
  2316. <Redirect from="plugins/" to="/settings/:orgId/projects/:projectId/plugins/" />
  2317. <Redirect
  2318. from="plugins/:pluginId/"
  2319. to="/settings/:orgId/projects/:projectId/plugins/:pluginId/"
  2320. />
  2321. <Redirect
  2322. from="integrations/:providerKey/"
  2323. to="/settings/:orgId/projects/:projectId/integrations/:providerKey/"
  2324. />
  2325. </Route>
  2326. <Redirect from=":projectId/group/:groupId/" to="issues/:groupId/" />
  2327. <Redirect
  2328. from=":projectId/issues/:groupId/"
  2329. to="/organizations/:orgId/issues/:groupId/"
  2330. />
  2331. <Redirect
  2332. from=":projectId/issues/:groupId/events/"
  2333. to="/organizations/:orgId/issues/:groupId/events/"
  2334. />
  2335. <Redirect
  2336. from=":projectId/issues/:groupId/events/:eventId/"
  2337. to="/organizations/:orgId/issues/:groupId/events/:eventId/"
  2338. />
  2339. <Redirect
  2340. from=":projectId/issues/:groupId/tags/"
  2341. to="/organizations/:orgId/issues/:groupId/tags/"
  2342. />
  2343. <Redirect
  2344. from=":projectId/issues/:groupId/tags/:tagKey/"
  2345. to="/organizations/:orgId/issues/:groupId/tags/:tagKey/"
  2346. />
  2347. <Redirect
  2348. from=":projectId/issues/:groupId/feedback/"
  2349. to="/organizations/:orgId/issues/:groupId/feedback/"
  2350. />
  2351. <Redirect
  2352. from=":projectId/issues/:groupId/similar/"
  2353. to="/organizations/:orgId/issues/:groupId/similar/"
  2354. />
  2355. <Redirect
  2356. from=":projectId/issues/:groupId/merged/"
  2357. to="/organizations/:orgId/issues/:groupId/merged/"
  2358. />
  2359. <Route
  2360. path=":projectId/events/:eventId/"
  2361. component={errorHandler(ProjectEventRedirect)}
  2362. />
  2363. </Route>
  2364. );
  2365. const appRoutes = (
  2366. <Route>
  2367. {experimentalSpaRoutes}
  2368. <Route path="/" component={errorHandler(App)}>
  2369. {rootRoutes}
  2370. {organizationRoutes}
  2371. {legacyRedirectRoutes}
  2372. <Route path="*" component={errorHandler(RouteNotFound)} />
  2373. </Route>
  2374. </Route>
  2375. );
  2376. return appRoutes;
  2377. }
  2378. // We load routes both when initializing the SDK (for routing integrations) and
  2379. // when the app renders Main. Memoize to avoid rebuilding the route tree.
  2380. export const routes = memoize(buildRoutes);
  2381. // Exported for use in tests.
  2382. export {buildRoutes};
  2383. function NoOp(props: {children: React.ReactNode}) {
  2384. return <Fragment>{props.children}</Fragment>;
  2385. }