Skip to content

Commit

Permalink
make use of currentLayerType consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasneirynck committed Sep 22, 2020
1 parent debec1e commit 0b9fe76
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 71 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import React, { Fragment, Component } from 'react';

import { GRID_RESOLUTION, LAYER_TYPE, RENDER_AS } from '../../../../common/constants';
import { GRID_RESOLUTION, LAYER_TYPE } from '../../../../common/constants';
import { MetricsEditor } from '../../../components/metrics_editor';
import { getIndexPatternService } from '../../../kibana_services';
import { ResolutionEditor } from './resolution_editor';
Expand Down Expand Up @@ -89,13 +89,13 @@ export class UpdateSourceEditor extends Component {

_renderMetricsPanel() {
const metricsFilter =
this.props.renderAs === RENDER_AS.HEATMAP
this.props.currentLayerType === LAYER_TYPE.HEATMAP
? (metric) => {
//these are countable metrics, where blending heatmap color blobs make sense
return isMetricCountable(metric.value);
}
: null;
const allowMultipleMetrics = this.props.renderAs !== RENDER_AS.HEATMAP;
const allowMultipleMetrics = this.props.currentLayerType !== LAYER_TYPE.HEATMAP;
return (
<EuiPanel>
<EuiTitle size="xs">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,11 @@ describe('source editor geo_grid_source', () => {
});

describe('should put limitations based on heatmap-rendering selection', () => {
test('should not allow super-fine option for heatmaps', async () => {
test('should not allow super-fine option for heatmaps and should not allow multiple metrics', async () => {
const component = shallow(
<UpdateSourceEditor {...defaultProps} currentLayerType={LAYER_TYPE.HEATMAP} />
);
expect(component).toMatchSnapshot();
});
test('should disable multiple metrics', async () => {
const component = shallow(
<UpdateSourceEditor {...defaultProps} renderAs={RENDER_AS.HEATMAP} />
);
expect(component).toMatchSnapshot();
});
});
});

0 comments on commit 0b9fe76

Please sign in to comment.