Skip to content

Commit

Permalink
Revert "Add support for runtime field types to mappings editor. (#77420
Browse files Browse the repository at this point in the history
…) (#78539)" (#79612)

This reverts commit 52b1ad9.
  • Loading branch information
cjcenizal authored Oct 6, 2020
1 parent 3c1a71f commit e3270da
Show file tree
Hide file tree
Showing 27 changed files with 74 additions and 552 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import React, { createContext, useContext } from 'react';
import { ScopedHistory } from 'kibana/public';
import { ManagementAppMountParams } from 'src/plugins/management/public';
import { UsageCollectionSetup } from 'src/plugins/usage_collection/public';
import { CoreSetup, CoreStart } from '../../../../../src/core/public';
import { CoreStart } from '../../../../../src/core/public';

import { IngestManagerSetup } from '../../../ingest_manager/public';
import { IndexMgmtMetricsType } from '../types';
Expand All @@ -34,7 +34,6 @@ export interface AppDependencies {
};
history: ScopedHistory;
setBreadcrumbs: ManagementAppMountParams['setBreadcrumbs'];
uiSettings: CoreSetup['uiSettings'];
}

export const AppContextProvider = ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,6 @@ export * from './meta_parameter';

export * from './ignore_above_parameter';

export { RuntimeTypeParameter } from './runtime_type_parameter';

export { PainlessScriptParameter } from './painless_script_parameter';

export const PARAMETER_SERIALIZERS = [relationsSerializer, dynamicSerializer];

export const PARAMETER_DESERIALIZERS = [relationsDeserializer, dynamicDeserializer];

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -93,17 +93,17 @@ export const PathParameter = ({ field, allFields }: Props) => {
<>
{!Boolean(suggestedFields.length) && (
<>
<EuiCallOut
size="s"
color="warning"
title={i18n.translate(
'xpack.idxMgmt.mappingsEditor.aliasType.noFieldsAddedWarningMessage',
{
defaultMessage:
'You need to add at least one field before creating an alias.',
}
)}
/>
<EuiCallOut color="warning">
<p>
{i18n.translate(
'xpack.idxMgmt.mappingsEditor.aliasType.noFieldsAddedWarningMessage',
{
defaultMessage:
'You need to add at least one field before creating an alias.',
}
)}
</p>
</EuiCallOut>
<EuiSpacer />
</>
)}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,14 @@ export const TermVectorParameter = ({ field, defaultToggleValue }: Props) => {
{formData.term_vector === 'with_positions_offsets' && (
<>
<EuiSpacer size="s" />
<EuiCallOut
size="s"
color="warning"
title={i18n.translate(
'xpack.idxMgmt.mappingsEditor.termVectorFieldWarningMessage',
{
<EuiCallOut color="warning">
<p>
{i18n.translate('xpack.idxMgmt.mappingsEditor.termVectorFieldWarningMessage', {
defaultMessage:
'Setting "With positions and offsets" will double the size of a field’s index.',
}
)}
/>
})}
</p>
</EuiCallOut>
</>
)}
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,15 @@ import {
EuiFlexGroup,
EuiFlexItem,
EuiOutsideClickDetector,
EuiSpacer,
} from '@elastic/eui';

import { useForm, Form, FormDataProvider } from '../../../../shared_imports';
import { EUI_SIZE, TYPE_DEFINITION } from '../../../../constants';
import { EUI_SIZE } from '../../../../constants';
import { useDispatch } from '../../../../mappings_state_context';
import { fieldSerializer } from '../../../../lib';
import { Field, NormalizedFields, MainType } from '../../../../types';
import { Field, NormalizedFields } from '../../../../types';
import { NameParameter, TypeParameter, SubTypeParameter } from '../../field_parameters';
import { FieldBetaBadge } from '../field_beta_badge';
import { getRequiredParametersFormForType } from './required_parameters_forms';
import { getParametersFormForType } from './required_parameters_forms';

const formWrapper = (props: any) => <form {...props} />;

Expand Down Expand Up @@ -197,27 +195,18 @@ export const CreateField = React.memo(function CreateFieldComponent({

<FormDataProvider pathsToWatch={['type', 'subType']}>
{({ type, subType }) => {
const RequiredParametersForm = getRequiredParametersFormForType(
const ParametersForm = getParametersFormForType(
type?.[0].value,
subType?.[0].value
);

if (!RequiredParametersForm) {
if (!ParametersForm) {
return null;
}

const typeDefinition = TYPE_DEFINITION[type?.[0].value as MainType];

return (
<div className="mappingsEditor__createFieldRequiredProps">
{typeDefinition.isBeta ? (
<>
<FieldBetaBadge />
<EuiSpacer size="m" />
</>
) : null}

<RequiredParametersForm key={subType ?? type} allFields={allFields} />
<ParametersForm key={subType ?? type} allFields={allFields} />
</div>
);
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { AliasTypeRequiredParameters } from './alias_type';
import { TokenCountTypeRequiredParameters } from './token_count_type';
import { ScaledFloatTypeRequiredParameters } from './scaled_float_type';
import { DenseVectorRequiredParameters } from './dense_vector_type';
import { RuntimeTypeRequiredParameters } from './runtime_type';

export interface ComponentProps {
allFields: NormalizedFields['byId'];
Expand All @@ -22,10 +21,9 @@ const typeToParametersFormMap: { [key in DataType]?: ComponentType<any> } = {
token_count: TokenCountTypeRequiredParameters,
scaled_float: ScaledFloatTypeRequiredParameters,
dense_vector: DenseVectorRequiredParameters,
runtime: RuntimeTypeRequiredParameters,
};

export const getRequiredParametersFormForType = (
export const getParametersFormForType = (
type: MainType,
subType?: SubType
): ComponentType<ComponentProps> | undefined =>
Expand Down

This file was deleted.

Loading

0 comments on commit e3270da

Please sign in to comment.