Skip to content

Commit

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

## Summary

Some code was added in [this
PR](elastic#189633) to allow the
expandable flyout to be used in the OneDiscover context. Later on, [this
PR](elastic#198294) reverted most of the
changes, but some files remained.

This PR cleans up all the files (that I could find) that are now
unnecessary and unused

(cherry picked from commit 7ebd150)
  • Loading branch information
PhilippeOberti committed Dec 13, 2024
1 parent ddacf27 commit f08224c
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 f08224c

Please sign in to comment.