projectAlerts.tsx 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import type {Field} from 'sentry/components/forms/types';
  2. import {t, tn} from 'sentry/locale';
  3. // Export route to make these forms searchable by label/help
  4. export const route = '/settings/:orgId/projects/:projectId/alerts/';
  5. const formatMinutes = (value: number | '') => {
  6. value = Number(value) / 60;
  7. return tn('%s minute', '%s minutes', value);
  8. };
  9. export const fields: {[key: string]: Field} = {
  10. subjectTemplate: {
  11. name: 'subjectTemplate',
  12. type: 'string',
  13. // additional data/props that is related to rendering of form field rather than data
  14. label: t('Subject Template'),
  15. placeholder: 'e.g. $shortID - $title',
  16. help: t(
  17. 'The email subject to use (excluding the prefix) for individual alerts. Usable variables include: $title, $shortID, $projectID, $orgID, and ${tag:key}, such as ${tag:environment} or ${tag:release}.'
  18. ),
  19. },
  20. digestsMinDelay: {
  21. name: 'digestsMinDelay',
  22. type: 'range',
  23. min: 60,
  24. max: 3600,
  25. step: 60,
  26. defaultValue: 300,
  27. label: t('Minimum delivery interval'),
  28. help: t('Notifications will be delivered at most this often.'),
  29. formatLabel: formatMinutes,
  30. },
  31. digestsMaxDelay: {
  32. name: 'digestsMaxDelay',
  33. type: 'range',
  34. min: 60,
  35. max: 3600,
  36. step: 60,
  37. defaultValue: 300,
  38. label: t('Maximum delivery interval'),
  39. help: t('Notifications will be delivered at least this often.'),
  40. formatLabel: formatMinutes,
  41. },
  42. };