Skip to content

Commit

Permalink
Add type murmur3 into the lens fields list (#129029)
Browse files Browse the repository at this point in the history
* Add murmur3 type to fields list

To fix #129007 , naive approach.

* Add murmur3 type to fields list

* Add murmur3 type to fields list

* removed translations

* disable field preview

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

* change icon

* add specific murmur3 message

* fix test

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Joe Reuter <johannes.reuter@elastic.co>
  • Loading branch information
3 people authored Apr 12, 2022
1 parent 33b0578 commit 062be57
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 3 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/kbn-react-field/src/field_icon/field_icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const typeToEuiIconMap: Partial<Record<string, EuiTokenProps>> = {
ip: { iconType: 'tokenIP' },
ip_range: { iconType: 'tokenIP' },
// is a plugin's data type https://www.elastic.co/guide/en/elasticsearch/plugins/current/mapper-murmur3-usage.html
murmur3: { iconType: 'tokenFile' },
murmur3: { iconType: 'tokenSearchType' },
number: { iconType: 'tokenNumber' },
number_range: { iconType: 'tokenNumber' },
histogram: { iconType: 'tokenHistogram' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ const supportedFieldTypes = new Set([
'document',
'geo_point',
'geo_shape',
'murmur3',
]);

const fieldTypeNames: Record<DataType, string> = {
Expand All @@ -94,6 +95,7 @@ const fieldTypeNames: Record<DataType, string> = {
histogram: i18n.translate('xpack.lens.datatypes.histogram', { defaultMessage: 'histogram' }),
geo_point: i18n.translate('xpack.lens.datatypes.geoPoint', { defaultMessage: 'geo_point' }),
geo_shape: i18n.translate('xpack.lens.datatypes.geoShape', { defaultMessage: 'geo_shape' }),
murmur3: i18n.translate('xpack.lens.datatypes.murmur3', { defaultMessage: 'murmur3' }),
};

// Wrapper around buildEsQuery, handling errors (e.g. because a query can't be parsed) by
Expand Down
12 changes: 12 additions & 0 deletions x-pack/plugins/lens/public/indexpattern_datasource/field_item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,18 @@ function FieldItemPopoverContents(props: State & FieldItemProps) {
</EuiText>
</>
);
} else if (field.type === 'murmur3') {
return (
<>
<EuiPopoverTitle>{panelHeader}</EuiPopoverTitle>

<EuiText size="s">
{i18n.translate('xpack.lens.indexPattern.fieldStatsMurmur3Limited', {
defaultMessage: `Summary information is not available for murmur3 fields.`,
})}
</EuiText>
</>
);
} else if (field.type === 'geo_point' || field.type === 'geo_shape') {
return (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const supportedTypes = new Set([
'ip_range',
'date',
'date_range',
'murmur3',
]);

const SCALE = 'ratio';
Expand Down
8 changes: 7 additions & 1 deletion x-pack/plugins/lens/public/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,13 @@ export type DatasourceDimensionDropHandlerProps<T> = DatasourceDimensionDropProp
dropType: DropType;
};

export type FieldOnlyDataType = 'document' | 'ip' | 'histogram' | 'geo_point' | 'geo_shape';
export type FieldOnlyDataType =
| 'document'
| 'ip'
| 'histogram'
| 'geo_point'
| 'geo_shape'
| 'murmur3';
export type DataType = 'string' | 'number' | 'date' | 'boolean' | FieldOnlyDataType;

// An operation represents a column in a table, not any information
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const columnSortOrder = {
histogram: 6,
geo_point: 7,
geo_shape: 8,
murmur3: 9,
};

/**
Expand Down

0 comments on commit 062be57

Please sign in to comment.