From cf707f8b507c9a4ba179833ddc94ae17f27e51e8 Mon Sep 17 00:00:00 2001 From: Stratoula Kalafateli Date: Tue, 5 Nov 2024 18:02:44 +0100 Subject: [PATCH] Fix wrong suggestion --- .../src/map_vis_to_chart_type.ts | 14 +++++++------- packages/kbn-visualization-utils/src/types.ts | 14 +++++++------- .../lens/public/lens_suggestions_api/helpers.ts | 6 +++++- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/packages/kbn-visualization-utils/src/map_vis_to_chart_type.ts b/packages/kbn-visualization-utils/src/map_vis_to_chart_type.ts index de102476c0162..747364226fe3a 100644 --- a/packages/kbn-visualization-utils/src/map_vis_to_chart_type.ts +++ b/packages/kbn-visualization-utils/src/map_vis_to_chart_type.ts @@ -14,13 +14,13 @@ type LensToChartMap = { [K in ValueOf]: ChartType; }; const lensTypesToChartTypes: LensToChartMap = { - [LensVisualizationType.XY]: ChartType.XY, - [LensVisualizationType.Metric]: ChartType.Metric, - [LensVisualizationType.LegacyMetric]: ChartType.Metric, - [LensVisualizationType.Pie]: ChartType.Pie, - [LensVisualizationType.Heatmap]: ChartType.Heatmap, - [LensVisualizationType.Gauge]: ChartType.Gauge, - [LensVisualizationType.Datatable]: ChartType.Table, + [LensVisualizationType.lnsXY]: ChartType.XY, + [LensVisualizationType.lnsMetric]: ChartType.Metric, + [LensVisualizationType.lnsLegacyMetric]: ChartType.Metric, + [LensVisualizationType.lnsPie]: ChartType.Pie, + [LensVisualizationType.lnsHeatmap]: ChartType.Heatmap, + [LensVisualizationType.lnsGauge]: ChartType.Gauge, + [LensVisualizationType.lnsDatatable]: ChartType.Table, }; function isLensVisualizationType(value: string): value is LensVisualizationType { return value in LensVisualizationType; diff --git a/packages/kbn-visualization-utils/src/types.ts b/packages/kbn-visualization-utils/src/types.ts index cd73cbea20631..90851c2c24253 100644 --- a/packages/kbn-visualization-utils/src/types.ts +++ b/packages/kbn-visualization-utils/src/types.ts @@ -62,11 +62,11 @@ export enum ChartType { } export enum LensVisualizationType { - XY = 'lnsXY', - Metric = 'lnsMetric', - Pie = 'lnsPie', - Heatmap = 'lnsHeatmap', - Gauge = 'lnsGauge', - Datatable = 'lnsDatatable', - LegacyMetric = 'lnsLegacyMetric', + lnsXY = 'lnsXY', + lnsMetric = 'lnsMetric', + lnsPie = 'lnsPie', + lnsHeatmap = 'lnsHeatmap', + lnsGauge = 'lnsGauge', + lnsDatatable = 'lnsDatatable', + lnsLegacyMetric = 'lnsLegacyMetric', } diff --git a/x-pack/plugins/lens/public/lens_suggestions_api/helpers.ts b/x-pack/plugins/lens/public/lens_suggestions_api/helpers.ts index 6a402b07ea05f..394d32e8c5bb7 100644 --- a/x-pack/plugins/lens/public/lens_suggestions_api/helpers.ts +++ b/x-pack/plugins/lens/public/lens_suggestions_api/helpers.ts @@ -65,7 +65,11 @@ export function mergeSuggestionWithVisContext({ keptLayerIds: layerIds, datasourceState, datasourceId, - } as Suggestion; + columns: suggestion.columns, + changeType: suggestion.changeType, + score: suggestion.score, + previewIcon: suggestion.previewIcon, + }; } catch { return suggestion; }