Skip to content

Commit

Permalink
[Mappings editor] include/exclude fields only support custom options (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
alisonelizabeth authored Jan 17, 2020
1 parent 9e07a42 commit 102bd2b
Showing 1 changed file with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import React, { useState } from 'react';
import React from 'react';

import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
Expand All @@ -14,9 +14,6 @@ import { UseField, FormDataProvider, FormRow, ToggleField } from '../../../share
import { ComboBoxOption } from '../../../types';

export const SourceFieldSection = () => {
const [includeComboBoxOptions, setIncludeComboBoxOptions] = useState<ComboBoxOption[]>([]);
const [excludeComboBoxOptions, setExcludeComboBoxOptions] = useState<ComboBoxOption[]>([]);

const renderWarning = () => (
<EuiCallOut
title={i18n.translate('xpack.idxMgmt.mappingsEditor.disabledSourceFieldCallOutTitle', {
Expand Down Expand Up @@ -73,13 +70,13 @@ export const SourceFieldSection = () => {
{({ label, helpText, value, setValue }) => (
<EuiFormRow label={label} helpText={helpText} fullWidth>
<EuiComboBox
noSuggestions
placeholder={i18n.translate(
'xpack.idxMgmt.mappingsEditor.sourceIncludeField.placeholderLabel',
{
defaultMessage: 'path.to.field.*',
}
)}
options={includeComboBoxOptions}
selectedOptions={value as ComboBoxOption[]}
onChange={newValue => {
setValue(newValue);
Expand All @@ -90,7 +87,6 @@ export const SourceFieldSection = () => {
};

setValue([...(value as ComboBoxOption[]), newOption]);
setIncludeComboBoxOptions([...includeComboBoxOptions, newOption]);
}}
fullWidth
/>
Expand All @@ -104,13 +100,13 @@ export const SourceFieldSection = () => {
{({ label, helpText, value, setValue }) => (
<EuiFormRow label={label} helpText={helpText} fullWidth>
<EuiComboBox
noSuggestions
placeholder={i18n.translate(
'xpack.idxMgmt.mappingsEditor.sourceExcludeField.placeholderLabel',
{
defaultMessage: 'path.to.field.*',
}
)}
options={excludeComboBoxOptions}
selectedOptions={value as ComboBoxOption[]}
onChange={newValue => {
setValue(newValue);
Expand All @@ -121,7 +117,6 @@ export const SourceFieldSection = () => {
};

setValue([...(value as ComboBoxOption[]), newOption]);
setExcludeComboBoxOptions([...excludeComboBoxOptions, newOption]);
}}
fullWidth
/>
Expand Down

0 comments on commit 102bd2b

Please sign in to comment.