From 1c1eb2bd9dd015e9c0f9cf5a43c938ef47fcff1b Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Wed, 31 Jul 2019 12:32:18 +0200 Subject: [PATCH] switch default size of terms operation to 3 --- .../operation_definitions/terms.test.tsx | 12 ++++++------ .../operation_definitions/terms.tsx | 4 +++- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/x-pack/legacy/plugins/lens/public/indexpattern_plugin/operation_definitions/terms.test.tsx b/x-pack/legacy/plugins/lens/public/indexpattern_plugin/operation_definitions/terms.test.tsx index 057fc25f84b3b..94411e13fb63c 100644 --- a/x-pack/legacy/plugins/lens/public/indexpattern_plugin/operation_definitions/terms.test.tsx +++ b/x-pack/legacy/plugins/lens/public/indexpattern_plugin/operation_definitions/terms.test.tsx @@ -32,7 +32,7 @@ describe('terms', () => { operationType: 'terms', params: { orderBy: { type: 'alphabetical' }, - size: 5, + size: 3, orderDirection: 'asc', }, sourceField: 'category', @@ -64,7 +64,7 @@ describe('terms', () => { params: expect.objectContaining({ orderBy: '_key', field: 'category', - size: 5, + size: 3, }), }) ); @@ -108,7 +108,7 @@ describe('terms', () => { operationType: 'terms', params: { orderBy: { type: 'column', columnId: 'col1' }, - size: 5, + size: 3, orderDirection: 'asc', }, sourceField: 'category', @@ -139,7 +139,7 @@ describe('terms', () => { operationType: 'terms', params: { orderBy: { type: 'column', columnId: 'col1' }, - size: 5, + size: 3, orderDirection: 'asc', }, sourceField: 'category', @@ -165,7 +165,7 @@ describe('terms', () => { operationType: 'terms', params: { orderBy: { type: 'column', columnId: 'col1' }, - size: 5, + size: 3, orderDirection: 'asc', }, sourceField: 'category', @@ -344,7 +344,7 @@ describe('terms', () => { ); - expect(instance.find(EuiRange).prop('value')).toEqual(5); + expect(instance.find(EuiRange).prop('value')).toEqual(3); }); it('should update state with the size value', () => { diff --git a/x-pack/legacy/plugins/lens/public/indexpattern_plugin/operation_definitions/terms.tsx b/x-pack/legacy/plugins/lens/public/indexpattern_plugin/operation_definitions/terms.tsx index bbab3efdb6b30..912a532621d43 100644 --- a/x-pack/legacy/plugins/lens/public/indexpattern_plugin/operation_definitions/terms.tsx +++ b/x-pack/legacy/plugins/lens/public/indexpattern_plugin/operation_definitions/terms.tsx @@ -34,6 +34,8 @@ function isSortableByColumn(column: IndexPatternColumn) { return !column.isBucketed && column.operationType !== 'filter_ratio'; } +const DEFAULT_SIZE = 3; + export const termsOperation: OperationDefinition = { type: 'terms', displayName: i18n.translate('xpack.lens.indexPattern.terms', { @@ -65,7 +67,7 @@ export const termsOperation: OperationDefinition = { isBucketed: true, indexPatternId, params: { - size: 5, + size: DEFAULT_SIZE, orderBy: existingMetricColumn ? { type: 'column', columnId: existingMetricColumn } : { type: 'alphabetical' },