routes.tsx 80 KB

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