routes.tsx 76 KB

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