Skip to content

Commit

Permalink
[Security Solution][DQD][Tech Debt] flatten data_quality_panel scaffold
Browse files Browse the repository at this point in the history
addresses elastic#190964

First in the series of PRs to address general DQD tech debt

This one flattens and makes structure a little more logical

- rename top level data_quality/ folder to data_quality_panel/ in line
  with the actual component name in index.tsx
- remove redundant nested data_quality_panel/ folder
  • Loading branch information
kapral18 committed Aug 26, 2024
1 parent 3db781d commit 9870e20
Show file tree
Hide file tree
Showing 210 changed files with 262 additions and 265 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { AddToNewCaseAction } from '.';
import {
TestDataQualityProviders,
TestExternalProviders,
} from '../../../mock/test_providers/test_providers';
} from '../../mock/test_providers/test_providers';
import userEvent from '@testing-library/user-event';

describe('AddToNewCaseAction', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import React, { useCallback } from 'react';
import { EuiIcon, EuiLink } from '@elastic/eui';

import { useDataQualityContext } from '../../data_quality_context';
import { useAddToNewCase } from '../../../use_add_to_new_case';
import { useAddToNewCase } from '../../use_add_to_new_case';
import { StyledLinkText } from '../styles';
import { ADD_TO_NEW_CASE } from '../../../translations';
import { ADD_TO_NEW_CASE } from '../../translations';

interface Props {
markdownComment: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { ChatAction } from '.';
import {
TestDataQualityProviders,
TestExternalProviders,
} from '../../../mock/test_providers/test_providers';
} from '../../mock/test_providers/test_providers';

describe('ChatAction', () => {
it('should render new chat link', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
DATA_QUALITY_PROMPT_CONTEXT_PILL,
DATA_QUALITY_PROMPT_CONTEXT_PILL_TOOLTIP,
DATA_QUALITY_SUGGESTED_USER_PROMPT,
} from '../../../translations';
} from '../../translations';
import { useDataQualityContext } from '../../data_quality_context';
import { ASK_ASSISTANT } from './translations';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { CopyToClipboardAction } from '.';
import {
TestDataQualityProviders,
TestExternalProviders,
} from '../../../mock/test_providers/test_providers';
} from '../../mock/test_providers/test_providers';

jest.mock('@elastic/eui', () => {
const original = jest.requireActual('@elastic/eui');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import React, { useCallback } from 'react';
import { EuiIcon, EuiLink, copyToClipboard } from '@elastic/eui';

import { useDataQualityContext } from '../../data_quality_context';
import { COPIED_RESULTS_TOAST_TITLE, COPY_TO_CLIPBOARD } from '../../../translations';
import { COPIED_RESULTS_TOAST_TITLE, COPY_TO_CLIPBOARD } from '../../translations';
import { StyledLinkText } from '../styles';

interface Props {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { Actions } from '.';
import {
TestDataQualityProviders,
TestExternalProviders,
} from '../../mock/test_providers/test_providers';
} from '../mock/test_providers/test_providers';

describe('Actions', () => {
it('renders nothing by default', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { EcsFlatTyped } from '../../constants';
import { EcsFlatTyped } from '../constants';
import { getUnallowedValueRequestItems, getValidValues, hasAllowedValues } from './helpers';

describe('helpers', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* 2.0.
*/

import type { EcsFlatTyped } from '../../constants';
import type { EcsFieldMetadata, UnallowedValueRequestItem } from '../../types';
import type { EcsFlatTyped } from '../constants';
import type { EcsFieldMetadata, UnallowedValueRequestItem } from '../types';

export const hasAllowedValues = ({
ecsMetadata,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import React from 'react';
import {
TestDataQualityProviders,
TestExternalProviders,
} from '../../../mock/test_providers/test_providers';
} from '../../mock/test_providers/test_providers';
import { DataQualityDetails } from '.';

const ilmPhases = ['hot', 'warm', 'unmanaged'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

import React, { useCallback, useState } from 'react';

import { IlmPhasesEmptyPrompt } from '../../../ilm_phases_empty_prompt';
import { IlmPhasesEmptyPrompt } from '../../ilm_phases_empty_prompt';
import { IndicesDetails } from './indices_details';
import { StorageDetails } from './storage_details';
import { SelectedIndex } from '../../../types';
import { SelectedIndex } from '../../types';
import { useDataQualityContext } from '../../data_quality_context';

const DataQualityDetailsComponent: React.FC = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ import numeral from '@elastic/numeral';
import { render, screen, waitFor } from '@testing-library/react';
import React from 'react';

import { EMPTY_STAT } from '../../../../helpers';
import { alertIndexWithAllResults } from '../../../../mock/pattern_rollup/mock_alerts_pattern_rollup';
import { auditbeatWithAllResults } from '../../../../mock/pattern_rollup/mock_auditbeat_pattern_rollup';
import { packetbeatNoResults } from '../../../../mock/pattern_rollup/mock_packetbeat_pattern_rollup';
import { EMPTY_STAT } from '../../../helpers';
import { alertIndexWithAllResults } from '../../../mock/pattern_rollup/mock_alerts_pattern_rollup';
import { auditbeatWithAllResults } from '../../../mock/pattern_rollup/mock_auditbeat_pattern_rollup';
import { packetbeatNoResults } from '../../../mock/pattern_rollup/mock_packetbeat_pattern_rollup';
import {
TestDataQualityProviders,
TestExternalProviders,
} from '../../../../mock/test_providers/test_providers';
import { PatternRollup } from '../../../../types';
} from '../../../mock/test_providers/test_providers';
import { PatternRollup } from '../../../types';
import { Props, IndicesDetails } from '.';

const defaultBytesFormat = '0,0.[0]b';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import { EuiFlexItem } from '@elastic/eui';
import React from 'react';
import styled from 'styled-components';

import { useResultsRollupContext } from '../../../../contexts/results_rollup_context';
import { useResultsRollupContext } from '../../../contexts/results_rollup_context';
import { Pattern } from '../../../pattern';
import { SelectedIndex } from '../../../../types';
import { SelectedIndex } from '../../../types';
import { useDataQualityContext } from '../../../data_quality_context';

const StyledPatternWrapperFlexItem = styled(EuiFlexItem)`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import numeral from '@elastic/numeral';
import { euiThemeVars } from '@kbn/ui-theme';

import { EMPTY_STAT } from '../../../../helpers';
import { EMPTY_STAT } from '../../../helpers';
import {
DEFAULT_INDEX_COLOR,
getFillColor,
Expand All @@ -21,10 +21,10 @@ import {
getPatternLegendItem,
getPatternSizeInBytes,
} from './helpers';
import { alertIndexWithAllResults } from '../../../../mock/pattern_rollup/mock_alerts_pattern_rollup';
import { auditbeatWithAllResults } from '../../../../mock/pattern_rollup/mock_auditbeat_pattern_rollup';
import { packetbeatNoResults } from '../../../../mock/pattern_rollup/mock_packetbeat_pattern_rollup';
import { PatternRollup } from '../../../../types';
import { alertIndexWithAllResults } from '../../../mock/pattern_rollup/mock_alerts_pattern_rollup';
import { auditbeatWithAllResults } from '../../../mock/pattern_rollup/mock_auditbeat_pattern_rollup';
import { packetbeatNoResults } from '../../../mock/pattern_rollup/mock_packetbeat_pattern_rollup';
import { PatternRollup } from '../../../types';

const defaultBytesFormat = '0,0.[0]b';
const formatBytes = (value: number | undefined) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import type { Datum, Key, ArrayNode } from '@elastic/charts';
import { euiThemeVars } from '@kbn/ui-theme';
import { orderBy } from 'lodash/fp';

import { getDocsCount, getSizeInBytes } from '../../../../helpers';
import { getDocsCount, getSizeInBytes } from '../../../helpers';
import { getIlmPhase } from '../../../pattern/helpers';
import { PatternRollup } from '../../../../types';
import { PatternRollup } from '../../../types';

export interface LegendItem {
color: string | null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ import numeral from '@elastic/numeral';
import { render, screen } from '@testing-library/react';
import React from 'react';

import { EMPTY_STAT } from '../../../../helpers';
import { alertIndexWithAllResults } from '../../../../mock/pattern_rollup/mock_alerts_pattern_rollup';
import { auditbeatWithAllResults } from '../../../../mock/pattern_rollup/mock_auditbeat_pattern_rollup';
import { packetbeatNoResults } from '../../../../mock/pattern_rollup/mock_packetbeat_pattern_rollup';
import { EMPTY_STAT } from '../../../helpers';
import { alertIndexWithAllResults } from '../../../mock/pattern_rollup/mock_alerts_pattern_rollup';
import { auditbeatWithAllResults } from '../../../mock/pattern_rollup/mock_auditbeat_pattern_rollup';
import { packetbeatNoResults } from '../../../mock/pattern_rollup/mock_packetbeat_pattern_rollup';
import {
TestDataQualityProviders,
TestExternalProviders,
} from '../../../../mock/test_providers/test_providers';
import { PatternRollup } from '../../../../types';
} from '../../../mock/test_providers/test_providers';
import { PatternRollup } from '../../../types';
import { Props, StorageDetails } from '.';

const defaultBytesFormat = '0,0.[0]b';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@

import React, { useCallback, useMemo } from 'react';

import { useResultsRollupContext } from '../../../../contexts/results_rollup_context';
import { useResultsRollupContext } from '../../../contexts/results_rollup_context';
import { getFlattenedBuckets } from './helpers';
import { StorageTreemap } from '../../../storage_treemap';
import { DEFAULT_MAX_CHART_HEIGHT } from '../../../tabs/styles';
import { SelectedIndex } from '../../../../types';
import { SelectedIndex } from '../../../types';
import { useDataQualityContext } from '../../../data_quality_context';
import { DOCS_UNIT } from './translations';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import React from 'react';
import {
TestDataQualityProviders,
TestExternalProviders,
} from '../../mock/test_providers/test_providers';
} from '../mock/test_providers/test_providers';
import { Body } from '.';

describe('IndexInvalidValues', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { render, screen } from '@testing-library/react';
import { omit } from 'lodash/fp';
import React from 'react';

import { SAME_FAMILY } from '../../data_quality_panel/same_family/translations';
import { SAME_FAMILY } from '../../same_family/translations';
import {
eventCategory,
someField,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type { EuiTableFieldDataColumnType } from '@elastic/eui';
import { EuiCode } from '@elastic/eui';
import React from 'react';

import { SameFamily } from '../../data_quality_panel/same_family';
import { SameFamily } from '../../same_family';
import { EcsAllowedValues } from '../ecs_allowed_values';
import { getIsInSameFamily } from '../../helpers';
import { IndexInvalidValues } from '../index_invalid_values';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { render, screen } from '@testing-library/react';
import { omit } from 'lodash/fp';
import React from 'react';

import { SAME_FAMILY } from '../../data_quality_panel/same_family/translations';
import { SAME_FAMILY } from '../../same_family/translations';
import { TestExternalProviders } from '../../mock/test_providers/test_providers';
import { eventCategory } from '../../mock/enriched_field_metadata/mock_enriched_field_metadata';
import { EcsBasedFieldMetadata } from '../../types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import type { EuiTableFieldDataColumnType } from '@elastic/eui';
import React from 'react';

import { SameFamily } from '../../data_quality_panel/same_family';
import { SameFamily } from '../../same_family';
import { CodeDanger, CodeSuccess } from '../../styles';
import * as i18n from '../translations';
import type { EcsBasedFieldMetadata } from '../../types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { render, screen } from '@testing-library/react';
import React from 'react';

import { INCOMPATIBLE_FIELD_MAPPINGS_TABLE_TITLE } from '../data_quality_panel/tabs/incompatible_tab/translations';
import { INCOMPATIBLE_FIELD_MAPPINGS_TABLE_TITLE } from '../tabs/incompatible_tab/translations';
import { eventCategory } from '../mock/enriched_field_metadata/mock_enriched_field_metadata';
import { TestExternalProviders } from '../mock/test_providers/test_providers';
import { CompareFieldsTable } from '.';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type { IToasts } from '@kbn/core-notifications-browser';
import { PartialTheme, Theme } from '@elastic/charts';

import { EuiComboBoxOptionOption } from '@elastic/eui';
import type { TelemetryEvents } from '../../types';
import type { TelemetryEvents } from '../types';

export interface DataQualityProviderProps {
httpFetch: HttpHandler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import React from 'react';
import {
TestDataQualityProviders,
TestExternalProviders,
} from '../../../mock/test_providers/test_providers';
import { IndexToCheck } from '../../../types';
} from '../../mock/test_providers/test_providers';
import { IndexToCheck } from '../../types';
import { CheckStatus, EMPTY_LAST_CHECKED_DATE } from '.';

const indexToCheck: IndexToCheck = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import React, { useEffect, useState } from 'react';
import moment from 'moment';

import { ErrorsPopover } from '../errors_popover';
import * as i18n from '../../../translations';
import type { ErrorSummary, IndexToCheck } from '../../../types';
import * as i18n from '../../translations';
import type { ErrorSummary, IndexToCheck } from '../../types';
import { useDataQualityContext } from '../../data_quality_context';

export const EMPTY_LAST_CHECKED_DATE = '--';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import userEvent from '@testing-library/user-event';
import { act, render, screen } from '@testing-library/react';
import React from 'react';

import { TestExternalProviders } from '../../../mock/test_providers/test_providers';
import { TestExternalProviders } from '../../mock/test_providers/test_providers';
import { ErrorsPopover } from '.';

const mockCopyToClipboard = jest.fn((value) => true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
getErrorsMarkdownTableRows,
} from '../../index_properties/markdown/helpers';
import * as i18n from './translations';
import type { ErrorSummary } from '../../../types';
import type { ErrorSummary } from '../../types';
import { ERROR, INDEX, PATTERN } from '../errors_viewer/translations';

const CallOut = styled(EuiCallOut)`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import { omit } from 'lodash/fp';
import React from 'react';

import { getErrorsViewerTableColumns } from './helpers';
import { TestExternalProviders } from '../../../mock/test_providers/test_providers';
import { ErrorSummary } from '../../../types';
import { TestExternalProviders } from '../../mock/test_providers/test_providers';
import { ErrorSummary } from '../../types';

const errorSummary: ErrorSummary[] = [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { EuiCode } from '@elastic/eui';
import React from 'react';

import * as i18n from './translations';
import type { ErrorSummary } from '../../../types';
import type { ErrorSummary } from '../../types';

export const EMPTY_PLACEHOLDER = '--';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
import { render, screen } from '@testing-library/react';
import React from 'react';

import { TestExternalProviders } from '../../../mock/test_providers/test_providers';
import { TestExternalProviders } from '../../mock/test_providers/test_providers';
import { ERROR, INDEX, PATTERN } from './translations';
import { ErrorSummary } from '../../../types';
import { ErrorSummary } from '../../types';
import { ErrorsViewer } from '.';

interface ExpectedColumns {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
ERRORS_CONTAINER_MIN_WIDTH,
getErrorsViewerTableColumns,
} from './helpers';
import type { ErrorSummary } from '../../../types';
import type { ErrorSummary } from '../../types';

const ErrorsViewerContainer = styled.div`
max-width: ${ERRORS_CONTAINER_MAX_WIDTH}px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ import { IlmPhaseFilter } from '.';
import {
TestDataQualityProviders,
TestExternalProviders,
} from '../../../mock/test_providers/test_providers';
} from '../../mock/test_providers/test_providers';
import {
COLD_DESCRIPTION,
FROZEN_DESCRIPTION,
HOT_DESCRIPTION,
INDEX_LIFECYCLE_MANAGEMENT_PHASES,
UNMANAGED_DESCRIPTION,
WARM_DESCRIPTION,
} from '../../../translations';
} from '../../translations';

describe('IlmPhaseFilter', () => {
it('renders combobox with ilmPhase label and preselected hot, warm, unmanaged options', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ import {
} from '@elastic/eui';
import React, { useCallback, useMemo } from 'react';

import { ilmPhaseOptionsStatic } from '../../../constants';
import { getIlmPhaseDescription } from '../../../helpers';
import { ilmPhaseOptionsStatic } from '../../constants';
import { getIlmPhaseDescription } from '../../helpers';
import {
ILM_PHASE,
INDEX_LIFECYCLE_MANAGEMENT_PHASES,
SELECT_ONE_OR_MORE_ILM_PHASES,
} from '../../../translations';
} from '../../translations';
import { useDataQualityContext } from '../../data_quality_context';
import { StyledFormControlLayout, StyledOption, StyledOptionLabel } from './styles';

Expand Down
Loading

0 comments on commit 9870e20

Please sign in to comment.