routes.tsx 80 KB

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