Skip to content

Commit

Permalink
[7.9] [Metrics UI] Fix alert previews of ungrouped alerts (#73735) (#…
Browse files Browse the repository at this point in the history
…73912)

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
  • Loading branch information
Zacqary and elasticmachine authored Jul 31, 2020
1 parent ec7dd91 commit 1223282
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,11 @@ export const Expressions: React.FC<Props> = (props) => {
[onFilterChange]
);

const groupByPreviewDisplayName = useMemo(() => {
if (Array.isArray(alertParams.groupBy)) return alertParams.groupBy.join(', ');
return alertParams.groupBy;
}, [alertParams.groupBy]);

return (
<>
<EuiSpacer size={'m'} />
Expand Down Expand Up @@ -400,7 +405,7 @@ export const Expressions: React.FC<Props> = (props) => {
showNoDataResults={alertParams.alertOnNoData}
validate={validateMetricThreshold}
fetch={alertsContext.http.fetch}
groupByDisplayName={alertParams.groupBy}
groupByDisplayName={groupByPreviewDisplayName}
/>
<EuiSpacer size={'m'} />
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ interface Props {
derivedIndexPattern: IIndexPattern;
source: InfraSource | null;
filterQuery?: string;
groupBy?: string;
groupBy?: string | string[];
}

const tooltipProps = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const useMetricsExplorerChartData = (
derivedIndexPattern: IIndexPattern,
source: InfraSource | null,
filterQuery?: string,
groupBy?: string
groupBy?: string | string[]
) => {
const { timeSize, timeUnit } = expression || { timeSize: 1, timeUnit: 'm' };
const options: MetricsExplorerOptions = useMemo(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export interface ExpressionChartData {

export interface AlertParams {
criteria: MetricExpression[];
groupBy?: string;
groupBy?: string[];
filterQuery?: string;
sourceId?: string;
filterQueryText?: string;
Expand Down

0 comments on commit 1223282

Please sign in to comment.