groupCapabilities.tsx 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import {t} from 'sentry/locale';
  2. import {IssueCategory, IssueCategoryCapabilities} from 'sentry/types/group';
  3. /**
  4. * Defines what capabilities each category of issue supports
  5. */
  6. const ISSUE_CATEGORY_CAPABILITIES: Record<IssueCategory, IssueCategoryCapabilities> = {
  7. [IssueCategory.ERROR]: {
  8. delete: {enabled: true},
  9. deleteAndDiscard: {enabled: true},
  10. merge: {enabled: true},
  11. ignore: {enabled: true},
  12. share: {enabled: true},
  13. codeowners: {enabled: true},
  14. },
  15. [IssueCategory.PERFORMANCE]: {
  16. delete: {
  17. enabled: false,
  18. disabledReason: t('Not yet supported for performance issues'),
  19. },
  20. deleteAndDiscard: {
  21. enabled: false,
  22. disabledReason: t('Not yet supported for performance issues'),
  23. },
  24. merge: {
  25. enabled: false,
  26. disabledReason: t('Not yet supported for performance issues'),
  27. },
  28. ignore: {enabled: true},
  29. share: {enabled: true},
  30. codeowners: {
  31. enabled: false,
  32. disabledReason: t('Codeowners do not apply to performance issues'),
  33. },
  34. },
  35. };
  36. /**
  37. * Checks if an issue supports a specific capability.
  38. */
  39. export function getIssueCapability(
  40. issueCategory: IssueCategory,
  41. capability: keyof IssueCategoryCapabilities
  42. ) {
  43. return ISSUE_CATEGORY_CAPABILITIES[issueCategory][capability] ?? {enabled: false};
  44. }