Skip to content

Commit

Permalink
[8.x] [Security Solution] remove isDraggable props + various related …
Browse files Browse the repository at this point in the history
…cleanups (#207959) (#210116)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Security Solution] remove isDraggable props + various related
cleanups (#207959)](#207959)

<!--- Backport version: 9.6.4 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Philippe
Oberti","email":"philippe.oberti@elastic.co"},"sourceCommit":{"committedDate":"2025-02-06T21:56:09Z","message":"[Security
Solution] remove isDraggable props + various related cleanups
(#207959)\n\n## Summary\r\n\r\nThis PR removes the `isDraggable` prop
throughout Security Solution.\r\nUnless I'm mistaken, this property
isn't necessary anymore, as we do not\r\nuse those draggable elements
anymore. From what I could see, we had its\r\nvalue set to `false`
everywhere.\r\n\r\nThis lead to a lot of files impacted, but most of
them have only a\r\ncouple of lines changed. In some files though,
removing the\r\n`isDraggable` prop allowed to remove more code than
became obsolete.\r\n\r\n**No UI changes should have been introduced in
this PR!**\r\n\r\n### What this PR does\r\n\r\n- removes `isDraggable`
everywhere\r\n- performs the extra small cleanup when obvious\r\n-
updates all corresponding unit e2e and tests\r\n\r\n### What this PR
does\r\n\r\n- rename files or component names to limit the already
extensive impact\r\nof the code
change","sha":"ebb31d249f5d940fac6188230c03b8435ddb26ca","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Threat
Hunting:Investigations","backport:version","v9.1.0","v8.19.0"],"title":"[Security
Solution] remove isDraggable props + various related
cleanups","number":207959,"url":"https://github.com/elastic/kibana/pull/207959","mergeCommit":{"message":"[Security
Solution] remove isDraggable props + various related cleanups
(#207959)\n\n## Summary\r\n\r\nThis PR removes the `isDraggable` prop
throughout Security Solution.\r\nUnless I'm mistaken, this property
isn't necessary anymore, as we do not\r\nuse those draggable elements
anymore. From what I could see, we had its\r\nvalue set to `false`
everywhere.\r\n\r\nThis lead to a lot of files impacted, but most of
them have only a\r\ncouple of lines changed. In some files though,
removing the\r\n`isDraggable` prop allowed to remove more code than
became obsolete.\r\n\r\n**No UI changes should have been introduced in
this PR!**\r\n\r\n### What this PR does\r\n\r\n- removes `isDraggable`
everywhere\r\n- performs the extra small cleanup when obvious\r\n-
updates all corresponding unit e2e and tests\r\n\r\n### What this PR
does\r\n\r\n- rename files or component names to limit the already
extensive impact\r\nof the code
change","sha":"ebb31d249f5d940fac6188230c03b8435ddb26ca"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/207959","number":207959,"mergeCommit":{"message":"[Security
Solution] remove isDraggable props + various related cleanups
(#207959)\n\n## Summary\r\n\r\nThis PR removes the `isDraggable` prop
throughout Security Solution.\r\nUnless I'm mistaken, this property
isn't necessary anymore, as we do not\r\nuse those draggable elements
anymore. From what I could see, we had its\r\nvalue set to `false`
everywhere.\r\n\r\nThis lead to a lot of files impacted, but most of
them have only a\r\ncouple of lines changed. In some files though,
removing the\r\n`isDraggable` prop allowed to remove more code than
became obsolete.\r\n\r\n**No UI changes should have been introduced in
this PR!**\r\n\r\n### What this PR does\r\n\r\n- removes `isDraggable`
everywhere\r\n- performs the extra small cleanup when obvious\r\n-
updates all corresponding unit e2e and tests\r\n\r\n### What this PR
does\r\n\r\n- rename files or component names to limit the already
extensive impact\r\nof the code
change","sha":"ebb31d249f5d940fac6188230c03b8435ddb26ca"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->
  • Loading branch information
PhilippeOberti authored Feb 7, 2025
1 parent 9bb20df commit 8c14955
Show file tree
Hide file tree
Showing 211 changed files with 1,998 additions and 6,692 deletions.
2 changes: 0 additions & 2 deletions packages/kbn-babel-preset/styled_components_files.js

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 @@ -39096,9 +39096,6 @@
"xpack.securitySolution.dragAndDrop.copyToClipboardTooltip": "Copier dans le Presse-papiers",
"xpack.securitySolution.dragAndDrop.draggableKeyboardInstructionsNotDraggingScreenReaderOnly": "Appuyez sur Entrée pour accéder aux options ou sur la barre d'espace pour commencer le glisser-déposer.",
"xpack.securitySolution.dragAndDrop.fieldLabel": "Champ",
"xpack.securitySolution.draggables.field.categoryLabel": "Catégorie",
"xpack.securitySolution.draggables.field.fieldLabel": "Champ",
"xpack.securitySolution.draggables.field.typeLabel": "Type",
"xpack.securitySolution.editDataProvider.doesNotExistLabel": "n'existe pas",
"xpack.securitySolution.editDataProvider.existsLabel": "existe",
"xpack.securitySolution.editDataProvider.fieldLabel": "Champ",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38952,9 +38952,6 @@
"xpack.securitySolution.dragAndDrop.copyToClipboardTooltip": "クリップボードにコピー",
"xpack.securitySolution.dragAndDrop.draggableKeyboardInstructionsNotDraggingScreenReaderOnly": "オプションは Enter キーを押します。ドラッグを開始するには、スペースを押します。",
"xpack.securitySolution.dragAndDrop.fieldLabel": "フィールド",
"xpack.securitySolution.draggables.field.categoryLabel": "カテゴリー",
"xpack.securitySolution.draggables.field.fieldLabel": "フィールド",
"xpack.securitySolution.draggables.field.typeLabel": "型",
"xpack.securitySolution.editDataProvider.doesNotExistLabel": "存在しない",
"xpack.securitySolution.editDataProvider.existsLabel": "存在する",
"xpack.securitySolution.editDataProvider.fieldLabel": "フィールド",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39048,9 +39048,6 @@
"xpack.securitySolution.dragAndDrop.copyToClipboardTooltip": "复制到剪贴板",
"xpack.securitySolution.dragAndDrop.draggableKeyboardInstructionsNotDraggingScreenReaderOnly": "按 enter 键可显示选项,或按空格键开始拖动。",
"xpack.securitySolution.dragAndDrop.fieldLabel": "字段",
"xpack.securitySolution.draggables.field.categoryLabel": "类别",
"xpack.securitySolution.draggables.field.fieldLabel": "字段",
"xpack.securitySolution.draggables.field.typeLabel": "类型",
"xpack.securitySolution.editDataProvider.doesNotExistLabel": "不存在",
"xpack.securitySolution.editDataProvider.existsLabel": "存在",
"xpack.securitySolution.editDataProvider.fieldLabel": "字段",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export type CellValueElementProps = EuiDataGridCellValueElementProps & {
ecsData?: Ecs;
eventId: string; // _id
header: ColumnHeaderOptions;
isDraggable: boolean;
isTimeline?: boolean; // Default cell renderer is used for both the alert table and timeline. This allows us to cheaply separate concerns
linkValues: string[] | undefined;
rowRenderers?: RowRenderer[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@ export interface RowRenderer {
renderRow: ({
contextId,
data,
isDraggable,
scopeId,
}: {
contextId?: string;
data: Ecs;
isDraggable: boolean;
scopeId: string;
}) => React.ReactNode;
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ interface HostPanelProps extends Record<string, unknown> {
contextID: string;
scopeId: string;
hostName: string;
isDraggable?: boolean;
}

interface HostPanelExpandableFlyoutProps extends FlyoutPanelProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ export const getFieldMarkdownRenderer = (disableActions: boolean) => {
eventId=""
iconType={icon}
isAggregatable={false}
isDraggable={false}
field={name}
value={value}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ const DraggableLegendItemComponent: React.FC<{
field={field}
hideTopN={true}
id={dataProviderId}
isDraggable={false}
scopeId={scopeId}
value={value}
>
Expand Down

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

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,7 @@ import { TestProviders } from '../../mock';
import { mockDataProviders } from '../../../timelines/components/timeline/data_providers/mock/mock_data_providers';
import { ROW_RENDERER_BROWSER_EXAMPLE_TIMELINE_ID } from '../../../timelines/components/row_renderers_browser/constants';
import { DragDropContextWrapper } from './drag_drop_context_wrapper';
import {
ConditionalPortal,
disableHoverActions,
DraggableWrapper,
getStyle,
} from './draggable_wrapper';
import { disableHoverActions, DraggableWrapper, getStyle } from './draggable_wrapper';
import { useMountAppended } from '../../utils/use_mount_appended';
import { TimelineId } from '../../../../common/types';
import { TableId } from '@kbn/securitysolution-data-table';
Expand Down Expand Up @@ -85,11 +80,7 @@ describe('DraggableWrapper', () => {
const wrapper = shallow(
<TestProviders>
<DragDropContextWrapper browserFields={mockBrowserFields}>
<DraggableWrapper
dataProvider={dataProvider}
isDraggable={true}
render={() => message}
/>
<DraggableWrapper dataProvider={dataProvider} render={() => message} />
</DragDropContextWrapper>
</TestProviders>
);
Expand All @@ -101,11 +92,7 @@ describe('DraggableWrapper', () => {
const wrapper = mount(
<TestProviders>
<DragDropContextWrapper browserFields={mockBrowserFields}>
<DraggableWrapper
dataProvider={dataProvider}
isDraggable={true}
render={() => message}
/>
<DraggableWrapper dataProvider={dataProvider} render={() => message} />
</DragDropContextWrapper>
</TestProviders>
);
Expand All @@ -115,14 +102,11 @@ describe('DraggableWrapper', () => {

scopeIdsWithHoverActions.forEach((scopeId) => {
test(`it renders hover actions (by default) when 'isDraggable' is false and timelineId is '${scopeId}'`, async () => {
const isDraggable = false;

const { queryByTestId } = render(
<TestProviders>
<DragDropContextWrapper browserFields={mockBrowserFields}>
<DraggableWrapper
dataProvider={dataProvider}
isDraggable={isDraggable}
render={() => message}
scopeId={scopeId}
/>
Expand All @@ -136,14 +120,11 @@ describe('DraggableWrapper', () => {

scopeIdsNoHoverActions.forEach((scopeId) => {
test(`it does NOT render hover actions when 'isDraggable' is false and timelineId is '${scopeId}'`, async () => {
const isDraggable = false;

const { queryByTestId } = render(
<TestProviders>
<DragDropContextWrapper browserFields={mockBrowserFields}>
<DraggableWrapper
dataProvider={dataProvider}
isDraggable={isDraggable}
render={() => message}
scopeId={scopeId}
/>
Expand All @@ -161,30 +142,19 @@ describe('DraggableWrapper', () => {
const wrapper = mount(
<TestProviders>
<DragDropContextWrapper browserFields={mockBrowserFields}>
<DraggableWrapper
dataProvider={dataProvider}
isDraggable={true}
render={() => message}
truncate
/>
<DraggableWrapper dataProvider={dataProvider} render={() => message} truncate />
</DragDropContextWrapper>
</TestProviders>
);

expect(wrapper.find('[data-test-subj="draggable-truncatable-content"]').exists()).toEqual(
true
);
expect(wrapper.find('[data-test-subj="render-truncatable-content"]').exists()).toEqual(true);
});

test('it does NOT apply text truncation styling when truncate is NOT specified', () => {
const wrapper = mount(
<TestProviders>
<DragDropContextWrapper browserFields={mockBrowserFields}>
<DraggableWrapper
dataProvider={dataProvider}
isDraggable={true}
render={() => message}
/>
<DraggableWrapper dataProvider={dataProvider} render={() => message} />
</DragDropContextWrapper>
</TestProviders>
);
Expand All @@ -197,21 +167,6 @@ describe('DraggableWrapper', () => {
});

describe('ConditionalPortal', () => {
const mount = useMountAppended();
const props = {
registerProvider: jest.fn(),
};

it('calls registerProvider when isDragging', () => {
mount(
<ConditionalPortal {...props}>
<div />
</ConditionalPortal>
);

expect(props.registerProvider.mock.calls.length).toEqual(1);
});

describe('getStyle', () => {
const style: DraggingStyle = {
boxSizing: 'border-box',
Expand Down
Loading

0 comments on commit 8c14955

Please sign in to comment.