navigationConfiguration.tsx 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. import FeatureBadge from 'sentry/components/badge/featureBadge';
  2. import {t} from 'sentry/locale';
  3. import type {Organization} from 'sentry/types/organization';
  4. import {hasDynamicSamplingCustomFeature} from 'sentry/utils/dynamicSampling/features';
  5. import {getUserOrgNavigationConfiguration} from 'sentry/views/settings/organization/userOrgNavigationConfiguration';
  6. import type {NavigationSection} from 'sentry/views/settings/types';
  7. const organizationSettingsPathPrefix = '/settings/:orgId';
  8. const userSettingsPathPrefix = '/settings/account';
  9. type ConfigParams = {
  10. organization?: Organization;
  11. };
  12. export function getOrganizationNavigationConfiguration({
  13. organization: incomingOrganization,
  14. }: ConfigParams): NavigationSection[] {
  15. const hasNavigationV2 = incomingOrganization?.features.includes(
  16. 'navigation-sidebar-v2'
  17. );
  18. if (incomingOrganization && hasNavigationV2) {
  19. return getUserOrgNavigationConfiguration({organization: incomingOrganization});
  20. }
  21. return [
  22. {
  23. name: t('User Settings'),
  24. items: [
  25. {
  26. path: `${userSettingsPathPrefix}/`,
  27. title: t('General Settings'),
  28. description: t('Configure general settings for your account'),
  29. id: 'user-settings',
  30. },
  31. ],
  32. },
  33. {
  34. name: t('Organization'),
  35. items: [
  36. {
  37. path: `${organizationSettingsPathPrefix}/`,
  38. title: t('General Settings'),
  39. index: true,
  40. description: t('Configure general settings for an organization'),
  41. id: 'general',
  42. },
  43. {
  44. path: `${organizationSettingsPathPrefix}/projects/`,
  45. title: t('Projects'),
  46. description: t("View and manage an organization's projects"),
  47. id: 'projects',
  48. },
  49. {
  50. path: `${organizationSettingsPathPrefix}/teams/`,
  51. title: t('Teams'),
  52. description: t("Manage an organization's teams"),
  53. id: 'teams',
  54. },
  55. {
  56. path: `${organizationSettingsPathPrefix}/members/`,
  57. title: t('Members'),
  58. description: t('Manage user membership for an organization'),
  59. id: 'members',
  60. },
  61. {
  62. path: `${organizationSettingsPathPrefix}/security-and-privacy/`,
  63. title: t('Security & Privacy'),
  64. description: t(
  65. 'Configuration related to dealing with sensitive data and other security settings. (Data Scrubbing, Data Privacy, Data Scrubbing)'
  66. ),
  67. id: 'security-and-privacy',
  68. },
  69. {
  70. path: `${organizationSettingsPathPrefix}/auth/`,
  71. title: t('Auth'),
  72. description: t('Configure single sign-on'),
  73. id: 'sso',
  74. },
  75. {
  76. path: `${organizationSettingsPathPrefix}/api-keys/`,
  77. title: t('API Keys'),
  78. show: ({access, features}) =>
  79. features!.has('api-keys') && access!.has('org:admin'),
  80. id: 'api-keys',
  81. },
  82. {
  83. path: `${organizationSettingsPathPrefix}/audit-log/`,
  84. title: t('Audit Log'),
  85. description: t('View the audit log for an organization'),
  86. id: 'audit-log',
  87. },
  88. {
  89. path: `${organizationSettingsPathPrefix}/rate-limits/`,
  90. title: t('Rate Limits'),
  91. show: ({features}) => features!.has('legacy-rate-limits'),
  92. description: t('Configure rate limits for all projects in the organization'),
  93. id: 'rate-limits',
  94. },
  95. {
  96. path: `${organizationSettingsPathPrefix}/relay/`,
  97. title: t('Relay'),
  98. description: t('Manage relays connected to the organization'),
  99. id: 'relay',
  100. },
  101. {
  102. path: `${organizationSettingsPathPrefix}/repos/`,
  103. title: t('Repositories'),
  104. description: t('Manage repositories connected to the organization'),
  105. id: 'repos',
  106. },
  107. {
  108. path: `${organizationSettingsPathPrefix}/integrations/`,
  109. title: t('Integrations'),
  110. description: t(
  111. 'Manage organization-level integrations, including: Slack, Github, Bitbucket, Jira, and Azure DevOps'
  112. ),
  113. id: 'integrations',
  114. recordAnalytics: true,
  115. },
  116. {
  117. path: `${organizationSettingsPathPrefix}/early-features/`,
  118. title: t('Early Features'),
  119. description: t('Manage early access features'),
  120. badge: () => <FeatureBadge type="new" />,
  121. show: ({isSelfHosted}) => isSelfHosted || false,
  122. id: 'early-features',
  123. recordAnalytics: true,
  124. },
  125. {
  126. path: `${organizationSettingsPathPrefix}/dynamic-sampling/`,
  127. title: t('Dynamic Sampling'),
  128. description: t('Manage your sampling rate'),
  129. badge: () => 'alpha',
  130. show: ({organization}) =>
  131. !!organization && hasDynamicSamplingCustomFeature(organization),
  132. },
  133. {
  134. path: `${organizationSettingsPathPrefix}/feature-flags/`,
  135. title: t('Feature Flags'),
  136. description: t('Set up your provider webhooks'),
  137. badge: () => 'beta',
  138. show: ({organization}) =>
  139. !!organization && organization.features.includes('feature-flag-ui'),
  140. },
  141. {
  142. path: `${organizationSettingsPathPrefix}/stats/`,
  143. title: t('Stats & Usage'),
  144. description: t('View organization stats and usage'),
  145. id: 'stats',
  146. show: ({organization}) =>
  147. organization?.features.includes('navigation-sidebar-v2') ?? false,
  148. },
  149. ],
  150. },
  151. {
  152. name: t('Developer Settings'),
  153. items: [
  154. {
  155. path: `${organizationSettingsPathPrefix}/auth-tokens/`,
  156. title: t('Auth Tokens'),
  157. description: t('Manage organization auth tokens'),
  158. id: 'auth-tokens',
  159. },
  160. {
  161. path: `${organizationSettingsPathPrefix}/developer-settings/`,
  162. title: t('Custom Integrations'),
  163. description: t('Manage custom integrations'),
  164. id: 'developer-settings',
  165. },
  166. ],
  167. },
  168. ];
  169. }