[8.12] [Lens] Pass user messages to the config panel (#172791) (#172811)

# Backport

This will backport the following commits from `main` to `8.12`:
- [[Lens] Pass user messages to the config panel
(#172791)](https://github.com/elastic/kibana/pull/172791)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Marta
Bondyra","email":"4283304+mbondyra@users.noreply.github.com"},"sourceCommit":{"committedDate":"2023-12-07T13:10:27Z","message":"[Lens]
Pass user messages to the config panel (#172791)\n\n##
Summary\r\n\r\nFixes
https://github.com/elastic/kibana/issues/169175","sha":"8f7a12cc42b4c0d2e14fc8084e2ab0c479d0aa9f","branchLabelMapping":{"^v8.13.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Visualizations","release_note:skip","Feature:Lens","backport:prev-minor","v8.12.0","v8.13.0"],"number":172791,"url":"https://github.com/elastic/kibana/pull/172791","mergeCommit":{"message":"[Lens]
Pass user messages to the config panel (#172791)\n\n##
Summary\r\n\r\nFixes
https://github.com/elastic/kibana/issues/169175","sha":"8f7a12cc42b4c0d2e14fc8084e2ab0c479d0aa9f"}},"sourceBranch":"main","suggestedTargetBranches":["8.12"],"targetPullRequestStates":[{"branch":"8.12","label":"v8.12.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.13.0","labelRegex":"^v8.13.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/172791","number":172791,"mergeCommit":{"message":"[Lens]
Pass user messages to the config panel (#172791)\n\n##
Summary\r\n\r\nFixes
https://github.com/elastic/kibana/issues/169175","sha":"8f7a12cc42b4c0d2e14fc8084e2ab0c479d0aa9f"}}]}]
BACKPORT-->

Co-authored-by: Marta Bondyra <4283304+mbondyra@users.noreply.github.com>
This commit is contained in:
Kibana Machine 2023-12-07 09:22:03 -05:00 committed by GitHub
parent 14ea230c25
commit 7837193409
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 1 deletions

View file

@ -26,6 +26,7 @@ export function LayerConfiguration({
framePublicAPI,
hasPadding,
setIsInlineFlyoutVisible,
getUserMessages,
}: LayerConfigurationProps) {
const dispatch = useLensDispatch();
const { euiTheme } = useEuiTheme();
@ -58,6 +59,7 @@ export function LayerConfiguration({
hideLayerHeader: datasourceId === 'textBased',
indexPatternService,
setIsInlineFlyoutVisible,
getUserMessages,
};
return (
<div

View file

@ -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,
@ -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 ?? {});
@ -265,6 +278,7 @@ export function LensEditConfigurationFlyout({
attributesChanged={attributesChanged}
>
<LayerConfiguration
getUserMessages={getUserMessages}
attributes={attributes}
coreStart={coreStart}
startDependencies={startDependencies}
@ -394,6 +408,7 @@ export function LensEditConfigurationFlyout({
>
<LayerConfiguration
attributes={attributes}
getUserMessages={getUserMessages}
coreStart={coreStart}
startDependencies={startDependencies}
visualizationMap={visualizationMap}

View file

@ -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';
@ -82,4 +87,5 @@ export interface LayerConfigurationProps {
framePublicAPI: FramePublicAPI;
hasPadding?: boolean;
setIsInlineFlyoutVisible: (flag: boolean) => void;
getUserMessages: UserMessagesGetter;
}