Skip to content

Commit

Permalink
[8.17] [Security Solution][Expandable flyout] - remove unused code (#…
Browse files Browse the repository at this point in the history
…201477) (#202047)

# Backport

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

<!--- Backport version: 9.4.3 -->

### 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"],"title":"[Security
Solution][Expandable flyout] - remove unused
code","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":["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
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","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Philippe Oberti <[email protected]>
  • Loading branch information
kibanamachine and PhilippeOberti authored Nov 27, 2024
1 parent 29aec64 commit a4b9194
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 @@ -15,7 +15,6 @@ export { useExpandableFlyoutState } from './src/hooks/use_expandable_flyout_stat
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 a4b9194

Please sign in to comment.