Fix the case with empty field (#34745) (#34867)

This commit is contained in:
Daniil Suleiman 2019-04-10 18:16:56 +03:00 committed by GitHub
parent 2c008eeb2f
commit 6de340055f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -18,13 +18,20 @@
*/
import React from 'react';
import { get } from 'lodash';
import { EuiSpacer, EuiSwitch, EuiToolTip } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { AggParamEditorProps } from 'ui/vis/editors/default';
import { AggConfig } from 'ui/vis';
function shouldShow(agg: AggConfig): boolean {
const fieldName = get(agg, 'params.field.name');
return fieldName && fieldName === agg.getIndexPattern().timeFieldName;
}
function DropPartialsParamEditor({ agg, aggParam, value, setValue }: AggParamEditorProps<boolean>) {
if (agg.params.field.name !== agg.getIndexPattern().timeFieldName) {
if (!shouldShow(agg)) {
return null;
}