import React, { FC } from 'react'; import { Well } from './Well'; import { GrafanaTheme } from '@grafana/data'; import { css } from '@emotion/css'; import { Tooltip, useStyles } from '@grafana/ui'; import { DetailsField } from './DetailsField'; import { Annotation, annotationLabels } from '../utils/constants'; const wellableAnnotationKeys = ['message', 'description']; interface Props { annotationKey: string; value: string; } export const AnnotationDetailsField: FC = ({ annotationKey, value }) => { const label = annotationLabels[annotationKey as Annotation] ? ( {annotationLabels[annotationKey as Annotation]} ) : ( annotationKey ); return ( ); }; const AnnotationValue: FC = ({ annotationKey, value }) => { const styles = useStyles(getStyles); if (wellableAnnotationKeys.includes(annotationKey)) { return {value}; } else if (value && value.startsWith('http')) { return ( {value} ); } return <>{value}; }; export const getStyles = (theme: GrafanaTheme) => ({ well: css` word-break: break-all; `, link: css` word-break: break-all; color: ${theme.colors.textBlue}; `, });