import {Fragment, useMemo} from 'react'; import styled from '@emotion/styled'; import {Hovercard} from 'sentry/components/hovercard'; import {t} from 'sentry/locale'; import {space} from 'sentry/styles/space'; import {SQLishFormatter} from 'sentry/utils/sqlish/SQLishFormatter'; import {FullSpanDescription} from 'sentry/views/insights/common/components/fullSpanDescription'; import {SpanGroupDetailsLink} from 'sentry/views/insights/common/components/spanGroupDetailsLink'; import {ModuleName, SpanMetricsField} from 'sentry/views/insights/types'; const formatter = new SQLishFormatter(); const {SPAN_OP} = SpanMetricsField; interface Props { description: string; moduleName: ModuleName.DB | ModuleName.RESOURCE; projectId: number; extraLinkQueryParams?: Record; // extra query params to add to the link group?: string; spanOp?: string; } export function SpanDescriptionCell({ description: rawDescription, group, moduleName, spanOp, projectId, extraLinkQueryParams, }: Props) { const formatterDescription = useMemo(() => { if (moduleName !== ModuleName.DB) { return rawDescription; } return formatter.toSimpleMarkup(rawDescription); }, [moduleName, rawDescription]); if (!rawDescription) { return NULL_DESCRIPTION; } const descriptionLink = ( ); if (moduleName === ModuleName.DB) { return ( } > {descriptionLink} ); } if (moduleName === ModuleName.RESOURCE) { return ( {t('Example')} } > {descriptionLink} ); } return descriptionLink; } const NULL_DESCRIPTION = <null>; export const WiderHovercard = styled( ({children, className, ...props}: React.ComponentProps) => ( {children} ) )` &.wider { width: auto; max-width: 550px; } `; const TitleWrapper = styled('div')` margin-bottom: ${space(1)}; `;