From 72028658702cf513c602b5fc7f0eb1839837baa2 Mon Sep 17 00:00:00 2001 From: Marta Bondyra Date: Mon, 9 Nov 2020 13:56:40 +0100 Subject: [PATCH] change names --- .../counter_rate/counter_rate.test.ts | 2 +- .../indexpattern_datasource/counter_rate/index.ts | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/counter_rate/counter_rate.test.ts b/x-pack/plugins/lens/public/indexpattern_datasource/counter_rate/counter_rate.test.ts index e9c5918478510..a18b04cc8fa62 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/counter_rate/counter_rate.test.ts +++ b/x-pack/plugins/lens/public/indexpattern_datasource/counter_rate/counter_rate.test.ts @@ -9,7 +9,7 @@ import { counterRate, CounterRateArgs } from '../counter_rate'; import { Datatable } from 'src/plugins/expressions/public'; import { functionWrapper } from 'src/plugins/expressions/common/expression_functions/specs/tests/utils'; -describe('counter_rate', () => { +describe('lens_counter_rate', () => { const fn = functionWrapper(counterRate); const runFn = (input: Datatable, args: CounterRateArgs) => fn(input, args) as Datatable; diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/counter_rate/index.ts b/x-pack/plugins/lens/public/indexpattern_datasource/counter_rate/index.ts index 89dedd846aaf9..d514922fde754 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/counter_rate/index.ts +++ b/x-pack/plugins/lens/public/indexpattern_datasource/counter_rate/index.ts @@ -16,7 +16,7 @@ export interface CounterRateArgs { } export type ExpressionFunctionCounterRate = ExpressionFunctionDefinition< - 'counter_rate', + 'lens_counter_rate', Datatable, CounterRateArgs, Datatable @@ -52,7 +52,7 @@ export type ExpressionFunctionCounterRate = ExpressionFunctionDefinition< * Missing values (`null` and `undefined`) will be treated as empty strings. */ export const counterRate: ExpressionFunctionCounterRate = { - name: 'counter_rate', + name: 'lens_counter_rate', type: 'datatable', inputTypes: ['datatable'], @@ -94,6 +94,16 @@ export const counterRate: ExpressionFunctionCounterRate = { }, fn(input, { by, inputColumnId, outputColumnId, outputColumnName }) { + const resultColumns = buildResultColumns( + input, + outputColumnId, + inputColumnId, + outputColumnName + ); + + if (!resultColumns) { + return input; + } const previousValues: Partial> = {}; return { ...input,