Skip to content

Commit bbd6137

Browse files
committed
Fix types
1 parent 26084b5 commit bbd6137

3 files changed

Lines changed: 16 additions & 27 deletions

File tree

x-pack/plugins/data_visualizer/common/constants.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,19 @@ export const JOB_FIELD_TYPES = {
3333
UNKNOWN: 'unknown',
3434
} as const;
3535

36+
export const JOB_FIELD_TYPES_OPTIONS = {
37+
[JOB_FIELD_TYPES.BOOLEAN]: { name: 'Boolean', icon: 'tokenBoolean' },
38+
[JOB_FIELD_TYPES.DATE]: { name: 'Date', icon: 'tokenDate' },
39+
[JOB_FIELD_TYPES.GEO_POINT]: { name: 'Geo point', icon: 'tokenGeo' },
40+
[JOB_FIELD_TYPES.GEO_SHAPE]: { name: 'Geo shape', icon: 'tokenGeo' },
41+
[JOB_FIELD_TYPES.IP]: { name: 'IP address', icon: 'tokenIP' },
42+
[JOB_FIELD_TYPES.KEYWORD]: { name: 'Keyword', icon: 'tokenKeyword' },
43+
[JOB_FIELD_TYPES.NUMBER]: { name: 'Number', icon: 'tokenNumber' },
44+
[JOB_FIELD_TYPES.TEXT]: { name: 'Text', icon: 'tokenString' },
45+
[JOB_FIELD_TYPES.HISTOGRAM]: { name: 'Histogram', icon: 'tokenNumber' },
46+
[JOB_FIELD_TYPES.UNKNOWN]: { name: 'Unknown' },
47+
};
48+
3649
export const OMIT_FIELDS: string[] = ['_source', '_type', '_index', '_id', '_version', '_score'];
3750

3851
export const NON_AGGREGATABLE_FIELD_TYPES = new Set<string>([

x-pack/plugins/data_visualizer/public/application/common/components/field_types_filter/field_types_filter.tsx

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,7 @@ import type {
1414
FileBasedUnknownFieldVisConfig,
1515
} from '../stats_table/types/field_vis_config';
1616
import { FieldTypeIcon } from '../field_type_icon';
17-
import { JOB_FIELD_TYPES } from '../../../../../common';
18-
19-
const JOB_FIELD_TYPES_OPTIONS = {
20-
[JOB_FIELD_TYPES.BOOLEAN]: { name: 'Boolean', icon: 'tokenBoolean' },
21-
[JOB_FIELD_TYPES.DATE]: { name: 'Date', icon: 'tokenDate' },
22-
[JOB_FIELD_TYPES.GEO_POINT]: { name: 'Geo point', icon: 'tokenGeo' },
23-
[JOB_FIELD_TYPES.GEO_SHAPE]: { name: 'Geo shape', icon: 'tokenGeo' },
24-
[JOB_FIELD_TYPES.IP]: { name: 'IP address', icon: 'tokenIP' },
25-
[JOB_FIELD_TYPES.KEYWORD]: { name: 'Keyword', icon: 'tokenKeyword' },
26-
[JOB_FIELD_TYPES.NUMBER]: { name: 'Number', icon: 'tokenNumber' },
27-
[JOB_FIELD_TYPES.TEXT]: { name: 'Text', icon: 'tokenString' },
28-
[JOB_FIELD_TYPES.UNKNOWN]: { name: 'Unknown' },
29-
};
17+
import { JOB_FIELD_TYPES_OPTIONS } from '../../../../../common';
3018

3119
interface Props {
3220
fields: Array<FileBasedFieldVisConfig | FileBasedUnknownFieldVisConfig>;

x-pack/plugins/data_visualizer/public/application/index_data_visualizer/components/search_panel/field_type_filter.tsx

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,18 @@
88
import React, { FC, useMemo } from 'react';
99
import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
1010
import { i18n } from '@kbn/i18n';
11-
import { JOB_FIELD_TYPES, JobFieldType } from '../../../../../common';
11+
import { JOB_FIELD_TYPES_OPTIONS, JobFieldType } from '../../../../../common';
1212
import { FieldTypeIcon } from '../../../common/components/field_type_icon';
1313
import { MultiSelectPicker, Option } from '../../../common/components/multi_select_picker';
1414

15-
const ML_JOB_FIELD_TYPES_OPTIONS = {
16-
[JOB_FIELD_TYPES.BOOLEAN]: { name: 'Boolean', icon: 'tokenBoolean' },
17-
[JOB_FIELD_TYPES.DATE]: { name: 'Date', icon: 'tokenDate' },
18-
[JOB_FIELD_TYPES.GEO_POINT]: { name: 'Geo point', icon: 'tokenGeo' },
19-
[JOB_FIELD_TYPES.GEO_SHAPE]: { name: 'Geo shape', icon: 'tokenGeo' },
20-
[JOB_FIELD_TYPES.IP]: { name: 'IP address', icon: 'tokenIP' },
21-
[JOB_FIELD_TYPES.KEYWORD]: { name: 'Keyword', icon: 'tokenKeyword' },
22-
[JOB_FIELD_TYPES.NUMBER]: { name: 'Number', icon: 'tokenNumber' },
23-
[JOB_FIELD_TYPES.TEXT]: { name: 'Text', icon: 'tokenString' },
24-
[JOB_FIELD_TYPES.UNKNOWN]: { name: 'Unknown' },
25-
};
26-
2715
export const DatavisualizerFieldTypeFilter: FC<{
2816
indexedFieldTypes: JobFieldType[];
2917
setVisibleFieldTypes(q: string[]): void;
3018
visibleFieldTypes: string[];
3119
}> = ({ indexedFieldTypes, setVisibleFieldTypes, visibleFieldTypes }) => {
3220
const options: Option[] = useMemo(() => {
3321
return indexedFieldTypes.map((indexedFieldName) => {
34-
const item = ML_JOB_FIELD_TYPES_OPTIONS[indexedFieldName];
22+
const item = JOB_FIELD_TYPES_OPTIONS[indexedFieldName];
3523

3624
return {
3725
value: indexedFieldName,

0 commit comments

Comments
 (0)