Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIP] Reorganize table folder within indicators module #142510

Merged
merged 1 commit into from
Oct 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

import React, { useContext, VFC } from 'react';
import { EuiFlexGroup } from '@elastic/eui';
import { InvestigateInTimelineButtonIcon } from '../../../timeline/components/investigate_in_timeline';
import { Indicator } from '../../../../../common/types/indicator';
import { OpenIndicatorFlyoutButton } from '../open_indicator_flyout_button/open_indicator_flyout_button';
import { IndicatorsTableContext } from './context';
import { InvestigateInTimelineButtonIcon } from '../../../../timeline/components/investigate_in_timeline';
import { Indicator } from '../../../../../../common/types/indicator';
import { OpenIndicatorFlyoutButton } from './open_flyout_button';
import { IndicatorsTableContext } from '../contexts';

const INVESTIGATE_TEST_ID = 'tiIndicatorTableInvestigateInTimelineButtonIcon';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@

import React, { VFC } from 'react';
import { EuiDataGridColumnCellActionProps } from '@elastic/eui/src/components/datagrid/data_grid_types';
import { Indicator } from '../../../../../common/types/indicator';
import { AddToTimelineCellAction } from '../../../timeline/components/add_to_timeline';
import { FilterInCellAction } from '../../../query_bar/components/filter_in';
import { FilterOutCellAction } from '../../../query_bar/components/filter_out';
import { fieldAndValueValid, getIndicatorFieldAndValue } from '../../utils/field_value';
import type { Pagination } from '../../services/fetch_indicators';
import { Indicator } from '../../../../../../common/types/indicator';
import { AddToTimelineCellAction } from '../../../../timeline/components/add_to_timeline';
import { FilterInCellAction } from '../../../../query_bar/components/filter_in';
import { FilterOutCellAction } from '../../../../query_bar/components/filter_out';
import { fieldAndValueValid, getIndicatorFieldAndValue } from '../../../utils/field_value';
import type { Pagination } from '../../../services/fetch_indicators';

export const CELL_TIMELINE_BUTTON_TEST_ID = 'tiIndicatorsTableCellTimelineButton';
export const CELL_FILTER_IN_BUTTON_TEST_ID = 'tiIndicatorsTableCellFilterInButton';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@
*/

import { EuiDataGridCellValueElementProps } from '@elastic/eui';
import { useContext, useEffect } from 'react';
import { euiLightVars as themeLight, euiDarkVars as themeDark } from '@kbn/ui-theme';
import React from 'react';
import { useKibana } from '../../../../hooks/use_kibana';
import { Indicator } from '../../../../../common/types/indicator';
import { IndicatorFieldValue } from '../indicator_field_value';
import { IndicatorsTableContext } from './context';
import { ActionsRowCell } from './actions_row_cell';
import React, { useContext, useEffect } from 'react';
import { euiDarkVars as themeDark, euiLightVars as themeLight } from '@kbn/ui-theme';
import { useKibana } from '../../../../../hooks/use_kibana';
import { Indicator } from '../../../../../../common/types/indicator';
import { IndicatorFieldValue } from '../../indicator_field_value';
import { IndicatorsTableContext } from '../contexts';
import { ActionsRowCell } from '.';

export const cellRendererFactory = (from: number) => {
return ({ rowIndex, columnId, setCellProps }: EuiDataGridCellValueElementProps) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
import {
mockedTriggersActionsUiService,
TestProvidersComponent,
} from '../../../../common/mocks/test_providers';
} from '../../../../../../common/mocks/test_providers';
import { render } from '@testing-library/react';
import React from 'react';
import { IndicatorsFieldBrowser } from './indicators_field_browser';
import { IndicatorsFieldBrowser } from '.';

const stub = jest.fn();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import { BrowserField } from '@kbn/rule-registry-plugin/common';
import { VFC } from 'react';
import { useKibana } from '../../../../hooks/use_kibana';
import { useKibana } from '../../../../../../hooks/use_kibana';

export interface IndicatorsFieldBrowserProps {
browserFields: Readonly<Record<string, Partial<BrowserField>>>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
* 2.0.
*/

export * from './indicators_field_browser';
export * from './field_browser';
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* 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.
*/

export * from './actions_row_cell';
export * from './cell_actions';
export * from './cell_renderer';
export * from './field_browser';
export * from './open_flyout_button';
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
* 2.0.
*/

export * from './open_indicator_flyout_button';
export * from './open_flyout_button';
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
import React from 'react';
import { ComponentStory } from '@storybook/react';
import { createKibanaReactContext } from '@kbn/kibana-react-plugin/public';
import { mockUiSettingsService } from '../../../../common/mocks/mock_kibana_ui_settings_service';
import { generateMockIndicator, Indicator } from '../../../../../common/types/indicator';
import { OpenIndicatorFlyoutButton } from './open_indicator_flyout_button';
import { mockUiSettingsService } from '../../../../../../common/mocks/mock_kibana_ui_settings_service';
import { generateMockIndicator, Indicator } from '../../../../../../../common/types/indicator';
import { OpenIndicatorFlyoutButton } from '.';

export default {
component: OpenIndicatorFlyoutButton,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

import React from 'react';
import { render } from '@testing-library/react';
import { BUTTON_TEST_ID, OpenIndicatorFlyoutButton } from './open_indicator_flyout_button';
import { generateMockIndicator } from '../../../../../common/types/indicator';
import { TestProvidersComponent } from '../../../../common/mocks/test_providers';
import { BUTTON_TEST_ID, OpenIndicatorFlyoutButton } from '.';
import { generateMockIndicator } from '../../../../../../../common/types/indicator';
import { TestProvidersComponent } from '../../../../../../common/mocks/test_providers';

const mockIndicator = generateMockIndicator();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import React, { VFC } from 'react';
import { EuiButtonIcon, EuiToolTip } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { Indicator } from '../../../../../common/types/indicator';
import { Indicator } from '../../../../../../../common/types/indicator';

export const BUTTON_TEST_ID = 'tiToggleIndicatorFlyoutButton';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import { createContext, Dispatch, SetStateAction } from 'react';
import { Indicator } from '../../../../../common/types/indicator';
import { Indicator } from '../../../../../../common/types/indicator';

export interface IndicatorsTableContextValue {
expanded: Indicator | undefined;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* 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.
*/

export * from './context';
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* 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.
*/

export * from './use_column_settings';
export * from './use_toolbar_options';
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import { mockedServices, TestProvidersComponent } from '../../../../../common/mocks/test_providers';
import { act, renderHook } from '@testing-library/react-hooks';
import { useColumnSettings } from './use_column_settings';
import { useColumnSettings } from '.';

const renderUseColumnSettings = () =>
renderHook(() => useColumnSettings(), { wrapper: TestProvidersComponent });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import { TestProvidersComponent } from '../../../../../common/mocks/test_providers';
import { renderHook } from '@testing-library/react-hooks';
import { useToolbarOptions } from './use_toolbar_options';
import { useToolbarOptions } from '.';

describe('useToolbarOptions()', () => {
it('should return correct value for 0 indicators total', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
* 2.0.
*/

import React from 'react';
import { useMemo } from 'react';
import React, { useMemo } from 'react';
import { EuiButtonIcon, EuiDataGridColumn, EuiText } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { BrowserField } from '@kbn/rule-registry-plugin/common';
import { useInspector } from '../../../../../hooks/use_inspector';
import { IndicatorsFieldBrowser } from '../../indicators_field_browser';
import { IndicatorsFieldBrowser } from '../components';

const INSPECT_BUTTON_TEST_ID = 'tiIndicatorsGridInspect';

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

export * from './indicators_table';
export * from './table';
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import { DataView } from '@kbn/data-views-plugin/common';
import { mockIndicatorsFiltersContext } from '../../../../common/mocks/mock_indicators_filters_context';
import { StoryProvidersComponent } from '../../../../common/mocks/story_providers';
import { generateMockIndicator, Indicator } from '../../../../../common/types/indicator';
import { IndicatorsTable } from './indicators_table';
import { IndicatorsTable } from '.';
import { IndicatorsFiltersContext } from '../../containers/indicators_filters/context';
import { DEFAULT_COLUMNS } from './hooks/use_column_settings';
import { DEFAULT_COLUMNS } from './hooks';

export default {
component: IndicatorsTable,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,10 @@

import { act, render, screen } from '@testing-library/react';
import React from 'react';
import {
IndicatorsTable,
IndicatorsTableProps,
TABLE_UPDATE_PROGRESS_TEST_ID,
} from './indicators_table';
import { IndicatorsTable, IndicatorsTableProps, TABLE_UPDATE_PROGRESS_TEST_ID } from '.';
import { TestProvidersComponent } from '../../../../common/mocks/test_providers';
import { generateMockIndicator, Indicator } from '../../../../../common/types/indicator';
import { BUTTON_TEST_ID } from '../open_indicator_flyout_button';
import { BUTTON_TEST_ID } from './components/open_flyout_button';
import { TITLE_TEST_ID } from '../flyout';
import { SecuritySolutionDataViewBase } from '../../../../types';

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

import React, { VFC, useState, useMemo } from 'react';
import React, { useMemo, useState, VFC } from 'react';
import {
EuiDataGrid,
EuiDataGridColumnCellActionProps,
Expand All @@ -19,15 +19,13 @@ import {

import { FormattedMessage } from '@kbn/i18n-react';
import { EuiDataGridColumn } from '@elastic/eui/src/components/datagrid/data_grid_types';
import { CellActions } from './cell_actions';
import { CellActions, cellRendererFactory } from './components';
import { BrowserFields, SecuritySolutionDataViewBase } from '../../../../types';
import { Indicator, RawIndicatorFieldId } from '../../../../../common/types/indicator';
import { cellRendererFactory } from './cell_renderer';
import { EmptyState } from '../../../../components/empty_state';
import { IndicatorsTableContext, IndicatorsTableContextValue } from './context';
import { IndicatorsTableContext, IndicatorsTableContextValue } from './contexts';
import { IndicatorsFlyout } from '../flyout';
import { useToolbarOptions } from './hooks/use_toolbar_options';
import { ColumnSettingsValue } from './hooks/use_column_settings';
import { ColumnSettingsValue, useToolbarOptions } from './hooks';
import { useFieldTypes } from '../../../../hooks/use_field_types';
import { getFieldSchema } from '../../utils/get_field_schema';
import { Pagination } from '../../services/fetch_indicators';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { useAggregatedIndicators } from './hooks/use_aggregated_indicators';
import { useFilters } from '../query_bar/hooks/use_filters';
import moment from 'moment';
import { TestProvidersComponent } from '../../common/mocks/test_providers';
import { TABLE_TEST_ID } from './components/indicators_table';
import { TABLE_TEST_ID } from './components/table';
import { mockTimeRange } from '../../common/mocks/mock_indicators_filters_context';

jest.mock('../query_bar/hooks/use_filters');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
import React, { FC, VFC } from 'react';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { IndicatorsBarChartWrapper } from './components/barchart';
import { IndicatorsTable } from './components/indicators_table/indicators_table';
import { IndicatorsTable } from './components/table';
import { useIndicators } from './hooks/use_indicators';
import { DefaultPageLayout } from '../../components/layout';
import { useFilters } from '../query_bar/hooks/use_filters';
import { FiltersGlobal } from '../../containers/filters_global';
import { useSourcererDataView } from './hooks/use_sourcerer_data_view';
import { FieldTypesProvider } from '../../containers/field_types_provider';
import { InspectorProvider } from '../../containers/inspector';
import { useColumnSettings } from './components/indicators_table/hooks/use_column_settings';
import { useColumnSettings } from './components/table/hooks';
import { useAggregatedIndicators } from './hooks/use_aggregated_indicators';
import { IndicatorsFilters } from './containers/indicators_filters';
import { useSecurityContext } from '../../hooks/use_security_context';
Expand Down