-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* EUIficate agg-select * Improve validation; update TS * Apply styles for helpLink * Fix unit test * Update functional tests * Adjust comboBox service to chose the item where the text mates exactly * Update vis page object * Add default value for agg * Move aggs grouping function to a separate file * Use labelAppend prop for help link node * Add watcher for aggType to manage to discard changes * Add default value for agg type title * Fix defining selected option when aggType is defined * Fix validation issues * Remove a bootstrap specific class * Change css selector in test * Update according to SASS guidelines * Update functinal comboBox service * Added check for undefined * Add jsdoc for groupAggregationsBy function * Add unit tests for groupAggregationsBy * Move setValidity invocation to DefaultEditorAggSelect component * Wrap setValidity into useEffect due to react warning when select is cleaned at the first time * Move help link definition to select component
- Loading branch information
1 parent
4f7ba11
commit 1e56476
Showing
13 changed files
with
538 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
194 changes: 194 additions & 0 deletions
194
src/legacy/ui/public/vis/editors/default/__tests__/default_editor_utils.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,194 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import { groupAggregationsBy } from '../default_editor_utils'; | ||
|
||
const aggs = [ | ||
{ | ||
title: 'Count', | ||
type: 'metrics', | ||
subtype: 'Metric Aggregations', | ||
}, | ||
{ | ||
title: 'Average', | ||
type: 'metrics', | ||
subtype: 'Metric Aggregations', | ||
}, | ||
{ | ||
title: 'Cumulative Sum', | ||
type: 'metrics', | ||
subtype: 'Parent Pipeline Aggregations', | ||
}, | ||
{ | ||
title: 'Min Bucket', | ||
type: 'metrics', | ||
subtype: 'Parent Pipeline Aggregations', | ||
}, | ||
{ | ||
title: 'Sub string agg', | ||
type: 'string', | ||
subtype: 'Sub-String aggregations', | ||
}, | ||
{ | ||
title: 'String agg', | ||
type: 'string', | ||
subtype: 'String aggregations', | ||
}, | ||
]; | ||
|
||
describe('Default Editor groupAggregationsBy', () => { | ||
it('should return aggs grouped by default type field', () => { | ||
const groupedAggs = [ | ||
{ | ||
label: 'metrics', | ||
options: [ | ||
{ | ||
label: 'Average', | ||
value: { | ||
title: 'Average', | ||
type: 'metrics', | ||
subtype: 'Metric Aggregations', | ||
}, | ||
}, | ||
{ | ||
label: 'Count', | ||
value: { | ||
title: 'Count', | ||
type: 'metrics', | ||
subtype: 'Metric Aggregations', | ||
}, | ||
}, | ||
{ | ||
label: 'Cumulative Sum', | ||
value: { | ||
title: 'Cumulative Sum', | ||
type: 'metrics', | ||
subtype: 'Parent Pipeline Aggregations', | ||
}, | ||
}, | ||
|
||
{ | ||
label: 'Min Bucket', | ||
value: { | ||
title: 'Min Bucket', | ||
type: 'metrics', | ||
subtype: 'Parent Pipeline Aggregations', | ||
}, | ||
}, | ||
], | ||
}, | ||
{ | ||
label: 'string', | ||
options: [ | ||
{ | ||
label: 'String agg', | ||
value: { | ||
title: 'String agg', | ||
type: 'string', | ||
subtype: 'String aggregations', | ||
}, | ||
}, | ||
{ | ||
label: 'Sub string agg', | ||
value: { | ||
title: 'Sub string agg', | ||
type: 'string', | ||
subtype: 'Sub-String aggregations', | ||
}, | ||
}, | ||
], | ||
}, | ||
]; | ||
expect(groupAggregationsBy(aggs)).toEqual(groupedAggs); | ||
}); | ||
it('should return aggs grouped by subtype field', () => { | ||
const groupedAggs = [ | ||
{ | ||
label: 'Metric Aggregations', | ||
options: [ | ||
{ | ||
label: 'Average', | ||
value: { | ||
title: 'Average', | ||
type: 'metrics', | ||
subtype: 'Metric Aggregations', | ||
}, | ||
}, | ||
{ | ||
label: 'Count', | ||
value: { | ||
title: 'Count', | ||
type: 'metrics', | ||
subtype: 'Metric Aggregations', | ||
}, | ||
}, | ||
], | ||
}, | ||
{ | ||
label: 'Parent Pipeline Aggregations', | ||
options: [ | ||
{ | ||
label: 'Cumulative Sum', | ||
value: { | ||
title: 'Cumulative Sum', | ||
type: 'metrics', | ||
subtype: 'Parent Pipeline Aggregations', | ||
}, | ||
}, | ||
|
||
{ | ||
label: 'Min Bucket', | ||
value: { | ||
title: 'Min Bucket', | ||
type: 'metrics', | ||
subtype: 'Parent Pipeline Aggregations', | ||
}, | ||
}, | ||
], | ||
}, | ||
{ | ||
label: 'String aggregations', | ||
options: [ | ||
{ | ||
label: 'String agg', | ||
value: { | ||
title: 'String agg', | ||
type: 'string', | ||
subtype: 'String aggregations', | ||
}, | ||
}, | ||
], | ||
}, | ||
{ | ||
label: 'Sub-String aggregations', | ||
options: [ | ||
{ | ||
label: 'Sub string agg', | ||
value: { | ||
title: 'Sub string agg', | ||
type: 'string', | ||
subtype: 'Sub-String aggregations', | ||
}, | ||
}, | ||
], | ||
}, | ||
]; | ||
expect(groupAggregationsBy(aggs, 'subtype')).toEqual(groupedAggs); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -222,5 +222,6 @@ | |
} | ||
|
||
.visEditorSidebar__aggParamFormRow { | ||
margin-top: $euiSizeS; | ||
margin-bottom: $euiSizeS; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.