Skip to content

Commit

Permalink
[8.x] [Security Solution][Expandable flyout] - remove unused code (#2…
Browse files Browse the repository at this point in the history
…01477) (#204153)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Security Solution][Expandable flyout] - remove unused code
(#201477)](#201477)

<!--- Backport version: 8.9.8 -->

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

<!--BACKPORT [{"author":{"name":"Philippe
Oberti","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-27T17:59:01Z","message":"[Security
Solution][Expandable flyout] - remove unused code (#201477)\n\n##
Summary\r\n\r\nSome code was added in
[this\r\nPR](#189633) to allow
the\r\nexpandable flyout to be used in the OneDiscover context. Later
on, [this\r\nPR](#198294) reverted
most of the\r\nchanges, but some files remained.\r\n\r\nThis PR cleans
up all the files (that I could find) that are now\r\nunnecessary and
unused","sha":"7ebd1506ff23828095f6bd3b131a22577ad960fe","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:Threat
Hunting:Investigations","backport:version","v8.17.0"],"number":201477,"url":"https://github.com/elastic/kibana/pull/201477","mergeCommit":{"message":"[Security
Solution][Expandable flyout] - remove unused code (#201477)\n\n##
Summary\r\n\r\nSome code was added in
[this\r\nPR](#189633) to allow
the\r\nexpandable flyout to be used in the OneDiscover context. Later
on, [this\r\nPR](#198294) reverted
most of the\r\nchanges, but some files remained.\r\n\r\nThis PR cleans
up all the files (that I could find) that are now\r\nunnecessary and
unused","sha":"7ebd1506ff23828095f6bd3b131a22577ad960fe"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","labelRegex":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/201477","number":201477,"mergeCommit":{"message":"[Security
Solution][Expandable flyout] - remove unused code (#201477)\n\n##
Summary\r\n\r\nSome code was added in
[this\r\nPR](#189633) to allow
the\r\nexpandable flyout to be used in the OneDiscover context. Later
on, [this\r\nPR](#198294) reverted
most of the\r\nchanges, but some files remained.\r\n\r\nThis PR cleans
up all the files (that I could find) that are now\r\nunnecessary and
unused","sha":"7ebd1506ff23828095f6bd3b131a22577ad960fe"}},{"branch":"8.17","label":"v8.17.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/202047","number":202047,"state":"MERGED","mergeCommit":{"sha":"a4b919479a733a6a97b2b35b49f99bed5589f3fa","message":"[8.17]
[Security Solution][Expandable flyout] - remove unused code (#201477)
(#202047)\n\n# Backport\n\nThis will backport the following commits from
`main` to `8.17`:\n- [[Security Solution][Expandable flyout] - remove
unused
code\n(#201477)](https://github.com/elastic/kibana/pull/201477)\n\n<!---
Backport version: 9.4.3 -->\n\n### Questions ?\nPlease refer to the
[Backport
tool\ndocumentation](https://github.com/sqren/backport)\n\n<!--BACKPORT
[{\"author\":{\"name\":\"Philippe\nOberti\",\"email\":\"[email protected]\"},\"sourceCommit\":{\"committedDate\":\"2024-11-27T17:59:01Z\",\"message\":\"[Security\nSolution][Expandable
flyout] - remove unused code (#201477)\\n\\n##\nSummary\\r\\n\\r\\nSome
code was added
in\n[this\\r\\nPR](#189633) to
allow\nthe\\r\\nexpandable flyout to be used in the OneDiscover context.
Later\non, [this\\r\\nPR](#198294)
reverted\nmost of the\\r\\nchanges, but some files
remained.\\r\\n\\r\\nThis PR cleans\nup all the files (that I could
find) that are now\\r\\nunnecessary
and\nunused\",\"sha\":\"7ebd1506ff23828095f6bd3b131a22577ad960fe\",\"branchLabelMapping\":{\"^v9.0.0$\":\"main\",\"^v8.18.0$\":\"8.x\",\"^v(\\\\d+).(\\\\d+).\\\\d+$\":\"$1.$2\"}},\"sourcePullRequest\":{\"labels\":[\"release_note:skip\",\"v9.0.0\",\"Team:Threat\nHunting:Investigations\",\"backport:version\",\"v8.17.0\"],\"title\":\"[Security\nSolution][Expandable
flyout] - remove
unused\ncode\",\"number\":201477,\"url\":\"https://github.com/elastic/kibana/pull/201477\",\"mergeCommit\":{\"message\":\"[Security\nSolution][Expandable
flyout] - remove unused code (#201477)\\n\\n##\nSummary\\r\\n\\r\\nSome
code was added
in\n[this\\r\\nPR](#189633) to
allow\nthe\\r\\nexpandable flyout to be used in the OneDiscover context.
Later\non, [this\\r\\nPR](#198294)
reverted\nmost of the\\r\\nchanges, but some files
remained.\\r\\n\\r\\nThis PR cleans\nup all the files (that I could
find) that are now\\r\\nunnecessary
and\nunused\",\"sha\":\"7ebd1506ff23828095f6bd3b131a22577ad960fe\"}},\"sourceBranch\":\"main\",\"suggestedTargetBranches\":[\"8.17\"],\"targetPullRequestStates\":[{\"branch\":\"main\",\"label\":\"v9.0.0\",\"branchLabelMappingKey\":\"^v9.0.0$\",\"isSourceBranch\":true,\"state\":\"MERGED\",\"url\":\"https://github.com/elastic/kibana/pull/201477\",\"number\":201477,\"mergeCommit\":{\"message\":\"[Security\nSolution][Expandable
flyout] - remove unused code (#201477)\\n\\n##\nSummary\\r\\n\\r\\nSome
code was added
in\n[this\\r\\nPR](#189633) to
allow\nthe\\r\\nexpandable flyout to be used in the OneDiscover context.
Later\non, [this\\r\\nPR](#198294)
reverted\nmost of the\\r\\nchanges, but some files
remained.\\r\\n\\r\\nThis PR cleans\nup all the files (that I could
find) that are now\\r\\nunnecessary
and\nunused\",\"sha\":\"7ebd1506ff23828095f6bd3b131a22577ad960fe\"}},{\"branch\":\"8.17\",\"label\":\"v8.17.0\",\"branchLabelMappingKey\":\"^v(\\\\d+).(\\\\d+).\\\\d+$\",\"isSourceBranch\":false,\"state\":\"NOT_CREATED\"}]}]\nBACKPORT-->\n\nCo-authored-by:
Philippe Oberti <[email protected]>"}}]}] BACKPORT-->
  • Loading branch information
PhilippeOberti authored Dec 13, 2024
1 parent dcd90e8 commit 94144be
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 112 deletions.
29 changes: 0 additions & 29 deletions packages/kbn-expandable-flyout/__mocks__/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,8 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import React from 'react';
import type { IStorage } from '@kbn/kibana-utils-plugin/public';

export const useExpandableFlyoutApi = jest.fn(() => ({
openFlyout: jest.fn(),
closeFlyout: jest.fn(),
openPanels: jest.fn(),
openRightPanel: jest.fn(),
openLeftPanel: jest.fn(),
openPreviewPanel: jest.fn(),
closeRightPanel: jest.fn(),
closeLeftPanel: jest.fn(),
closePreviewPanel: jest.fn(),
closePanels: jest.fn(),
previousPreviewPanel: jest.fn(),
}));

export const useExpandableFlyoutState = jest.fn();

export const ExpandableFlyoutProvider = jest.fn(({ children }: React.PropsWithChildren<{}>) => {
return <>{children}</>;
});

export const withExpandableFlyoutProvider = <T extends object>(
Component: React.ComponentType<T>
) => {
return (props: T) => {
return <Component {...props} />;
};
};

export const ExpandableFlyout = jest.fn();

export const localStorageMock = (): IStorage => {
Expand Down
1 change: 0 additions & 1 deletion packages/kbn-expandable-flyout/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export { useExpandableFlyoutHistory } from './src/hooks/use_expandable_flyout_hi
export { type FlyoutPanels as ExpandableFlyoutState } from './src/store/state';

export { ExpandableFlyoutProvider } from './src/provider';
export { withExpandableFlyoutProvider } from './src/with_provider';

export type { ExpandableFlyoutProps } from './src';
export type { FlyoutPanelProps, PanelPath, ExpandableFlyoutApi } from './src/types';
30 changes: 0 additions & 30 deletions packages/kbn-expandable-flyout/src/with_provider.test.tsx

This file was deleted.

26 changes: 0 additions & 26 deletions packages/kbn-expandable-flyout/src/with_provider.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
* 2.0.
*/

import React from 'react';

export const createExpandableFlyoutApiMock = () => ({
closeFlyout: jest.fn(),
closeLeftPanel: jest.fn(),
Expand All @@ -18,17 +16,3 @@ export const createExpandableFlyoutApiMock = () => ({
openPreviewPanel: jest.fn(),
openRightPanel: jest.fn(),
});

export const createExpandableFlyoutMock = () => {
return {
useExpandableFlyoutApi: jest.fn().mockReturnValue(createExpandableFlyoutApiMock()),
useExpandableFlyoutState: jest.fn(),
ExpandableFlyoutProvider: ({ children }: React.PropsWithChildren<{}>) => <>{children}</>,
withExpandableFlyoutProvider: <T extends object>(Component: React.ComponentType<T>) => {
return (props: T) => {
return <Component {...props} />;
};
},
ExpandableFlyout: jest.fn(),
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ import { createTelemetryServiceMock } from '../../../../common/lib/telemetry/tel
jest.mock('@kbn/expandable-flyout', () => ({
useExpandableFlyoutApi: jest.fn(),
ExpandableFlyoutProvider: ({ children }: React.PropsWithChildren<{}>) => <>{children}</>,
withExpandableFlyoutProvider: <T extends object>(Component: React.ComponentType<T>) => {
return (props: T) => {
return <Component {...props} />;
};
},
}));

const mockedTelemetry = createTelemetryServiceMock();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ jest.mock('../../../common/lib/kibana', () => {
jest.mock('@kbn/expandable-flyout', () => ({
useExpandableFlyoutApi: jest.fn(),
ExpandableFlyoutProvider: ({ children }: React.PropsWithChildren<{}>) => <>{children}</>,
withExpandableFlyoutProvider: <T extends object>(Component: React.ComponentType<T>) => {
return (props: T) => {
return <Component {...props} />;
};
},
}));

const renderPreviewLink = (field: string, value: string, dataTestSuj?: string) =>
Expand Down

0 comments on commit 94144be

Please sign in to comment.