Skip to content

Commit

Permalink
Refactor filter_ratio.js
Browse files Browse the repository at this point in the history
  • Loading branch information
DianaDerevyankina committed Aug 21, 2020
1 parent 60081d8 commit b682341
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,13 @@ export const FilterRatioAgg = (props) => {
props.onChange,
]);
const handleSelectChange = createSelectHandler(handleChange);
const handleQueryChange = useCallback((name, value) => handleChange({ [name]: value }), [
const handleNumeratorQueryChange = useCallback((query) => handleChange({ numerator: query }), [
handleChange,
]);
const handleDenominatorQueryChange = useCallback(
(query) => handleChange({ denominator: query }),
[handleChange]
);
const indexPattern =
(series.override_index_pattern && series.series_index_pattern) || panel.index_pattern;

Expand Down Expand Up @@ -108,7 +112,7 @@ export const FilterRatioAgg = (props) => {
>
<QueryBarWrapper
query={model.numerator}
onChange={(query) => handleQueryChange('numerator', query)}
onChange={handleNumeratorQueryChange}
indexPatterns={[indexPattern]}
/>
</EuiFormRow>
Expand All @@ -126,7 +130,7 @@ export const FilterRatioAgg = (props) => {
>
<QueryBarWrapper
query={model.denominator}
onChange={(query) => handleQueryChange('denominator', query)}
onChange={handleDenominatorQueryChange}
indexPatterns={[indexPattern]}
/>
</EuiFormRow>
Expand Down

0 comments on commit b682341

Please sign in to comment.