Skip to content

Commit ec41aee

Browse files
committed
filter field list by explorable type
1 parent d4554fb commit ec41aee

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

x-pack/legacy/plugins/graph/public/components/field_manager/field_picker.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,21 @@ function toOptions(
119119
// don't show non-aggregatable fields, except for the case when they are already selected.
120120
// this is necessary to ensure backwards compatibility with existing workspaces that might
121121
// contain non-aggregatable fields.
122-
.filter(field => field.aggregatable || field.selected)
122+
.filter(field => isExplorable(field) || field.selected)
123123
.map(field => ({
124124
label: field.name,
125125
prepend: <FieldIcon type={field.type} size="m" useColor />,
126126
checked: field.selected ? 'on' : undefined,
127127
}))
128128
);
129129
}
130+
131+
const explorableTypes = ['string', 'number', 'date', 'ip', 'boolean'];
132+
133+
function isExplorable(field: WorkspaceField) {
134+
if (!field.aggregatable) {
135+
return false;
136+
}
137+
138+
return explorableTypes.includes(field.type);
139+
}

0 commit comments

Comments
 (0)