mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
* Add error when there is no histogram agg when using parent pipeline * Update error message * Update message * Get rid of let
This commit is contained in:
parent
dd43b7d000
commit
94cbec8e5d
1 changed files with 17 additions and 1 deletions
|
@ -26,7 +26,9 @@ import {
|
|||
EuiDraggable,
|
||||
EuiSpacer,
|
||||
EuiPanel,
|
||||
EuiFormErrorText,
|
||||
} from '@elastic/eui';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
import { AggConfig } from '../../../../agg_types/agg_config';
|
||||
import { aggGroupNamesMap, AggGroupNames } from '../agg_groups';
|
||||
|
@ -80,7 +82,15 @@ function DefaultEditorAggGroup({
|
|||
|
||||
const [aggsState, setAggsState] = useReducer(aggGroupReducer, group, initAggsState);
|
||||
|
||||
const isGroupValid = Object.values(aggsState).every(item => item.valid);
|
||||
const bucketsError =
|
||||
lastParentPipelineAggTitle && groupName === AggGroupNames.Buckets && !group.length
|
||||
? i18n.translate('common.ui.aggTypes.buckets.mustHaveBucketErrorMessage', {
|
||||
defaultMessage: 'Add a bucket with "Date Histogram" or "Histogram" aggregation.',
|
||||
description: 'Date Histogram and Histogram should not be translated',
|
||||
})
|
||||
: undefined;
|
||||
|
||||
const isGroupValid = !bucketsError && Object.values(aggsState).every(item => item.valid);
|
||||
const isAllAggsTouched = isInvalidAggsTouched(aggsState);
|
||||
const isMetricAggregationDisabled = useMemo(
|
||||
() => groupName === AggGroupNames.Metrics && getEnabledMetricAggsCount(group) === 1,
|
||||
|
@ -144,6 +154,12 @@ function DefaultEditorAggGroup({
|
|||
<h3>{groupNameLabel}</h3>
|
||||
</EuiTitle>
|
||||
<EuiSpacer size="s" />
|
||||
{bucketsError && (
|
||||
<>
|
||||
<EuiFormErrorText>{bucketsError}</EuiFormErrorText>
|
||||
<EuiSpacer size="s" />
|
||||
</>
|
||||
)}
|
||||
<EuiDroppable droppableId={`agg_group_dnd_${groupName}`}>
|
||||
<>
|
||||
{group.map((agg: AggConfig, index: number) => (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue