From 248cba5baed6b0f393bad63f96e4449d4049c29a Mon Sep 17 00:00:00 2001 From: Quynh Nguyen Date: Wed, 2 Feb 2022 10:41:03 -0600 Subject: [PATCH] Fix DV -> lens broken due to records field migration --- x-pack/plugins/data_visualizer/kibana.json | 3 ++- .../components/field_data_row/action_menu/lens_utils.ts | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/x-pack/plugins/data_visualizer/kibana.json b/x-pack/plugins/data_visualizer/kibana.json index 03f21bcde469d..7702a51f915bf 100644 --- a/x-pack/plugins/data_visualizer/kibana.json +++ b/x-pack/plugins/data_visualizer/kibana.json @@ -30,7 +30,8 @@ "esUiShared", "fieldFormats", "uiActions", - "cloud" + "cloud", + "lens" ], "owner": { "name": "Machine Learning UI", diff --git a/x-pack/plugins/data_visualizer/public/application/common/components/field_data_row/action_menu/lens_utils.ts b/x-pack/plugins/data_visualizer/public/application/common/components/field_data_row/action_menu/lens_utils.ts index 3db1795456127..125d030a71e68 100644 --- a/x-pack/plugins/data_visualizer/public/application/common/components/field_data_row/action_menu/lens_utils.ts +++ b/x-pack/plugins/data_visualizer/public/application/common/components/field_data_row/action_menu/lens_utils.ts @@ -19,6 +19,7 @@ import type { } from '../../../../../../../lens/public'; import { FieldVisConfig } from '../../stats_table/types'; import { JOB_FIELD_TYPES } from '../../../../../../common/constants'; +import { DOCUMENT_FIELD_NAME } from '../../../../../../../lens/common/constants'; interface ColumnsAndLayer { columns: Record; @@ -52,7 +53,7 @@ export function getNumberSettings(item: FieldVisConfig, defaultIndexPattern: Ind label: COUNT, dataType: 'number', isBucketed: false, - sourceField: 'Records', + sourceField: DOCUMENT_FIELD_NAME, operationType: 'count', }, }; @@ -107,7 +108,7 @@ export function getDateSettings(item: FieldVisConfig) { label: COUNT, operationType: 'count', scale: 'ratio', - sourceField: 'Records', + sourceField: DOCUMENT_FIELD_NAME, }, col1: { dataType: 'date', @@ -148,7 +149,7 @@ export function getKeywordSettings(item: FieldVisConfig) { label: COUNT, dataType: 'number', isBucketed: false, - sourceField: 'Records', + sourceField: DOCUMENT_FIELD_NAME, operationType: 'count', }, }; @@ -181,7 +182,7 @@ export function getBooleanSettings(item: FieldVisConfig) { label: COUNT, dataType: 'number', isBucketed: false, - sourceField: 'Records', + sourceField: DOCUMENT_FIELD_NAME, operationType: 'count', }, };