1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- import styled from '@emotion/styled';
- import {Hovercard} from 'sentry/components/hovercard';
- import {FullQueryDescription} from 'sentry/views/starfish/components/fullQueryDescription';
- import {SpanDescriptionLink} from 'sentry/views/starfish/components/spanDescriptionLink';
- import {ModuleName} from 'sentry/views/starfish/types';
- import {SQLishFormatter} from 'sentry/views/starfish/utils/sqlish/SQLishFormatter';
- const formatter = new SQLishFormatter();
- interface Props {
- moduleName: ModuleName;
- projectId: number;
- description?: string;
- endpoint?: string;
- endpointMethod?: string;
- group?: string;
- }
- export function SpanDescriptionCell({
- description,
- group,
- moduleName,
- endpoint,
- endpointMethod,
- projectId,
- }: Props) {
- if (!description) {
- return NULL_DESCRIPTION;
- }
- const descriptionLink = (
- <SpanDescriptionLink
- group={group}
- projectId={projectId}
- endpoint={endpoint}
- endpointMethod={endpointMethod}
- description={
- moduleName === ModuleName.DB ? formatter.toSimpleMarkup(description) : description
- }
- />
- );
- return ModuleName.DB ? (
- <DescriptionWrapper>
- <WiderHovercard
- position="right"
- body={<FullQueryDescription group={group} shortDescription={description} />}
- >
- {descriptionLink}
- </WiderHovercard>
- </DescriptionWrapper>
- ) : (
- descriptionLink
- );
- }
- const NULL_DESCRIPTION = <span><null></span>;
- export const WiderHovercard = styled(
- ({
- children,
- className,
- containerClassName,
- ...props
- }: React.ComponentProps<typeof Hovercard>) => (
- <Hovercard
- className={(className ?? '') + ' wider'}
- containerClassName={(containerClassName ?? '') + ' inline-flex'}
- {...props}
- >
- {children}
- </Hovercard>
- )
- )`
- &.wider {
- width: auto;
- max-width: 550px;
- }
- `;
- const DescriptionWrapper = styled('div')`
- .inline-flex {
- display: inline-flex;
- }
- `;
|