Add database statement in span flyout for all db types (#128266)

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Giorgos Bamparopoulos 2022-03-28 11:27:04 +01:00 committed by GitHub
parent c9aad65b67
commit 126b140662
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -42,9 +42,27 @@ export function SpanDatabase({ spanDb }: Props) {
return null;
}
if (spanDb.type !== 'sql') {
return <DatabaseStatement>{spanDb.statement}</DatabaseStatement>;
}
const statementItem =
spanDb.type !== 'sql' ? (
spanDb.statement
) : (
<TruncateHeightSection previewHeight={previewHeight}>
<SyntaxHighlighter
language={'sql'}
style={xcode}
customStyle={{
color: null,
background: null,
padding: null,
lineHeight: dbSyntaxLineHeight,
whiteSpace: 'pre-wrap',
overflowX: 'scroll',
}}
>
{spanDb.statement}
</SyntaxHighlighter>
</TruncateHeightSection>
);
return (
<Fragment>
@ -59,24 +77,7 @@ export function SpanDatabase({ spanDb }: Props) {
</h3>
</EuiTitle>
<EuiSpacer size="m" />
<DatabaseStatement>
<TruncateHeightSection previewHeight={previewHeight}>
<SyntaxHighlighter
language={'sql'}
style={xcode}
customStyle={{
color: null,
background: null,
padding: null,
lineHeight: dbSyntaxLineHeight,
whiteSpace: 'pre-wrap',
overflowX: 'scroll',
}}
>
{spanDb.statement}
</SyntaxHighlighter>
</TruncateHeightSection>
</DatabaseStatement>
<DatabaseStatement>{statementItem}</DatabaseStatement>
<EuiSpacer size="l" />
</Fragment>
);