Skip to content

Commit

Permalink
remove irrelevant code
Browse files Browse the repository at this point in the history
  • Loading branch information
alisonelizabeth committed Feb 18, 2021
1 parent 2e4163d commit 2e2e92f
Show file tree
Hide file tree
Showing 43 changed files with 121 additions and 3,220 deletions.
8 changes: 2 additions & 6 deletions x-pack/plugins/upgrade_assistant/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,10 @@ export interface ReindexOperation extends SavedObjectAttributes {
export type ReindexSavedObject = SavedObject<ReindexOperation>;

export enum ReindexWarning {
// 6.0 -> 7.0 warnings, now unused
allField,
booleanFields,

// 7.0 -> 8.0 warnings
apmReindex,
customTypeName,

// 8.0 -> 9.0 warnings
}

export enum IndexGroup {
Expand Down Expand Up @@ -184,7 +181,6 @@ export interface EnrichedDeprecationInfo extends DeprecationInfo {
index?: string;
node?: string;
reindex?: boolean;
needsDefaultFields?: boolean;
/**
* Indicate what blockers have been detected for calling reindex
* against this index.
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/upgrade_assistant/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"server": true,
"ui": true,
"configPath": ["xpack", "upgrade_assistant"],
"requiredPlugins": ["management", "licensing", "apmOss", "features"],
"requiredPlugins": ["management", "licensing", "features"],
"optionalPlugins": ["cloud", "usageCollection"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { OverviewTab } from './tabs/overview';
const promisesToResolve = () => new Promise((resolve) => setTimeout(resolve, 0));

const mockHttp = httpServiceMock.createSetupContract();
const mockKibanaVersion = new SemVer('7.0.0');
const mockKibanaVersion = new SemVer('8.0.0');

jest.mock('../app_context', () => {
return {
Expand Down

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 @@ -22,7 +22,7 @@ const defaultProps = {
setSelectedTabIndex: jest.fn(),
};

const mockKibanaVersion = new SemVer('7.0.0');
const mockKibanaVersion = new SemVer('8.0.0');

jest.mock('../../../app_context', () => {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,13 @@ import {
EuiTitle,
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { FixDefaultFieldsButton } from './default_fields/button';
import { ReindexButton } from './reindex';
import { AppContext } from '../../../../app_context';
import { EnrichedDeprecationInfo } from '../../../../../../common/types';

interface DeprecationCellProps {
items?: Array<{ title?: string; body: string }>;
indexName?: string;
reindex?: boolean;
needsDefaultFields?: boolean;
reindexIndexName?: string;
docUrl?: string;
headline?: string;
healthColor?: string;
Expand All @@ -40,9 +37,7 @@ interface DeprecationCellProps {
export const DeprecationCell: FunctionComponent<DeprecationCellProps> = ({
headline,
healthColor,
indexName,
reindex,
needsDefaultFields,
reindexIndexName,
docUrl,
items = [],
children,
Expand Down Expand Up @@ -85,28 +80,20 @@ export const DeprecationCell: FunctionComponent<DeprecationCellProps> = ({
))}
</EuiFlexItem>

{reindex && (
{reindexIndexName && (
<EuiFlexItem grow={false}>
<AppContext.Consumer>
{({ http, docLinks }) => (
<ReindexButton
docLinks={docLinks}
reindexBlocker={reindexBlocker}
indexName={indexName!}
indexName={reindexIndexName}
http={http}
/>
)}
</AppContext.Consumer>
</EuiFlexItem>
)}

{needsDefaultFields && (
<EuiFlexItem grow={false}>
<AppContext.Consumer>
{({ http }) => <FixDefaultFieldsButton indexName={indexName!} http={http} />}
</AppContext.Consumer>
</EuiFlexItem>
)}
</EuiFlexGroup>

<EuiSpacer size="s" />
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import React from 'react';

import { EuiBasicTable } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { FixDefaultFieldsButton } from './default_fields/button';
import { ReindexButton } from './reindex';
import { AppContext } from '../../../../app_context';
import { EnrichedDeprecationInfo } from '../../../../../../common/types';
Expand All @@ -20,7 +19,6 @@ const PAGE_SIZES = [10, 25, 50, 100, 250, 500, 1000];
export interface IndexDeprecationDetails {
index: string;
reindex: boolean;
needsDefaultFields: boolean;
blockerForReindexing?: EnrichedDeprecationInfo['blockerForReindexing'];
details?: string;
}
Expand Down Expand Up @@ -145,40 +143,32 @@ export class IndexDeprecationTable extends React.Component<

private generateActionsColumn() {
// NOTE: this naive implementation assumes all indices in the table are
// should show the reindex button. This should work for known usecases.
// should show the reindex button. This should work for known use cases.
const { indices } = this.props;
const showReindexButton = indices.find((i) => i.reindex === true);
const showNeedsDefaultFieldsButton = indices.find((i) => i.needsDefaultFields === true);
if (!showReindexButton && !showNeedsDefaultFieldsButton) {
const showActionsColumn = Boolean(indices.find((i) => i.reindex === true));

if (showActionsColumn === false) {
return null;
}

return {
actions: [
{
render(indexDep: IndexDeprecationDetails) {
if (showReindexButton) {
return (
<AppContext.Consumer>
{({ http, docLinks }) => {
return (
<ReindexButton
docLinks={docLinks}
reindexBlocker={indexDep.blockerForReindexing}
indexName={indexDep.index!}
http={http}
/>
);
}}
</AppContext.Consumer>
);
} else {
return (
<AppContext.Consumer>
{({ http }) => <FixDefaultFieldsButton indexName={indexDep.index!} http={http} />}
</AppContext.Consumer>
);
}
return (
<AppContext.Consumer>
{({ http, docLinks }) => {
return (
<ReindexButton
docLinks={docLinks}
reindexBlocker={indexDep.blockerForReindexing}
indexName={indexDep.index!}
http={http}
/>
);
}}
</AppContext.Consumer>
);
},
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,12 @@ describe('DeprecationList', () => {
"blockerForReindexing": undefined,
"details": undefined,
"index": "0",
"needsDefaultFields": false,
"reindex": false,
},
Object {
"blockerForReindexing": undefined,
"details": undefined,
"index": "1",
"needsDefaultFields": false,
"reindex": false,
},
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ const MessageDeprecation: FunctionComponent<{ deprecation: EnrichedDeprecationIn
reindexBlocker={deprecation.blockerForReindexing}
headline={deprecation.message}
healthColor={COLOR_MAP[deprecation.level]}
indexName={deprecation.index}
reindex={deprecation.reindex}
needsDefaultFields={deprecation.needsDefaultFields}
reindexIndexName={deprecation.reindex ? deprecation.index! : undefined}
docUrl={deprecation.url}
items={items}
/>
Expand Down Expand Up @@ -98,7 +96,6 @@ export const DeprecationList: FunctionComponent<{
index: dep.index!,
details: dep.details,
reindex: dep.reindex === true,
needsDefaultFields: dep.needsDefaultFields === true,
blockerForReindexing: dep.blockerForReindexing,
}));
return <IndexDeprecation indices={indices} deprecation={deprecations[0]} />;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ export class ReindexButton extends React.Component<ReindexButtonProps, ReindexBu

{flyoutVisible && (
<ReindexFlyout
http={this.props.http}
reindexBlocker={reindexBlocker}
docLinks={docLinks}
indexName={indexName}
Expand Down
Loading

0 comments on commit 2e2e92f

Please sign in to comment.