From 63e40279fd029b5c0ff990901432701660178333 Mon Sep 17 00:00:00 2001
From: Marco Liberati
Date: Thu, 25 Feb 2021 09:42:08 +0100
Subject: [PATCH] [Lens] Fixes vertical alignment validation messages (#91878)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Michael Marcialis
---
.../workspace_panel/workspace_panel.tsx | 149 ++++++++++--------
1 file changed, 85 insertions(+), 64 deletions(-)
diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel.tsx b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel.tsx
index d5c0b9ff64807f..af5411dd4d3b05 100644
--- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel.tsx
+++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel.tsx
@@ -11,9 +11,9 @@ import { FormattedMessage } from '@kbn/i18n/react';
import { Ast } from '@kbn/interpreter/common';
import { i18n } from '@kbn/i18n';
import {
+ EuiEmptyPrompt,
EuiFlexGroup,
EuiFlexItem,
- EuiIcon,
EuiText,
EuiButtonEmpty,
EuiLink,
@@ -389,72 +389,84 @@ export const InnerVisualizationWrapper = ({
if (localState.configurationValidationError?.length) {
let showExtraErrors = null;
+ let showExtraErrorsAction = null;
+
if (localState.configurationValidationError.length > 1) {
if (localState.expandError) {
showExtraErrors = localState.configurationValidationError
.slice(1)
.map(({ longMessage }) => (
-
{longMessage}
-
+
));
} else {
- showExtraErrors = (
-
- {
- setLocalState((prevState: WorkspaceState) => ({
- ...prevState,
- expandError: !prevState.expandError,
- }));
- }}
- data-test-subj="configuration-failure-more-errors"
- >
- {i18n.translate('xpack.lens.editorFrame.configurationFailureMoreErrors', {
- defaultMessage: ` +{errors} {errors, plural, one {error} other {errors}}`,
- values: { errors: localState.configurationValidationError.length - 1 },
- })}
-
-
+ showExtraErrorsAction = (
+ {
+ setLocalState((prevState: WorkspaceState) => ({
+ ...prevState,
+ expandError: !prevState.expandError,
+ }));
+ }}
+ data-test-subj="configuration-failure-more-errors"
+ >
+ {i18n.translate('xpack.lens.editorFrame.configurationFailureMoreErrors', {
+ defaultMessage: ` +{errors} {errors, plural, one {error} other {errors}}`,
+ values: { errors: localState.configurationValidationError.length - 1 },
+ })}
+
);
}
}
return (
-
+
-
-
-
- {localState.configurationValidationError[0].longMessage}
+
+
+ {localState.configurationValidationError[0].longMessage}
+
+
+ {showExtraErrors}
+ >
+ }
+ iconColor="danger"
+ iconType="alert"
+ />
- {showExtraErrors}
);
}
if (localState.expressionBuildError?.length) {
return (
-
+
-
-
-
-
+
+
+
+
+ {localState.expressionBuildError[0].longMessage}
+ >
+ }
+ iconColor="danger"
+ iconType="alert"
/>
- {localState.expressionBuildError[0].longMessage}
);
}
@@ -474,34 +486,43 @@ export const InnerVisualizationWrapper = ({
const visibleErrorMessage = getOriginalRequestErrorMessage(error) || errorMessage;
return (
-
+
-
-
-
- {
+ setLocalState((prevState: WorkspaceState) => ({
+ ...prevState,
+ expandError: !prevState.expandError,
+ }));
+ }}
+ >
+ {i18n.translate('xpack.lens.editorFrame.expandRenderingErrorButton', {
+ defaultMessage: 'Show details of error',
+ })}
+
+ ) : null
+ }
+ body={
+ <>
+
+
+
+
+ {localState.expandError ? (
+ visibleErrorMessage
+ ) : null}
+ >
+ }
+ iconColor="danger"
+ iconType="alert"
/>
- {visibleErrorMessage ? (
-
- {
- setLocalState((prevState: WorkspaceState) => ({
- ...prevState,
- expandError: !prevState.expandError,
- }));
- }}
- >
- {i18n.translate('xpack.lens.editorFrame.expandRenderingErrorButton', {
- defaultMessage: 'Show details of error',
- })}
-
-
- {localState.expandError ? visibleErrorMessage : null}
-
- ) : null}
);
}}