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

[8.x] [Mappings editor] Handle unsupported types (#198185) #198421

Merged
merged 1 commit into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ export const getFieldsMatchingFilterFromState = (
} => {
return Object.fromEntries(
Object.entries(state.fields.byId).filter(([_, fieldId]) =>
filteredDataTypes.includes(TYPE_DEFINITION[state.fields.byId[fieldId.id].source.type].label)
filteredDataTypes.includes(getTypeLabelFromField(state.fields.byId[fieldId.id].source))
)
);
};
Expand All @@ -646,9 +646,7 @@ export const getFieldsFromState = (
const getField = (fieldId: string) => {
if (filteredDataTypes) {
if (
filteredDataTypes.includes(
TYPE_DEFINITION[normalizedFields.byId[fieldId].source.type].label
)
filteredDataTypes.includes(getTypeLabelFromField(normalizedFields.byId[fieldId].source))
) {
return normalizedFields.byId[fieldId];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ import {
deNormalizeRuntimeFields,
getAllFieldTypesFromState,
getFieldsFromState,
getTypeLabelFromField,
} from './lib';
import { useMappingsState, useDispatch } from './mappings_state_context';
import { TYPE_DEFINITION } from './constants';

interface Args {
onChange?: OnUpdateHandler;
Expand Down Expand Up @@ -56,7 +56,7 @@ export const useMappingsStateListener = ({ onChange, value, status }: Args) => {
const allFieldsTypes = getAllFieldTypesFromState(deNormalize(normalize(mappedFields)));
return allFieldsTypes.map((dataType) => ({
checked: undefined,
label: TYPE_DEFINITION[dataType].label,
label: getTypeLabelFromField({ type: dataType }),
'data-test-subj': `indexDetailsMappingsSelectFilter-${dataType}`,
}));
}, [mappedFields]);
Expand Down