Skip to content

Commit

Permalink
Add Scripted Field Support in Vis Builder (#6974)
Browse files Browse the repository at this point in the history
Signed-off-by: Suchit Sahoo <[email protected]>
  • Loading branch information
LDrago27 authored Jun 12, 2024
1 parent c2bcc66 commit e74ed2c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe('getAvailableFields', () => {
},
]);

expect(getAvailableFields(fields).length).toBe(1);
expect(getAvailableFields(fields).length).toBe(2);
});

test('should return all fields if filterFieldTypes was not specified', () => {
Expand All @@ -60,6 +60,21 @@ describe('getAvailableFields', () => {
expect(getAvailableFields(fields).length).toBe(2);
});

test('should return scripted fields', () => {
const fields = createIndexFields([
{
name: 'field 1',
scripted: true,
},
{
name: 'field 2',
scripted: true,
},
]);

expect(getAvailableFields(fields).length).toBe(2);
});

test('should filterFieldTypes', () => {
const fields = createIndexFields([
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const getAvailableFields = (
filterFieldTypes: FieldTypes = '*'
) => {
const filteredFields = fields.filter((field: IndexPatternField) => {
if (!field.aggregatable || isNestedField(field) || field.scripted) {
if (!field.aggregatable || isNestedField(field)) {
return false;
}

Expand Down

0 comments on commit e74ed2c

Please sign in to comment.