NotificationSettings.tsx 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import React, { FC } from 'react';
  2. import { Checkbox, CollapsableSection, Field, InfoBox, Input } from '@grafana/ui';
  3. import { NotificationSettingsProps } from './NotificationChannelForm';
  4. interface Props extends NotificationSettingsProps {
  5. imageRendererAvailable: boolean;
  6. }
  7. export const NotificationSettings: FC<Props> = ({ currentFormValues, imageRendererAvailable, register }) => {
  8. return (
  9. <CollapsableSection label="Notification settings" isOpen={false}>
  10. <Field>
  11. <Checkbox {...register('isDefault')} label="Default" description="Use this notification for all alerts" />
  12. </Field>
  13. <Field>
  14. <Checkbox
  15. {...register('settings.uploadImage')}
  16. label="Include image"
  17. description="Captures an image and include it in the notification"
  18. />
  19. </Field>
  20. {currentFormValues.uploadImage && !imageRendererAvailable && (
  21. <InfoBox title="No image renderer available/installed">
  22. Grafana cannot find an image renderer to capture an image for the notification. Please make sure the Grafana
  23. Image Renderer plugin is installed. Please contact your Grafana administrator to install the plugin.
  24. </InfoBox>
  25. )}
  26. <Field>
  27. <Checkbox
  28. {...register('disableResolveMessage')}
  29. label="Disable Resolve Message"
  30. description="Disable the resolve message [OK] that is sent when alerting state returns to false"
  31. />
  32. </Field>
  33. <Field>
  34. <Checkbox
  35. {...register('sendReminder')}
  36. label="Send reminders"
  37. description="Send additional notifications for triggered alerts"
  38. />
  39. </Field>
  40. {currentFormValues.sendReminder && (
  41. <>
  42. <Field
  43. label="Send reminder every"
  44. description="Specify how often reminders should be sent, e.g. every 30s, 1m, 10m, 30m', or 1h etc.
  45. Alert reminders are sent after rules are evaluated. A reminder can never be sent more frequently
  46. than a configured alert rule evaluation interval."
  47. >
  48. <Input {...register('frequency')} width={8} />
  49. </Field>
  50. </>
  51. )}
  52. </CollapsableSection>
  53. );
  54. };