[Security Solution] remove unneeded expandable flyout Storybook stories (#168046)

This commit is contained in:
Philippe Oberti 2023-10-09 09:46:26 -05:00 committed by GitHub
parent 1da69209bc
commit a18b523769
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 0 additions and 327 deletions

View file

@ -1,55 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import React from 'react';
import type { Story } from '@storybook/react';
import { ExpandableFlyoutContext } from '@kbn/expandable-flyout/src/context';
import { HighlightedFields } from './highlighted_fields';
import { RightPanelContext } from '../context';
export default {
component: HighlightedFields,
title: 'Flyout/HighlightedFields',
};
// TODO ideally we would want to have some data here, but we need to spent some time getting all the foundation items for storybook
// (ReduxStoreProvider, CellActionsProvider...) similarly to how it was done for the TestProvidersComponent
// see ticket https://github.com/elastic/security-team/issues/6223
export const Default: Story<void> = () => {
const flyoutContextValue = {
openRightPanel: () => window.alert('openRightPanel called'),
} as unknown as ExpandableFlyoutContext;
const panelContextValue = {
eventId: 'eventId',
indexName: 'indexName',
dataFormattedForFieldBrowser: [],
browserFields: {},
} as unknown as RightPanelContext;
return (
<ExpandableFlyoutContext.Provider value={flyoutContextValue}>
<RightPanelContext.Provider value={panelContextValue}>
<HighlightedFields />
</RightPanelContext.Provider>
</ExpandableFlyoutContext.Provider>
);
};
export const Empty: Story<void> = () => {
const flyoutContextValue = {} as unknown as ExpandableFlyoutContext;
const panelContextValue = {
eventId: null,
} as unknown as RightPanelContext;
return (
<ExpandableFlyoutContext.Provider value={flyoutContextValue}>
<RightPanelContext.Provider value={panelContextValue}>
<HighlightedFields />
</RightPanelContext.Provider>
</ExpandableFlyoutContext.Provider>
);
};

View file

@ -1,41 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import React from 'react';
import type { Story } from '@storybook/react';
import { mockSearchHit } from '../../shared/mocks/mock_search_hit';
import { RightPanelContext } from '../context';
import { MitreAttack } from './mitre_attack';
export default {
component: MitreAttack,
title: 'Flyout/MitreAttack',
};
export const Default: Story<void> = () => {
const contextValue = { searchHit: mockSearchHit } as unknown as RightPanelContext;
return (
<RightPanelContext.Provider value={contextValue}>
<MitreAttack />
</RightPanelContext.Provider>
);
};
export const Empty: Story<void> = () => {
const contextValue = {
searchHit: {
some_field: 'some_value',
},
} as unknown as RightPanelContext;
return (
<RightPanelContext.Provider value={contextValue}>
<MitreAttack />
</RightPanelContext.Provider>
);
};

View file

@ -1,41 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import React from 'react';
import type { Story } from '@storybook/react';
import { mockGetFieldsData } from '../../shared/mocks/mock_get_fields_data';
import { RiskScore } from './risk_score';
import { RightPanelContext } from '../context';
export default {
component: RiskScore,
title: 'Flyout/RiskScore',
};
export const Default: Story<void> = () => {
const contextValue = {
getFieldsData: mockGetFieldsData,
} as unknown as RightPanelContext;
return (
<RightPanelContext.Provider value={contextValue}>
<RiskScore />
</RightPanelContext.Provider>
);
};
export const Empty: Story<void> = () => {
const contextValue = {
getFieldsData: () => {},
} as unknown as RightPanelContext;
return (
<RightPanelContext.Provider value={contextValue}>
<RiskScore />
</RightPanelContext.Provider>
);
};

View file

@ -1,41 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import React from 'react';
import type { Story } from '@storybook/react';
import { mockGetFieldsData } from '../../shared/mocks/mock_get_fields_data';
import { DocumentSeverity } from './severity';
import { RightPanelContext } from '../context';
export default {
component: DocumentSeverity,
title: 'Flyout/Severity',
};
export const Default: Story<void> = () => {
const contextValue = {
getFieldsData: mockGetFieldsData,
} as unknown as RightPanelContext;
return (
<RightPanelContext.Provider value={contextValue}>
<DocumentSeverity />
</RightPanelContext.Provider>
);
};
export const Empty: Story<void> = () => {
const contextValue = {
getFieldsData: () => {},
} as unknown as RightPanelContext;
return (
<RightPanelContext.Provider value={contextValue}>
<DocumentSeverity />
</RightPanelContext.Provider>
);
};

View file

@ -1,60 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import React from 'react';
import type { Story } from '@storybook/react';
import { ExpandableFlyoutContext } from '@kbn/expandable-flyout/src/context';
import { mockBrowserFields } from '../../shared/mocks/mock_browser_fields';
import { mockDataFormattedForFieldBrowser } from '../../shared/mocks/mock_data_formatted_for_field_browser';
import { StorybookProviders } from '../../../common/mock/storybook_providers';
import { DocumentStatus } from './status';
import { RightPanelContext } from '../context';
export default {
component: DocumentStatus,
title: 'Flyout/Status',
};
const flyoutContextValue = {
closeFlyout: () => {},
} as unknown as ExpandableFlyoutContext;
export const Default: Story<void> = () => {
const contextValue = {
eventId: 'eventId',
browserFields: mockBrowserFields,
dataFormattedForFieldBrowser: mockDataFormattedForFieldBrowser,
scopeId: 'alerts-page',
} as unknown as RightPanelContext;
return (
<StorybookProviders>
<ExpandableFlyoutContext.Provider value={flyoutContextValue}>
<RightPanelContext.Provider value={contextValue}>
<DocumentStatus />
</RightPanelContext.Provider>
</ExpandableFlyoutContext.Provider>
</StorybookProviders>
);
};
export const Empty: Story<void> = () => {
const contextValue = {
eventId: 'eventId',
browserFields: {},
dataFormattedForFieldBrowser: [],
scopeId: 'scopeId',
} as unknown as RightPanelContext;
return (
<ExpandableFlyoutContext.Provider value={flyoutContextValue}>
<RightPanelContext.Provider value={contextValue}>
<DocumentStatus />
</RightPanelContext.Provider>
</ExpandableFlyoutContext.Provider>
);
};

View file

@ -1,42 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import React from 'react';
import type { Story } from '@storybook/react';
import { RightPanelContext } from '../context';
import { JsonTab } from './json_tab';
export default {
component: JsonTab,
title: 'Flyout/JsonTab',
};
export const Default: Story<void> = () => {
const contextValue = {
searchHit: {
some_field: 'some_value',
},
} as unknown as RightPanelContext;
return (
<RightPanelContext.Provider value={contextValue}>
<JsonTab />
</RightPanelContext.Provider>
);
};
export const Error: Story<void> = () => {
const contextValue = {
searchHit: null,
} as unknown as RightPanelContext;
return (
<RightPanelContext.Provider value={contextValue}>
<JsonTab />
</RightPanelContext.Provider>
);
};

View file

@ -1,47 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import React from 'react';
import type { Story } from '@storybook/react';
import { RightPanelContext } from '../context';
import { TableTab } from './table_tab';
export default {
component: TableTab,
title: 'Flyout/TableTab',
};
// TODO to get this working, we need to spent some time getting all the foundation items for storybook
// (ReduxStoreProvider, CellActionsProvider...) similarly to how it was done for the TestProvidersComponent
// see ticket https://github.com/elastic/security-team/issues/6223
// export const Default: Story<void> = () => {
// const contextValue = {
// eventId: 'some_id',
// browserFields: {},
// dataFormattedForFieldBrowser: [],
// } as unknown as RightPanelContext;
//
// return (
// <RightPanelContext.Provider value={contextValue}>
// <TableTab />
// </RightPanelContext.Provider>
// );
// };
export const Error: Story<void> = () => {
const contextValue = {
eventId: null,
browserFields: {},
dataFormattedForFieldBrowser: [],
} as unknown as RightPanelContext;
return (
<RightPanelContext.Provider value={contextValue}>
<TableTab />
</RightPanelContext.Provider>
);
};