-
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.
[TSVB] Add support for histogram type (#68837)
* [TSVB] Add support for histogram type * Merge branch 'master' of github.com:elastic/kibana into issue-52426-tsvb-support-for-histograms * Adding support to filter ratio; updating test * Limist aggs for filter_ratio and histogram fields; add test for AggSelect; Fixes #70984 * Ensure only compatible fields are displayed for filter ratio metric aggs Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
- Loading branch information
1 parent
c5729b8
commit 1a65900
Showing
13 changed files
with
580 additions
and
13 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
184 changes: 184 additions & 0 deletions
184
src/plugins/vis_type_timeseries/public/application/components/aggs/agg_select.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,184 @@ | ||
/* | ||
* 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 React from 'react'; | ||
import { mountWithIntl } from 'test_utils/enzyme_helpers'; | ||
import { AggSelect } from './agg_select'; | ||
import { METRIC, SERIES } from '../../../test_utils'; | ||
import { EuiComboBox } from '@elastic/eui'; | ||
|
||
describe('TSVB AggSelect', () => { | ||
const setup = (panelType: string, value: string) => { | ||
const metric = { | ||
...METRIC, | ||
type: 'filter_ratio', | ||
field: 'histogram_value', | ||
}; | ||
const series = { ...SERIES, metrics: [metric] }; | ||
|
||
const wrapper = mountWithIntl( | ||
<div> | ||
<AggSelect | ||
id="test" | ||
onChange={jest.fn()} | ||
panelType={panelType} | ||
value={value} | ||
siblings={series.metrics} | ||
/> | ||
</div> | ||
); | ||
return wrapper; | ||
}; | ||
|
||
it('should only display filter ratio compattible aggs', () => { | ||
const wrapper = setup('filter_ratio', 'avg'); | ||
expect(wrapper.find(EuiComboBox).props().options).toMatchInlineSnapshot(` | ||
Array [ | ||
Object { | ||
"label": "Average", | ||
"value": "avg", | ||
}, | ||
Object { | ||
"label": "Cardinality", | ||
"value": "cardinality", | ||
}, | ||
Object { | ||
"label": "Count", | ||
"value": "count", | ||
}, | ||
Object { | ||
"label": "Positive Rate", | ||
"value": "positive_rate", | ||
}, | ||
Object { | ||
"label": "Max", | ||
"value": "max", | ||
}, | ||
Object { | ||
"label": "Min", | ||
"value": "min", | ||
}, | ||
Object { | ||
"label": "Sum", | ||
"value": "sum", | ||
}, | ||
Object { | ||
"label": "Value Count", | ||
"value": "value_count", | ||
}, | ||
] | ||
`); | ||
}); | ||
|
||
it('should only display histogram compattible aggs', () => { | ||
const wrapper = setup('histogram', 'avg'); | ||
expect(wrapper.find(EuiComboBox).props().options).toMatchInlineSnapshot(` | ||
Array [ | ||
Object { | ||
"label": "Average", | ||
"value": "avg", | ||
}, | ||
Object { | ||
"label": "Count", | ||
"value": "count", | ||
}, | ||
Object { | ||
"label": "Sum", | ||
"value": "sum", | ||
}, | ||
Object { | ||
"label": "Value Count", | ||
"value": "value_count", | ||
}, | ||
] | ||
`); | ||
}); | ||
|
||
it('should only display metrics compattible aggs', () => { | ||
const wrapper = setup('metrics', 'avg'); | ||
expect(wrapper.find(EuiComboBox).props().options).toMatchInlineSnapshot(` | ||
Array [ | ||
Object { | ||
"label": "Average", | ||
"value": "avg", | ||
}, | ||
Object { | ||
"label": "Cardinality", | ||
"value": "cardinality", | ||
}, | ||
Object { | ||
"label": "Count", | ||
"value": "count", | ||
}, | ||
Object { | ||
"label": "Filter Ratio", | ||
"value": "filter_ratio", | ||
}, | ||
Object { | ||
"label": "Positive Rate", | ||
"value": "positive_rate", | ||
}, | ||
Object { | ||
"label": "Max", | ||
"value": "max", | ||
}, | ||
Object { | ||
"label": "Min", | ||
"value": "min", | ||
}, | ||
Object { | ||
"label": "Percentile", | ||
"value": "percentile", | ||
}, | ||
Object { | ||
"label": "Percentile Rank", | ||
"value": "percentile_rank", | ||
}, | ||
Object { | ||
"label": "Static Value", | ||
"value": "static", | ||
}, | ||
Object { | ||
"label": "Std. Deviation", | ||
"value": "std_deviation", | ||
}, | ||
Object { | ||
"label": "Sum", | ||
"value": "sum", | ||
}, | ||
Object { | ||
"label": "Sum of Squares", | ||
"value": "sum_of_squares", | ||
}, | ||
Object { | ||
"label": "Top Hit", | ||
"value": "top_hit", | ||
}, | ||
Object { | ||
"label": "Value Count", | ||
"value": "value_count", | ||
}, | ||
Object { | ||
"label": "Variance", | ||
"value": "variance", | ||
}, | ||
] | ||
`); | ||
}); | ||
}); |
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.