navigationConfiguration.tsx 5.9 KB

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