routes.tsx 78 KB

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