[Logs Explorer] Fix message field highlights due to the formatting issues (#171631)

## Summary

Fixes the issue when the message is added as a filter, discover
component surrounds the value with the <mark> tag in order to highlight
the field. Since our message field is inside a `EuiCodeBlock` it cannot
be highlighted and hence should not support adding of this tag.

### Before


![image](39a3f0f2-ed88-40d9-ae5c-bd23287e13d3)


### After


![image](f05e5168-9f73-48c4-ac9e-f68ea72f91e6)
This commit is contained in:
Achyut Jhunjhunwala 2023-11-23 12:12:28 +01:00 committed by GitHub
parent 6788c1a684
commit 5d3c1bc2bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5,7 +5,6 @@
* 2.0.
*/
import { formatFieldValue } from '@kbn/discover-utils';
import he from 'he';
import * as constants from '../../../common/constants';
import { useKibanaContextForPlugin } from '../../utils/use_kibana';
import { FlyoutDoc, FlyoutProps, LogDocument } from './types';
@ -34,8 +33,7 @@ export function useDocDetail(
// Flyout Headers
const level = formatField(constants.LOG_LEVEL_FIELD)?.toLowerCase();
const timestamp = formatField(constants.TIMESTAMP_FIELD);
const formattedMessage = formatField(constants.MESSAGE_FIELD);
const message = formattedMessage ? he.decode(formattedMessage) : undefined;
const message = doc.flattened[constants.MESSAGE_FIELD];
// Service Highlights
const serviceName = formatField(constants.SERVICE_NAME_FIELD);