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

[Upgrade Assistant] Reorganize folder structure #94843

Merged
Merged
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
@import 'tabs/checkup/index';
@import 'tabs/overview/index';
@import 'elasticsearch/index';
@import 'overview/index';

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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

import { IconColor } from '@elastic/eui';
import { invert } from 'lodash';
import { DeprecationInfo } from '../../../../../common/types';
import { DeprecationInfo } from '../../../../common/types';

export const LEVEL_MAP: { [level: string]: number } = {
warning: 0,
critical: 1,
};

export const REVERSE_LEVEL_MAP: { [idx: number]: DeprecationInfo['level'] } = invert(
LEVEL_MAP
) as any;
interface ReverseLevelMap {
[idx: number]: DeprecationInfo['level'];
}

export const REVERSE_LEVEL_MAP: ReverseLevelMap = invert(LEVEL_MAP) as ReverseLevelMap;

export const COLOR_MAP: { [level: string]: IconColor } = {
warning: 'default',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@ import React, { FunctionComponent, useState } from 'react';
import { i18n } from '@kbn/i18n';
import { EuiButton, EuiFieldSearch, EuiFlexGroup, EuiFlexItem, EuiCallOut } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { DeprecationInfo } from '../../../../../common/types';
import { GroupByOption, LevelFilterOption, LoadingState } from '../../types';
import { DeprecationInfo } from '../../../../common/types';
import { validateRegExpString } from '../../lib/utils';
import { GroupByOption, LevelFilterOption, LoadingState } from '../types';
import { FilterBar } from './filter_bar';
import { GroupByBar } from './group_by_bar';

import { validateRegExpString } from '../../../utils';

interface CheckupControlsProps {
allDeprecations?: DeprecationInfo[];
loadingState: LoadingState;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@

import { shallow } from 'enzyme';
import React from 'react';
import { mockKibanaSemverVersion } from '../../../../../common/constants';
import { mockKibanaSemverVersion } from '../../../../common/constants';

import { LoadingState } from '../../types';
import AssistanceData from '../__fixtures__/checkup_api_response.json';
import { CheckupTab } from './checkup_tab';
import { LoadingState } from '../types';
import AssistanceData from './__fixtures__/checkup_api_response.json';
import { DeprecationTab } from './deprecation_tab';

const defaultProps = {
checkupLabel: 'index',
Expand All @@ -22,7 +22,7 @@ const defaultProps = {
setSelectedTabIndex: jest.fn(),
};

jest.mock('../../../app_context', () => {
jest.mock('../../app_context', () => {
return {
useAppContext: () => {
return {
Expand All @@ -43,16 +43,16 @@ jest.mock('../../../app_context', () => {
/**
* Mostly a dumb container with copy, test the three main states.
*/
describe('CheckupTab', () => {
describe('DeprecationTab', () => {
test('render with deprecations', () => {
// @ts-expect-error mock data is too loosely typed
expect(shallow(<CheckupTab {...defaultProps} />)).toMatchSnapshot();
expect(shallow(<DeprecationTab {...defaultProps} />)).toMatchSnapshot();
});

test('render without deprecations', () => {
expect(
shallow(
<CheckupTab
<DeprecationTab
{...{ ...defaultProps, deprecations: undefined, loadingState: LoadingState.Loading }}
/>
)
Expand All @@ -62,7 +62,7 @@ describe('CheckupTab', () => {
test('render with error', () => {
expect(
shallow(
<CheckupTab
<DeprecationTab
{...{
...defaultProps,
deprecations: undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,9 @@ import {
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';

import { LoadingErrorBanner } from '../../error_banner';
import { useAppContext } from '../../../app_context';
import {
GroupByOption,
LevelFilterOption,
LoadingState,
UpgradeAssistantTabProps,
} from '../../types';
import { LoadingErrorBanner } from '../error_banner';
import { useAppContext } from '../../app_context';
import { GroupByOption, LevelFilterOption, LoadingState, UpgradeAssistantTabProps } from '../types';
import { CheckupControls } from './controls';
import { GroupedDeprecations } from './deprecations/grouped';

Expand All @@ -39,7 +34,7 @@ export interface CheckupTabProps extends UpgradeAssistantTabProps {
* Displays a list of deprecations that filterable and groupable. Can be used for cluster,
* nodes, or indices checkups.
*/
export const CheckupTab: FunctionComponent<CheckupTabProps> = ({
export const DeprecationTab: FunctionComponent<CheckupTabProps> = ({
alertBanner,
checkupLabel,
deprecations,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import {
EuiTitle,
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { EnrichedDeprecationInfo } from '../../../../../common/types';
import { AppContext } from '../../../app_context';
import { ReindexButton } from './reindex';
import { AppContext } from '../../../../app_context';
import { EnrichedDeprecationInfo } from '../../../../../../common/types';
import { FixIndexSettingsButton } from './index_settings';

interface DeprecationCellProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import React, { Fragment, FunctionComponent } from 'react';
import { EuiText } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';

import { EnrichedDeprecationInfo } from '../../../../../../common/types';
import { EnrichedDeprecationInfo } from '../../../../../common/types';

export const DeprecationCountSummary: FunctionComponent<{
deprecations: EnrichedDeprecationInfo[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import React from 'react';
import { mountWithIntl, shallowWithIntl } from '@kbn/test/jest';
import { EuiBadge, EuiPagination } from '@elastic/eui';

import { DeprecationInfo, EnrichedDeprecationInfo } from '../../../../../../common/types';
import { GroupByOption, LevelFilterOption } from '../../../types';
import { DeprecationInfo, EnrichedDeprecationInfo } from '../../../../../common/types';
import { GroupByOption, LevelFilterOption } from '../../types';
import { DeprecationAccordion, filterDeps, GroupedDeprecations } from './grouped';

describe('filterDeps', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import {
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';

import { DeprecationInfo, EnrichedDeprecationInfo } from '../../../../../../common/types';
import { GroupByOption, LevelFilterOption } from '../../../types';
import { DeprecationInfo, EnrichedDeprecationInfo } from '../../../../../common/types';
import { GroupByOption, LevelFilterOption } from '../../types';

import { DeprecationCountSummary } from './count_summary';
import { DeprecationHealth } from './health';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import React, { FunctionComponent } from 'react';
import { EuiBadge, EuiToolTip } from '@elastic/eui';
import { i18n } from '@kbn/i18n';

import { DeprecationInfo } from '../../../../../../common/types';
import { DeprecationInfo } from '../../../../../common/types';
import { COLOR_MAP, LEVEL_MAP, REVERSE_LEVEL_MAP } from '../constants';

const LocalizedLevels: { [level: string]: string } = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import React, { useState, useRef } from 'react';
import { i18n } from '@kbn/i18n';
import { EuiCode, EuiConfirmModal } from '@elastic/eui';
import { useAppContext } from '../../../../../app_context';
import { useAppContext } from '../../../../app_context';

interface Props {
children: (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import React from 'react';

import { EuiBasicTable } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { EnrichedDeprecationInfo } from '../../../../../common/types';
import { AppContext } from '../../../app_context';
import { ReindexButton } from './reindex';
import { AppContext } from '../../../../app_context';
import { EnrichedDeprecationInfo } from '../../../../../../common/types';
import { FixIndexSettingsButton } from './index_settings';

const PAGE_SIZES = [10, 25, 50, 100, 250, 500, 1000];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import { shallow } from 'enzyme';
import React from 'react';

import { EnrichedDeprecationInfo } from '../../../../../../common/types';
import { GroupByOption } from '../../../types';
import { EnrichedDeprecationInfo } from '../../../../../common/types';
import { GroupByOption } from '../../types';
import { DeprecationList } from './list';

describe('DeprecationList', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

import React, { FunctionComponent } from 'react';

import { DeprecationInfo, EnrichedDeprecationInfo } from '../../../../../../common/types';
import { GroupByOption } from '../../../types';
import { DeprecationInfo, EnrichedDeprecationInfo } from '../../../../../common/types';
import { GroupByOption } from '../../types';

import { COLOR_MAP, LEVEL_MAP } from '../constants';
import { DeprecationCell } from './cell';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import {
EnrichedDeprecationInfo,
ReindexStatus,
UIReindexOption,
} from '../../../../../../../common/types';
import { LoadingState } from '../../../../types';
} from '../../../../../../common/types';
import { LoadingState } from '../../../types';
import { ReindexFlyout } from './flyout';
import { ReindexPollingService, ReindexState } from './polling_service';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import { shallow } from 'enzyme';
import { cloneDeep } from 'lodash';
import React from 'react';

import { ReindexStatus } from '../../../../../../../../common/types';
import { LoadingState } from '../../../../../types';
import { ReindexStatus } from '../../../../../../../common/types';
import { LoadingState } from '../../../../types';
import { ReindexState } from '../polling_service';
import { ChecklistFlyoutStep } from './checklist_step';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import {
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';

import { ReindexStatus } from '../../../../../../../../common/types';
import { LoadingState } from '../../../../../types';
import { ReindexStatus } from '../../../../../../../common/types';
import { LoadingState } from '../../../../types';
import { ReindexState } from '../polling_service';
import { ReindexProgress } from './progress';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
EuiTitle,
} from '@elastic/eui';

import { EnrichedDeprecationInfo, ReindexStatus } from '../../../../../../../../common/types';
import { EnrichedDeprecationInfo, ReindexStatus } from '../../../../../../../common/types';

import { ReindexState } from '../polling_service';
import { ChecklistFlyoutStep } from './checklist_step';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { shallow } from 'enzyme';
import React from 'react';

import { IndexGroup, ReindexStatus, ReindexStep } from '../../../../../../../../common/types';
import { IndexGroup, ReindexStatus, ReindexStep } from '../../../../../../../common/types';
import { ReindexState } from '../polling_service';
import { ReindexProgress } from './progress';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import {
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';

import { IndexGroup, ReindexStatus, ReindexStep } from '../../../../../../../../common/types';
import { LoadingState } from '../../../../../types';
import { IndexGroup, ReindexStatus, ReindexStep } from '../../../../../../../common/types';
import { LoadingState } from '../../../../types';
import { ReindexState } from '../polling_service';
import { StepProgress, StepProgressStep } from './step_progress';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import { I18nProvider } from '@kbn/i18n/react';
import { mount, shallow } from 'enzyme';
import React from 'react';

import { ReindexWarning } from '../../../../../../../../common/types';
import { mockKibanaSemverVersion } from '../../../../../../../../common/constants';
import { ReindexWarning } from '../../../../../../../common/types';
import { mockKibanaSemverVersion } from '../../../../../../../common/constants';

import { idForWarning, WarningsFlyoutStep } from './warnings_step';

jest.mock('../../../../../../app_context', () => {
jest.mock('../../../../../app_context', () => {
const { docLinksServiceMock } = jest.requireActual(
'../../../../../../../../../../../src/core/public/doc_links/doc_links_service.mock'
'../../../../../../../../../../src/core/public/doc_links/doc_links_service.mock'
);

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { DocLinksStart } from 'kibana/public';
import { ReindexWarning, ReindexWarningTypes } from '../../../../../../../../common/types';
import { ReindexWarning, ReindexWarningTypes } from '../../../../../../../common/types';

export const hasReindexWarning = (
warnings: ReindexWarning[],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import {
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';

import { ReindexWarning, ReindexWarningTypes } from '../../../../../../../../common/types';
import { useAppContext } from '../../../../../../app_context';
import { ReindexWarning, ReindexWarningTypes } from '../../../../../../../common/types';
import { useAppContext } from '../../../../../app_context';
import {
CustomTypeNameWarningCheckbox,
DeprecatedSettingWarningCheckbox,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { ReindexStatus, ReindexStep } from '../../../../../../../common/types';
import { ReindexStatus, ReindexStep } from '../../../../../../common/types';
import { ReindexPollingService } from './polling_service';
import { httpServiceMock } from 'src/core/public/mocks';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import {
ReindexStatus,
ReindexStep,
ReindexWarning,
} from '../../../../../../../common/types';
import { LoadingState } from '../../../../types';
} from '../../../../../../common/types';
import { LoadingState } from '../../../types';

const POLL_INTERVAL = 1000;

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

import { mount, shallow } from 'enzyme';
import React from 'react';
import { DeprecationInfo } from '../../../../../common/types';
import { DeprecationInfo } from '../../../../common/types';

import { LevelFilterOption } from '../../types';
import { LevelFilterOption } from '../types';
import { FilterBar } from './filter_bar';

const defaultProps = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import React from 'react';
import { EuiFilterButton, EuiFilterGroup, EuiFlexItem } from '@elastic/eui';
import { i18n } from '@kbn/i18n';

import { DeprecationInfo } from '../../../../../common/types';
import { LevelFilterOption } from '../../types';
import { DeprecationInfo } from '../../../../common/types';
import { LevelFilterOption } from '../types';

const LocalizedOptions: { [option: string]: string } = {
all: i18n.translate('xpack.upgradeAssistant.checkupTab.controls.filterBar.allButtonLabel', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { mount, shallow } from 'enzyme';
import React from 'react';

import { GroupByOption } from '../../types';
import { GroupByOption } from '../types';
import { GroupByBar } from './group_by_bar';

const defaultProps = {
Expand Down
Loading