[Upgrade Assistant] Reorganize folder structure (#94843)

This commit is contained in:
Alison Goryachev 2021-03-24 12:39:39 -04:00 committed by GitHub
parent 2e5b5debb5
commit d0c09463d0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
58 changed files with 78 additions and 69 deletions

View file

@ -1,2 +1,2 @@
@import 'tabs/checkup/index';
@import 'tabs/overview/index';
@import 'es_deprecations/index';
@import 'overview/index';

View file

@ -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',

View file

@ -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 } from '../../types';
import { DeprecationInfo } from '../../../../common/types';
import { validateRegExpString } from '../../lib/utils';
import { GroupByOption, LevelFilterOption } from '../types';
import { FilterBar } from './filter_bar';
import { GroupByBar } from './group_by_bar';
import { validateRegExpString } from '../../../utils';
interface CheckupControlsProps {
allDeprecations?: DeprecationInfo[];
isLoading: boolean;

View file

@ -19,9 +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, UpgradeAssistantTabProps } from '../../types';
import { LoadingErrorBanner } from '../error_banner';
import { useAppContext } from '../../app_context';
import { GroupByOption, LevelFilterOption, UpgradeAssistantTabProps } from '../types';
import { CheckupControls } from './controls';
import { GroupedDeprecations } from './deprecations/grouped';
@ -34,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,

View file

@ -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 {

View file

@ -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[];

View file

@ -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', () => {

View file

@ -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';

View file

@ -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 } = {

View file

@ -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: (

View file

@ -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];

View file

@ -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', () => {

View file

@ -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';

View file

@ -13,13 +13,13 @@ import { Subscription } from 'rxjs';
import { EuiButton, EuiLoadingSpinner, EuiText, EuiToolTip } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { DocLinksStart, HttpSetup } from 'src/core/public';
import { API_BASE_PATH } from '../../../../../../../common/constants';
import { API_BASE_PATH } from '../../../../../../common/constants';
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';

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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 {

View file

@ -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[],

View file

@ -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,

View file

@ -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';

View file

@ -8,15 +8,15 @@
import { BehaviorSubject } from 'rxjs';
import { HttpSetup } from 'src/core/public';
import { API_BASE_PATH } from '../../../../../../../common/constants';
import { API_BASE_PATH } from '../../../../../../common/constants';
import {
IndexGroup,
ReindexOperation,
ReindexStatus,
ReindexStep,
ReindexWarning,
} from '../../../../../../../common/types';
import { LoadingState } from '../../../../types';
} from '../../../../../../common/types';
import { LoadingState } from '../../../types';
const POLL_INTERVAL = 1000;

View file

@ -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 = {

View file

@ -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', {

View file

@ -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 = {

View file

@ -10,7 +10,7 @@ import React from 'react';
import { EuiFilterButton, EuiFilterGroup, EuiFlexItem } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { GroupByOption } from '../../types';
import { GroupByOption } from '../types';
const LocalizedOptions: { [option: string]: string } = {
message: i18n.translate('xpack.upgradeAssistant.checkupTab.controls.groupByBar.byIssueLabel', {

View file

@ -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 { DeprecationTab } from './deprecation_tab';

View file

@ -10,8 +10,8 @@ import React, { useEffect, useState } from 'react';
import { EuiLoadingSpinner, EuiSwitch } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { useAppContext } from '../../../app_context';
import { ResponseError } from '../../../lib/api';
import { useAppContext } from '../../app_context';
import { ResponseError } from '../../lib/api';
export const DeprecationLoggingToggle: React.FunctionComponent = () => {
const { api } = useAppContext();

View file

@ -5,4 +5,4 @@
* 2.0.
*/
export { CheckupTab } from './checkup_tab';
export { OverviewTab } from './overview';

View file

@ -18,9 +18,9 @@ import {
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { useAppContext } from '../../../app_context';
import { LoadingErrorBanner } from '../../error_banner';
import { UpgradeAssistantTabProps } from '../../types';
import { useAppContext } from '../../app_context';
import { LoadingErrorBanner } from '../error_banner';
import { UpgradeAssistantTabProps } from '../types';
import { Steps } from './steps';
export const OverviewTab: FunctionComponent<UpgradeAssistantTabProps> = (props) => {

View file

@ -20,9 +20,9 @@ import {
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
import { UpgradeAssistantTabProps } from '../../types';
import { useAppContext } from '../../app_context';
import { UpgradeAssistantTabProps } from '../types';
import { DeprecationLoggingToggle } from './deprecation_logging_toggle';
import { useAppContext } from '../../../app_context';
// Leaving these here even if unused so they are picked up for i18n static analysis
// Keep this until last minor release (when next major is also released).

View file

@ -19,8 +19,8 @@ import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
import { LatestMinorBanner } from './latest_minor_banner';
import { CheckupTab } from './tabs/checkup';
import { OverviewTab } from './tabs/overview';
import { DeprecationTab } from './es_deprecations';
import { OverviewTab } from './overview';
import { TelemetryState, UpgradeAssistantTabProps } from './types';
import { useAppContext } from '../app_context';
@ -58,7 +58,7 @@ export const UpgradeAssistantTabs: React.FunctionComponent = () => {
defaultMessage: 'Cluster',
}),
content: (
<CheckupTab
<DeprecationTab
key="cluster"
deprecations={checkupData ? checkupData.cluster : undefined}
checkupLabel={i18n.translate('xpack.upgradeAssistant.tabs.checkupTab.clusterLabel', {
@ -75,7 +75,7 @@ export const UpgradeAssistantTabs: React.FunctionComponent = () => {
defaultMessage: 'Indices',
}),
content: (
<CheckupTab
<DeprecationTab
key="indices"
deprecations={checkupData ? checkupData.indices : undefined}
checkupLabel={i18n.translate('xpack.upgradeAssistant.checkupTab.indexLabel', {