Remove aggregates from metric options if datasource has no columns (#7586)

This commit is contained in:
michellethomas
2019-05-24 11:10:35 -07:00
committed by GitHub
parent 20143293eb
commit 47ba2ad394
2 changed files with 15 additions and 3 deletions

View File

@@ -85,6 +85,14 @@ describe('MetricsControl', () => {
]);
});
it('does not show aggregates in options if no columns', () => {
const { wrapper } = setup({ columns: [] });
expect(wrapper.state('options')).toEqual([
{ optionName: 'sum__value', metric_name: 'sum__value', expression: 'SUM(energy_usage.value)' },
{ optionName: 'avg__value', metric_name: 'avg__value', expression: 'AVG(energy_usage.value)' },
]);
});
it('coerces Adhoc Metrics from form data into instances of the AdhocMetric class and leaves saved metrics', () => {
const { wrapper } = setup({
value: [