mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
Fix static value converter (#144034)
This commit is contained in:
parent
7839589d46
commit
8eeb9e2fa2
2 changed files with 12 additions and 1 deletions
|
@ -47,6 +47,11 @@ describe('convertToStaticValueColumn', () => {
|
|||
[{ series, metrics: [metric], dataView }, { visibleSeriesCount: 1 }],
|
||||
null,
|
||||
],
|
||||
[
|
||||
'null if value is not specified',
|
||||
[{ series, metrics: [metric], dataView }, { visibleSeriesCount: 2 }],
|
||||
null,
|
||||
],
|
||||
[
|
||||
'static value column',
|
||||
[{ series, metrics: [{ ...metric, value: 'some value' }], dataView }],
|
||||
|
|
|
@ -32,6 +32,9 @@ export const convertToStaticValueColumn = (
|
|||
return null;
|
||||
}
|
||||
const currentMetric = metrics[metrics.length - 1];
|
||||
if (!currentMetric.value) {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
operationType: 'static_value',
|
||||
references: [],
|
||||
|
@ -68,7 +71,10 @@ export const convertStaticValueToFormulaColumn = (
|
|||
return null;
|
||||
}
|
||||
const currentMetric = metrics[metrics.length - 1];
|
||||
return createFormulaColumn(currentMetric.value ?? '', {
|
||||
if (!currentMetric.value) {
|
||||
return null;
|
||||
}
|
||||
return createFormulaColumn(currentMetric.value, {
|
||||
series,
|
||||
metric: currentMetric,
|
||||
dataView,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue