[Metrics UI] Fix alert previews of ungrouped alerts (#73735)
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
parent
0a5427842b
commit
d3f498af9a
|
@ -256,6 +256,11 @@ export const Expressions: React.FC<Props> = (props) => {
|
||||||
[onFilterChange]
|
[onFilterChange]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const groupByPreviewDisplayName = useMemo(() => {
|
||||||
|
if (Array.isArray(alertParams.groupBy)) return alertParams.groupBy.join(', ');
|
||||||
|
return alertParams.groupBy;
|
||||||
|
}, [alertParams.groupBy]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<EuiSpacer size={'m'} />
|
<EuiSpacer size={'m'} />
|
||||||
|
@ -400,7 +405,7 @@ export const Expressions: React.FC<Props> = (props) => {
|
||||||
showNoDataResults={alertParams.alertOnNoData}
|
showNoDataResults={alertParams.alertOnNoData}
|
||||||
validate={validateMetricThreshold}
|
validate={validateMetricThreshold}
|
||||||
fetch={alertsContext.http.fetch}
|
fetch={alertsContext.http.fetch}
|
||||||
groupByDisplayName={alertParams.groupBy}
|
groupByDisplayName={groupByPreviewDisplayName}
|
||||||
/>
|
/>
|
||||||
<EuiSpacer size={'m'} />
|
<EuiSpacer size={'m'} />
|
||||||
</>
|
</>
|
||||||
|
|
|
@ -45,7 +45,7 @@ interface Props {
|
||||||
derivedIndexPattern: IIndexPattern;
|
derivedIndexPattern: IIndexPattern;
|
||||||
source: InfraSource | null;
|
source: InfraSource | null;
|
||||||
filterQuery?: string;
|
filterQuery?: string;
|
||||||
groupBy?: string;
|
groupBy?: string | string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
const tooltipProps = {
|
const tooltipProps = {
|
||||||
|
|
|
@ -19,7 +19,7 @@ export const useMetricsExplorerChartData = (
|
||||||
derivedIndexPattern: IIndexPattern,
|
derivedIndexPattern: IIndexPattern,
|
||||||
source: InfraSource | null,
|
source: InfraSource | null,
|
||||||
filterQuery?: string,
|
filterQuery?: string,
|
||||||
groupBy?: string
|
groupBy?: string | string[]
|
||||||
) => {
|
) => {
|
||||||
const { timeSize, timeUnit } = expression || { timeSize: 1, timeUnit: 'm' };
|
const { timeSize, timeUnit } = expression || { timeSize: 1, timeUnit: 'm' };
|
||||||
const options: MetricsExplorerOptions = useMemo(
|
const options: MetricsExplorerOptions = useMemo(
|
||||||
|
|
|
@ -53,7 +53,7 @@ export interface ExpressionChartData {
|
||||||
|
|
||||||
export interface AlertParams {
|
export interface AlertParams {
|
||||||
criteria: MetricExpression[];
|
criteria: MetricExpression[];
|
||||||
groupBy?: string;
|
groupBy?: string[];
|
||||||
filterQuery?: string;
|
filterQuery?: string;
|
||||||
sourceId?: string;
|
sourceId?: string;
|
||||||
filterQueryText?: string;
|
filterQueryText?: string;
|
||||||
|
|
Loading…
Reference in a new issue