crashReports.tsx 973 B

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