Skip to content

Commit

Permalink
[Lens] Pass user messages to the config panel (elastic#172791)
Browse files Browse the repository at this point in the history
## Summary

Fixes elastic#169175
  • Loading branch information
mbondyra authored Dec 7, 2023
1 parent a324547 commit 8f7a12c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export function LayerConfiguration({
framePublicAPI,
hasPadding,
setIsInlineFlyoutVisible,
getUserMessages,
}: LayerConfigurationProps) {
const dispatch = useLensDispatch();
const { euiTheme } = useEuiTheme();
Expand Down Expand Up @@ -58,6 +59,7 @@ export function LayerConfiguration({
hideLayerHeader: datasourceId === 'textBased',
indexPatternService,
setIsInlineFlyoutVisible,
getUserMessages,
};
return (
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import type { EditConfigPanelProps } from './types';
import { FlyoutWrapper } from './flyout_wrapper';
import { getSuggestions } from './helpers';
import { SuggestionPanel } from '../../../editor_frame_service/editor_frame/suggestion_panel';
import { useApplicationUserMessages } from '../../get_application_user_messages';

export function LensEditConfigurationFlyout({
attributes,
Expand Down Expand Up @@ -220,6 +221,18 @@ export function LensEditConfigurationFlyout({
datasourceMap,
]);

const { getUserMessages } = useApplicationUserMessages({
coreStart,
framePublicAPI,
activeDatasourceId: datasourceId,
datasourceState: datasourceStates[datasourceId],
datasource: datasourceMap[datasourceId],
dispatch,
visualization: activeVisualization,
visualizationType: visualization.activeId,
visualizationState: visualization,
});

// needed for text based languages mode which works ONLY with adHoc dataviews
const adHocDataViews = Object.values(attributes.state.adHocDataViews ?? {});

Expand Down Expand Up @@ -265,6 +278,7 @@ export function LensEditConfigurationFlyout({
attributesChanged={attributesChanged}
>
<LayerConfiguration
getUserMessages={getUserMessages}
attributes={attributes}
coreStart={coreStart}
startDependencies={startDependencies}
Expand Down Expand Up @@ -394,6 +408,7 @@ export function LensEditConfigurationFlyout({
>
<LayerConfiguration
attributes={attributes}
getUserMessages={getUserMessages}
coreStart={coreStart}
startDependencies={startDependencies}
visualizationMap={visualizationMap}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ import type { Observable } from 'rxjs';
import type { CoreStart } from '@kbn/core/public';
import type { TypedLensByValueInput } from '../../../embeddable/embeddable_component';
import type { LensPluginStartDependencies } from '../../../plugin';
import type { DatasourceMap, VisualizationMap, FramePublicAPI } from '../../../types';
import type {
DatasourceMap,
VisualizationMap,
FramePublicAPI,
UserMessagesGetter,
} from '../../../types';
import type { LensEmbeddableOutput } from '../../../embeddable';
import type { LensInspector } from '../../../lens_inspector_service';
import type { Document } from '../../../persistence';
Expand Down Expand Up @@ -82,4 +87,5 @@ export interface LayerConfigurationProps {
framePublicAPI: FramePublicAPI;
hasPadding?: boolean;
setIsInlineFlyoutVisible: (flag: boolean) => void;
getUserMessages: UserMessagesGetter;
}

0 comments on commit 8f7a12c

Please sign in to comment.