Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Security Solution] Fix source.ip and destination.ip draggables #79399

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const getDefaultWhenTooltipIsUnspecified = ({
/**
* Renders the content of the draggable, wrapped in a tooltip
*/
const Content = React.memo<{
export const Content = React.memo<{
children?: React.ReactNode;
field: string;
tooltipContent?: React.ReactNode;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe('Port', () => {
);

expect(
wrapper.find('[data-test-subj="draggable-content-destination.ip"]').find('a').first().props()
wrapper.find('[data-test-subj="draggable-truncatable-content"]').find('a').first().props()
.href
).toEqual('/ip/10.1.2.3/source');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export const Ip = React.memo<{
fieldName={fieldName}
fieldType={IP_FIELD_TYPE}
value={value}
truncate
/>
));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@ describe('SourceDestinationIp', () => {
</TestProviders>
);

expect(wrapper.find('[data-test-subj="draggable-content-source.ip"]').first().text()).toEqual(
expect(wrapper.find('[data-test-subj="draggable-truncatable-content"]').first().text()).toEqual(
'192.168.1.2'
);
});
Expand Down Expand Up @@ -823,7 +823,7 @@ describe('SourceDestinationIp', () => {
</TestProviders>
);

expect(wrapper.find('[data-test-subj="draggable-content-source.ip"]').first().text()).toEqual(
expect(wrapper.find('[data-test-subj="draggable-truncatable-content"]').first().text()).toEqual(
'192.168.1.2'
);
});
Expand Down Expand Up @@ -874,9 +874,9 @@ describe('SourceDestinationIp', () => {
</TestProviders>
);

expect(
wrapper.find('[data-test-subj="draggable-content-destination.ip"]').first().text()
).toEqual('10.1.2.3');
expect(wrapper.find('[data-test-subj="draggable-truncatable-content"]').first().text()).toEqual(
'10.1.2.3'
);
});

test('it renders the expected destination IP when type is `destination`, but the length of the destinationIp and destinationPort port arrays is different', () => {
Expand Down Expand Up @@ -925,9 +925,9 @@ describe('SourceDestinationIp', () => {
</TestProviders>
);

expect(
wrapper.find('[data-test-subj="draggable-content-destination.ip"]').first().text()
).toEqual('10.1.2.3');
expect(wrapper.find('[data-test-subj="draggable-truncatable-content"]').first().text()).toEqual(
'10.1.2.3'
);
});

test('it renders the expected source port when type is `source`, and both sourceIp and sourcePort are populated', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
*/
export const FieldNameContainer = styled.span`
border-radius: 4px;
display: flex;
padding: 0 4px 0 8px;
position: relative;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
DraggableWrapper,
} from '../../../common/components/drag_and_drop/draggable_wrapper';
import { escapeDataProviderId } from '../../../common/components/drag_and_drop/helpers';
import { Content } from '../../../common/components/draggables';
import { getOrEmptyTagFromValue } from '../../../common/components/empty_value';
import { NetworkDetailsLink } from '../../../common/components/links';
import { parseQueryValue } from '../../../timelines/components/timeline/body/renderers/parse_query_value';
Expand Down Expand Up @@ -148,9 +149,11 @@ const AddressLinksItemComponent: React.FC<AddressLinksItemProps> = ({
<Provider dataProvider={dataProviderProp} />
</DragEffects>
) : (
<NetworkDetailsLink data-test-subj="network-details" ip={address} />
<Content field={fieldName} tooltipContent={address}>
<NetworkDetailsLink data-test-subj="network-details" ip={address} />
</Content>
),
[address, dataProviderProp]
[address, dataProviderProp, fieldName]
);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ const FormattedFieldValueComponent: React.FC<{
contextId={contextId}
fieldName={fieldName}
value={!isNumber(value) ? value : String(value)}
truncate={truncate}
/>
);
} else if (fieldType === DATE_FIELD_TYPE) {
Expand Down