Rename document count aggregation and add default filter title (#170845)

Closes #166472

## Summary

Rename document count aggregation and add default filter title.



134b9253-eb09-4613-85c4-b262af062338
This commit is contained in:
Maryam Saeidi 2023-11-08 17:12:27 +01:00 committed by GitHub
parent 55d8ea45ac
commit 552e87ba8f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View file

@ -38,6 +38,11 @@ interface MetricRowWithAggProps extends MetricRowBaseProps {
fields: NormalizedFields; fields: NormalizedFields;
} }
const DEFAULT_COUNT_FILTER_TITLE = i18n.translate(
'xpack.observability.customThreshold.rule.alertFlyout.customEquationEditor.defaultCountFilterTitle',
{ defaultMessage: 'all documents' }
);
export function MetricRowWithAgg({ export function MetricRowWithAgg({
name, name,
aggType = Aggregators.COUNT, aggType = Aggregators.COUNT,
@ -126,7 +131,9 @@ export function MetricRowWithAgg({
<EuiExpression <EuiExpression
data-test-subj="aggregationName" data-test-subj="aggregationName"
description={aggregationTypes[aggType].text} description={aggregationTypes[aggType].text}
value={aggType === Aggregators.COUNT ? filter : field} value={
aggType === Aggregators.COUNT ? filter || DEFAULT_COUNT_FILTER_TITLE : field
}
isActive={aggTypePopoverOpen} isActive={aggTypePopoverOpen}
display="columns" display="columns"
onClick={() => { onClick={() => {

View file

@ -292,7 +292,7 @@ export const aggregationType: { [key: string]: AggregationType } = {
text: i18n.translate( text: i18n.translate(
'xpack.observability.customThreshold.rule.alertFlyout.aggregationText.count', 'xpack.observability.customThreshold.rule.alertFlyout.aggregationText.count',
{ {
defaultMessage: 'Document count', defaultMessage: 'Count',
} }
), ),
fieldRequired: false, fieldRequired: false,