Skip to content

Commit

Permalink
fix title when equation is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
benakansara committed Jan 30, 2024
1 parent c6779e1 commit 8f8fbd4
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,14 @@ export default function AlertDetailsAppSection({
const generateChartTitle = (criterion: MetricExpression) => {
let equationTitle = '';
const symbolResolver: Record<string, string> = {};
const equation = criterion.equation ?? criterion.metrics.map((m) => m.name).join(' + ');
const equation = criterion.equation
? criterion.equation
: criterion.metrics.map((m) => m.name).join(' + ');

criterion.metrics.forEach(
(metric) =>
(symbolResolver[metric.name] = `${metric.aggType} (${
metric.field ?? metric.filter ?? 'all documents'
metric.field ? metric.field : metric.filter ? metric.filter : 'all documents'
})`)
);

Expand Down

0 comments on commit 8f8fbd4

Please sign in to comment.