From 234ffb6175324ee2284c044eaf60c69c8e3d2bd2 Mon Sep 17 00:00:00 2001 From: Wylie Conlon Date: Wed, 11 Sep 2019 15:11:51 -0400 Subject: [PATCH] [lens] Fix usage of EUI after typescript upgrade (#45404) * [lens] Fix usage of EUI after typescript upgrade * Use local fix instead of workaround --- .../editor_frame/suggestion_panel.tsx | 16 +++++++++++----- .../xy_config_panel.test.tsx | 4 ++-- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/x-pack/legacy/plugins/lens/public/editor_frame_plugin/editor_frame/suggestion_panel.tsx b/x-pack/legacy/plugins/lens/public/editor_frame_plugin/editor_frame/suggestion_panel.tsx index 8c63d9d03806d..fc07c2df37d8a 100644 --- a/x-pack/legacy/plugins/lens/public/editor_frame_plugin/editor_frame/suggestion_panel.tsx +++ b/x-pack/legacy/plugins/lens/public/editor_frame_plugin/editor_frame/suggestion_panel.tsx @@ -18,6 +18,10 @@ import { debouncedComponent } from '../../debounced_component'; const MAX_SUGGESTIONS_DISPLAYED = 5; +// TODO: Remove this when upstream fix is merged https://github.com/elastic/eui/issues/2329 +// eslint-disable-next-line +const EuiPanelFixed = EuiPanel as React.ComponentType; + export interface SuggestionPanelProps { activeDatasourceId: string | null; datasourceMap: Record; @@ -55,15 +59,17 @@ const SuggestionPreview = ({ setExpressionError(false); }, [previewExpression]); + const clickHandler = () => { + switchToSuggestion(frame, dispatch, suggestion); + }; + return ( - { - switchToSuggestion(frame, dispatch, suggestion); - }} + onClick={clickHandler} > {expressionError ? (
@@ -94,7 +100,7 @@ const SuggestionPreview = ({
)} -
+
); }; diff --git a/x-pack/legacy/plugins/lens/public/xy_visualization_plugin/xy_config_panel.test.tsx b/x-pack/legacy/plugins/lens/public/xy_visualization_plugin/xy_config_panel.test.tsx index 305cda47b3e19..ad08b8949f3b9 100644 --- a/x-pack/legacy/plugins/lens/public/xy_visualization_plugin/xy_config_panel.test.tsx +++ b/x-pack/legacy/plugins/lens/public/xy_visualization_plugin/xy_config_panel.test.tsx @@ -118,7 +118,7 @@ describe('XYConfigPanel', () => { .first() .prop('options') as EuiButtonGroupProps['options']; - expect(options.map(({ id }) => id)).toEqual([ + expect(options!.map(({ id }) => id)).toEqual([ 'bar', 'bar_stacked', 'line', @@ -126,7 +126,7 @@ describe('XYConfigPanel', () => { 'area_stacked', ]); - expect(options.filter(({ isDisabled }) => isDisabled).map(({ id }) => id)).toEqual([]); + expect(options!.filter(({ isDisabled }) => isDisabled).map(({ id }) => id)).toEqual([]); }); test('the x dimension panel accepts only bucketed operations', () => {