Skip to content

Commit f7b7a6c

Browse files
[Security Solution][Alert flyout] Fix dual hover actions in table tab (#212316)
## Summary Ref: #212138 This PR fixed a bug where the fields in the table tab have 2 hover actions, by pruning an unused branch in formatted fields (the [original logic](https://github.com/elastic/kibana/pull/207959/files#diff-ccbcd249520d7f127960805d59a0ebfd00613785a2dd5b047545bb8b4e565e26L331) was if the field is not draggable, show the value as text) ![image](https://github.com/user-attachments/assets/f9922476-cd8b-43f5-9c35-6ad790357da7) ### Checklist - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md) - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
1 parent f8e31e5 commit f7b7a6c

4 files changed

Lines changed: 7 additions & 31 deletions

File tree

x-pack/solutions/security/plugins/security_solution/public/timelines/components/timeline/body/renderers/formatted_field.test.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,14 +226,15 @@ describe('Events', () => {
226226
expect(wrapper.find('[data-test-subj="truncatable-message"]').exists()).toEqual(true);
227227
});
228228

229-
test('it does NOT render the truncatable message style when fieldName is NOT message', () => {
229+
test('it does NOT render the truncatable message style when truncate is false', () => {
230230
const wrapper = mount(
231231
<TestProviders>
232232
<FormattedFieldValue
233233
eventId={mockTimelineData[0].ecs._id}
234234
contextId="test"
235235
fieldName="NOT-message"
236236
fieldType="text"
237+
truncate={false}
237238
value={'a NON-message value'}
238239
/>
239240
</TestProviders>

x-pack/solutions/security/plugins/security_solution/public/timelines/components/timeline/body/renderers/formatted_field.tsx

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import {
2222
} from '../../../../../../common/field_maps/field_names';
2323
import { AgentStatus } from '../../../../../common/components/endpoint/agents/agent_status';
2424
import { INDICATOR_REFERENCE } from '../../../../../../common/cti/constants';
25-
import { DefaultDraggable } from '../../../../../common/components/draggables';
2625
import { Bytes, BYTES_FORMAT } from './bytes';
2726
import { Duration, EVENT_DURATION_FIELD_NAME } from '../../../duration';
2827
import { getOrEmptyTagFromValue } from '../../../../../common/components/empty_value';
@@ -38,7 +37,6 @@ import {
3837
EVENT_URL_FIELD_NAME,
3938
GEO_FIELD_TYPE,
4039
IP_FIELD_TYPE,
41-
MESSAGE_FIELD_NAME,
4240
REFERENCE_URL_FIELD_NAME,
4341
RULE_REFERENCE_FIELD_NAME,
4442
SIGNAL_RULE_NAME_FIELD_NAME,
@@ -51,9 +49,6 @@ import { UserName } from './user_name';
5149
import { AssetCriticalityLevel } from './asset_criticality_level';
5250
import { ServiceName } from './service_name';
5351

54-
// simple black-list to prevent dragging and dropping fields such as message name
55-
const columnNamesNotDraggable = [MESSAGE_FIELD_NAME];
56-
5752
// Offset top-aligned tooltips so that cell actions are more visible
5853
const dataGridToolTipOffset = css`
5954
&[data-position='top'] {
@@ -226,7 +221,7 @@ const FormattedFieldValueComponent: React.FC<{
226221
title,
227222
value,
228223
});
229-
} else if (isUnifiedDataTable || columnNamesNotDraggable.includes(fieldName)) {
224+
} else {
230225
return truncate && !isEmpty(value) ? (
231226
<TruncatableText data-test-subj="truncatable-message">
232227
<EuiToolTip
@@ -248,27 +243,7 @@ const FormattedFieldValueComponent: React.FC<{
248243
</EuiToolTip>
249244
</TruncatableText>
250245
) : (
251-
<span data-test-subj={`formatted-field-${fieldName}`}>{value}</span>
252-
);
253-
} else {
254-
// This should not be reached for the unified data table
255-
const contentValue = getOrEmptyTagFromValue(value);
256-
const content = truncate ? <TruncatableText>{contentValue}</TruncatableText> : contentValue;
257-
return (
258-
<DefaultDraggable
259-
field={fieldName}
260-
id={`event-details-value-default-draggable-${contextId}-${eventId}-${fieldName}-${value}`}
261-
fieldType={fieldType ?? ''}
262-
isAggregatable={isAggregatable}
263-
value={`${value}`}
264-
tooltipContent={
265-
fieldType === DATE_FIELD_TYPE || fieldType === EVENT_DURATION_FIELD_NAME
266-
? null
267-
: fieldName
268-
}
269-
>
270-
{content}
271-
</DefaultDraggable>
246+
<span data-test-subj={`formatted-field-${fieldName}`}>{getOrEmptyTagFromValue(value)}</span>
272247
);
273248
}
274249
};

x-pack/test/security_solution_cypress/cypress/screens/alerts.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ export const ALERT_GRID_CELL = '[data-test-subj="dataGridRowCell"]';
2727

2828
export const ALERT_RULE_NAME = '[data-test-subj="formatted-field-kibana.alert.rule.name"]';
2929

30-
export const ALERT_RISK_SCORE = '[data-test-subj="render-content-kibana.alert.risk_score"]';
30+
export const ALERT_RISK_SCORE = '[data-test-subj="formatted-field-kibana.alert.risk_score"]';
3131

32-
export const ALERT_SEVERITY = '[data-test-subj="render-content-kibana.alert.severity"]';
32+
export const ALERT_SEVERITY = '[data-test-subj="formatted-field-kibana.alert.severity"]';
3333

3434
export const ALERT_DATA_GRID = '[data-test-subj="euiDataGridBody"]';
3535

x-pack/test/security_solution_cypress/cypress/screens/timeline.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ export const TIMESTAMP_HOVER_ACTION_OVERFLOW_BTN =
268268
export const TIMELINE_STATUS = '[data-test-subj="timeline-save-status"]';
269269

270270
export const ALERT_TABLE_SEVERITY_VALUES =
271-
'[data-test-subj="render-content-kibana.alert.severity"]';
271+
'[data-test-subj="formatted-field-kibana.alert.severity"]';
272272

273273
export const ALERT_TABLE_FILE_NAME_HEADER = '[data-gridcell-column-id="file.name"]';
274274

0 commit comments

Comments
 (0)