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

[Discover] Fixed tooltips for text and keyword fields displaying 'Unknown field' in expanded document #133536

Merged
merged 8 commits into from
Jun 10, 2022
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import type { DataViewField, DataView } from '@kbn/data-views-plugin/public';
import { getTypeForFieldIcon } from '../../../../utils/get_type_for_field_icon';
import { DiscoverFieldDetails } from './discover_field_details';
import { FieldDetails } from './types';
import { getFieldTypeName } from './lib/get_field_type_name';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx a lot for cleaning this up and removing duplicated code 👍 . You can flag the PR ready for review. One thing you could add on top of it, could be a Jest test for e.g. discover_field.tsx that would catch the error. Or a basic one for get_field_type_name.ts

Copy link
Contributor Author

@davismcphee davismcphee Jun 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests added for get_field_type_name.ts

import { getFieldTypeName } from '../../../../utils/get_field_type_name';
import { DiscoverFieldVisualize } from './discover_field_visualize';

function wrapOnDot(str?: string) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { i18n } from '@kbn/i18n';
import { FieldIcon, FieldIconProps } from '@kbn/react-field';
import { getFieldSubtypeMulti } from '@kbn/data-views-plugin/public';
import type { DataViewField } from '@kbn/data-views-plugin/public';
import { getFieldTypeName } from './field_type_name';
import { getFieldTypeName } from '../../utils/get_field_type_name';

interface Props {
fieldName: string;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import { i18n } from '@kbn/i18n';

export function getFieldTypeName(type: string) {
export function getFieldTypeName(type?: string) {
switch (type) {
case 'boolean':
return i18n.translate('discover.fieldNameIcons.booleanAriaLabel', {
Expand Down