crashReports.tsx 957 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import {t, tct} from 'sentry/locale';
  2. import {defined} from 'sentry/utils';
  3. export function formatStoreCrashReports(
  4. value: number | null | '',
  5. organizationValue?: number
  6. ): React.ReactNode {
  7. if (value === null && defined(organizationValue)) {
  8. return tct('Inherit organization settings ([organizationValue])', {
  9. organizationValue: formatStoreCrashReports(organizationValue),
  10. });
  11. }
  12. if (value === -1) {
  13. return t('Unlimited');
  14. }
  15. if (value === 0) {
  16. return t('Disabled');
  17. }
  18. return tct('[value] per issue', {value});
  19. }
  20. export enum SettingScope {
  21. Organization,
  22. Project,
  23. }
  24. export function getStoreCrashReportsValues(settingScope: SettingScope) {
  25. const values: Array<number | null> = [
  26. 0, // disabled
  27. 1, // limited per issue
  28. 5,
  29. 10,
  30. 20,
  31. 50,
  32. 100,
  33. -1, // unlimited
  34. ];
  35. if (settingScope === SettingScope.Project) {
  36. values.unshift(null); // inherit option
  37. }
  38. return values;
  39. }