diff --git a/frontend/src/metabase/lib/schema_metadata.js b/frontend/src/metabase/lib/schema_metadata.js index 16871366e00447e9893d85488abc53486236879c..ef9232dd9e4f5f2fe2cbba0c4185b8c128acf8d2 100644 --- a/frontend/src/metabase/lib/schema_metadata.js +++ b/frontend/src/metabase/lib/schema_metadata.js @@ -472,7 +472,7 @@ export function addValidOperatorsToFields(table) { for (let field of table.fields) { field.valid_operators = getOperators(field, table); } - table.aggregation_options = getAggregators(table); + table.aggregation_options = getAggregatorsWithFields(table); table.breakout_options = getBreakouts(table.fields); return table; } diff --git a/frontend/src/metabase/query_builder/AggregationWidget.jsx b/frontend/src/metabase/query_builder/AggregationWidget.jsx index ea5e4b3d33d28c0d51be19e743488c781f0d5a26..c8369eb0e2dbeccd330d19b8f295364428e7910a 100644 --- a/frontend/src/metabase/query_builder/AggregationWidget.jsx +++ b/frontend/src/metabase/query_builder/AggregationWidget.jsx @@ -7,7 +7,7 @@ import Popover from "metabase/components/Popover.jsx"; import Query from "metabase/lib/query"; import { AggregationClause } from "metabase/lib/query"; -import { getAggregator, getAggregatorsWithFields } from "metabase/lib/schema_metadata"; +import { getAggregator } from "metabase/lib/schema_metadata"; import cx from "classnames"; import _ from "underscore"; @@ -31,17 +31,6 @@ export default class AggregationWidget extends Component { updateAggregation: PropTypes.func.isRequired }; - - componentWillMount() { - this.componentWillReceiveProps(this.props); - } - - componentWillReceiveProps(newProps) { - this.setState({ - availableAggregations: getAggregatorsWithFields(newProps.tableMetadata) - }); - } - setAggregation(aggregation) { this.props.updateAggregation(aggregation); } @@ -104,7 +93,7 @@ export default class AggregationWidget extends Component { > <AggregationPopover aggregation={aggregation} - availableAggregations={this.state.availableAggregations} + availableAggregations={tableMetadata.aggregation_options} tableMetadata={tableMetadata} customFields={this.props.customFields} onCommitAggregation={this.setAggregation}