AlertInstanceDetails.tsx 741 B

123456789101112131415161718192021222324252627
  1. import React, { FC } from 'react';
  2. import { Alert } from 'app/types/unified-alerting';
  3. import { AnnotationDetailsField } from '../AnnotationDetailsField';
  4. import { DetailsField } from '../DetailsField';
  5. interface Props {
  6. instance: Alert;
  7. }
  8. export const AlertInstanceDetails: FC<Props> = ({ instance }) => {
  9. const annotations = (Object.entries(instance.annotations || {}) || []).filter(([_, value]) => !!value.trim());
  10. return (
  11. <div>
  12. {instance.value && (
  13. <DetailsField label="Value" horizontal={true}>
  14. {instance.value}
  15. </DetailsField>
  16. )}
  17. {annotations.map(([key, value]) => (
  18. <AnnotationDetailsField key={key} annotationKey={key} value={value} />
  19. ))}
  20. </div>
  21. );
  22. };