navigationConfiguration.tsx 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. import Badge from 'sentry/components/badge/badge';
  2. import {t} from 'sentry/locale';
  3. import ConfigStore from 'sentry/stores/configStore';
  4. import type {Organization} from 'sentry/types/organization';
  5. import type {Project} from 'sentry/types/project';
  6. import {hasCustomMetrics} from 'sentry/utils/metrics/features';
  7. import {hasTempestAccess} from 'sentry/utils/tempest/features';
  8. import type {NavigationSection} from 'sentry/views/settings/types';
  9. type ConfigParams = {
  10. debugFilesNeedsReview?: boolean;
  11. organization?: Organization;
  12. project?: Project;
  13. };
  14. const pathPrefix = '/settings/:orgId/projects/:projectId';
  15. export default function getConfiguration({
  16. project,
  17. organization,
  18. debugFilesNeedsReview,
  19. }: ConfigParams): NavigationSection[] {
  20. const plugins = (project?.plugins || []).filter(plugin => plugin.enabled);
  21. const isSelfHostedErrorsOnly = ConfigStore.get('isSelfHostedErrorsOnly');
  22. const isSelfHosted = ConfigStore.get('isSelfHosted');
  23. return [
  24. {
  25. name: t('Project'),
  26. items: [
  27. {
  28. path: `${pathPrefix}/`,
  29. index: true,
  30. title: t('General Settings'),
  31. description: t('Configure general settings for a project'),
  32. },
  33. {
  34. path: `${pathPrefix}/teams/`,
  35. title: t('Project Teams'),
  36. description: t('Manage team access for a project'),
  37. },
  38. {
  39. path: `${pathPrefix}/alerts/`,
  40. title: t('Alert Settings'),
  41. description: t('Project alert settings'),
  42. },
  43. {
  44. path: `${pathPrefix}/tags/`,
  45. title: t('Tags & Context'),
  46. description: t("View and manage a project's tags and context"),
  47. },
  48. {
  49. path: `${pathPrefix}/environments/`,
  50. title: t('Environments'),
  51. description: t('Manage environments in a project'),
  52. },
  53. {
  54. path: `${pathPrefix}/ownership/`,
  55. title: t('Ownership Rules'),
  56. description: t('Manage ownership rules for a project'),
  57. },
  58. {
  59. path: `${pathPrefix}/data-forwarding/`,
  60. title: t('Data Forwarding'),
  61. },
  62. {
  63. path: `${pathPrefix}/user-feedback/`,
  64. title: t('User Feedback'),
  65. show: () => !isSelfHostedErrorsOnly,
  66. },
  67. {
  68. path: `${pathPrefix}/toolbar/`,
  69. title: t('Dev Toolbar'),
  70. show: () => !!organization?.features?.includes('dev-toolbar-ui'),
  71. badge: () => <Badge type="beta">Beta</Badge>,
  72. },
  73. ],
  74. },
  75. {
  76. name: t('Processing'),
  77. items: [
  78. {
  79. path: `${pathPrefix}/filters/`,
  80. title: t('Inbound Filters'),
  81. description: t(
  82. "Configure a project's inbound filters (e.g. browsers, messages)"
  83. ),
  84. },
  85. {
  86. path: `${pathPrefix}/security-and-privacy/`,
  87. title: t('Security & Privacy'),
  88. description: t(
  89. 'Configuration related to dealing with sensitive data and other security settings. (Data Scrubbing, Data Privacy, Data Scrubbing) for a project'
  90. ),
  91. },
  92. {
  93. path: `${pathPrefix}/issue-grouping/`,
  94. title: t('Issue Grouping'),
  95. },
  96. {
  97. path: `${pathPrefix}/debug-symbols/`,
  98. title: t('Debug Files'),
  99. badge: debugFilesNeedsReview ? () => 'warning' : undefined,
  100. },
  101. {
  102. path: `${pathPrefix}/proguard/`,
  103. title: t('ProGuard'),
  104. },
  105. {
  106. path: `${pathPrefix}/source-maps/`,
  107. title: t('Source Maps'),
  108. },
  109. {
  110. path: `${pathPrefix}/performance/`,
  111. title: t('Performance'),
  112. show: () =>
  113. !!organization?.features?.includes('performance-view') &&
  114. !isSelfHostedErrorsOnly,
  115. },
  116. {
  117. path: `${pathPrefix}/metrics/`,
  118. title: t('Metrics'),
  119. show: () =>
  120. !!(organization && hasCustomMetrics(organization)) && !isSelfHostedErrorsOnly,
  121. },
  122. {
  123. path: `${pathPrefix}/replays/`,
  124. title: t('Replays'),
  125. show: () =>
  126. !!organization?.features?.includes('session-replay-ui') &&
  127. !isSelfHostedErrorsOnly,
  128. },
  129. {
  130. path: `${pathPrefix}/playstation/`,
  131. title: t('PlayStation'),
  132. badge: () => <Badge type="beta">Beta</Badge>,
  133. show: () => !!(organization && hasTempestAccess(organization)) && !isSelfHosted,
  134. },
  135. ],
  136. },
  137. {
  138. name: t('SDK Setup'),
  139. items: [
  140. {
  141. path: `${pathPrefix}/keys/`,
  142. title: t('Client Keys (DSN)'),
  143. description: t("View and manage the project's client keys (DSN)"),
  144. },
  145. {
  146. path: `${pathPrefix}/loader-script/`,
  147. title: t('Loader Script'),
  148. description: t("View and manage the project's Loader Script"),
  149. },
  150. {
  151. path: `${pathPrefix}/release-tracking/`,
  152. title: t('Releases'),
  153. },
  154. {
  155. path: `${pathPrefix}/security-headers/`,
  156. title: t('Security Headers'),
  157. },
  158. ],
  159. },
  160. {
  161. name: t('Legacy Integrations'),
  162. items: [
  163. {
  164. path: `${pathPrefix}/plugins/`,
  165. title: t('Legacy Integrations'),
  166. description: t('View, enable, and disable all integrations for a project'),
  167. id: 'legacy_integrations',
  168. recordAnalytics: true,
  169. },
  170. ...plugins.map(plugin => ({
  171. path: `${pathPrefix}/plugins/${plugin.id}/`,
  172. title: plugin.name,
  173. show: (opts: any) => opts?.access?.has('project:write') && !plugin.isDeprecated,
  174. id: 'plugin_details',
  175. recordAnalytics: true,
  176. })),
  177. ],
  178. },
  179. ];
  180. }