Skip to content

Commit fe522ea

Browse files
authored
Merge pull request #5 from MichaelMarcialis/fix/91845
2 parents 9dfb853 + 34fa146 commit fe522ea

File tree

1 file changed

+74
-65
lines changed
  • x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel

1 file changed

+74
-65
lines changed

x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel.tsx

Lines changed: 74 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ import { FormattedMessage } from '@kbn/i18n/react';
1111
import { Ast } from '@kbn/interpreter/common';
1212
import { i18n } from '@kbn/i18n';
1313
import {
14+
EuiEmptyPrompt,
1415
EuiFlexGroup,
1516
EuiFlexItem,
16-
EuiIcon,
1717
EuiText,
1818
EuiButtonEmpty,
1919
EuiLink,
@@ -389,79 +389,83 @@ export const InnerVisualizationWrapper = ({
389389

390390
if (localState.configurationValidationError?.length) {
391391
let showExtraErrors = null;
392+
let showExtraErrorsAction = null;
393+
392394
if (localState.configurationValidationError.length > 1) {
393395
if (localState.expandError) {
394396
showExtraErrors = localState.configurationValidationError
395397
.slice(1)
396398
.map(({ longMessage }) => (
397-
<EuiFlexItem
399+
<p
398400
key={longMessage}
399401
className="eui-textBreakAll"
400402
data-test-subj="configuration-failure-error"
401-
grow={false}
402403
>
403404
{longMessage}
404-
</EuiFlexItem>
405+
</p>
405406
));
406407
} else {
407-
showExtraErrors = (
408-
<EuiFlexItem grow={false}>
409-
<EuiButtonEmpty
410-
onClick={() => {
411-
setLocalState((prevState: WorkspaceState) => ({
412-
...prevState,
413-
expandError: !prevState.expandError,
414-
}));
415-
}}
416-
data-test-subj="configuration-failure-more-errors"
417-
>
418-
{i18n.translate('xpack.lens.editorFrame.configurationFailureMoreErrors', {
419-
defaultMessage: ` +{errors} {errors, plural, one {error} other {errors}}`,
420-
values: { errors: localState.configurationValidationError.length - 1 },
421-
})}
422-
</EuiButtonEmpty>
423-
</EuiFlexItem>
408+
showExtraErrorsAction = (
409+
<EuiButtonEmpty
410+
onClick={() => {
411+
setLocalState((prevState: WorkspaceState) => ({
412+
...prevState,
413+
expandError: !prevState.expandError,
414+
}));
415+
}}
416+
data-test-subj="configuration-failure-more-errors"
417+
>
418+
{i18n.translate('xpack.lens.editorFrame.configurationFailureMoreErrors', {
419+
defaultMessage: ` +{errors} {errors, plural, one {error} other {errors}}`,
420+
values: { errors: localState.configurationValidationError.length - 1 },
421+
})}
422+
</EuiButtonEmpty>
424423
);
425424
}
426425
}
427426

428427
return (
429-
<EuiFlexGroup
430-
style={{ maxWidth: '100%', height: '100%' }}
431-
alignItems="center"
432-
data-test-subj="configuration-failure"
433-
>
428+
<EuiFlexGroup data-test-subj="configuration-failure">
434429
<EuiFlexItem>
435-
<EuiFlexGroup alignItems="center" direction="column">
436-
<EuiFlexItem>
437-
<EuiIcon type="alert" size="xl" color="danger" />
438-
</EuiFlexItem>
439-
<EuiFlexItem className="eui-textBreakAll" data-test-subj="configuration-failure-error">
440-
{localState.configurationValidationError[0].longMessage}
441-
</EuiFlexItem>
442-
{showExtraErrors}
443-
</EuiFlexGroup>
430+
<EuiEmptyPrompt
431+
actions={showExtraErrorsAction}
432+
body={
433+
<>
434+
<p className="eui-textBreakAll" data-test-subj="configuration-failure-error">
435+
{localState.configurationValidationError[0].longMessage}
436+
</p>
437+
438+
{showExtraErrors}
439+
</>
440+
}
441+
iconColor="danger"
442+
iconType="alert"
443+
/>
444444
</EuiFlexItem>
445445
</EuiFlexGroup>
446446
);
447447
}
448448

449449
if (localState.expressionBuildError?.length) {
450450
return (
451-
<EuiFlexGroup style={{ maxWidth: '100%' }} alignItems="center">
451+
<EuiFlexGroup>
452452
<EuiFlexItem>
453-
<EuiFlexGroup alignItems="center" direction="column">
454-
<EuiFlexItem>
455-
<EuiIcon type="alert" size="xl" color="danger" />
456-
</EuiFlexItem>
457-
<EuiFlexItem data-test-subj="expression-failure">
458-
<FormattedMessage
459-
id="xpack.lens.editorFrame.expressionFailure"
460-
defaultMessage="An error occurred in the expression"
461-
/>
462-
</EuiFlexItem>
463-
<EuiFlexItem grow={false}>{localState.expressionBuildError[0].longMessage}</EuiFlexItem>
464-
</EuiFlexGroup>
453+
<EuiEmptyPrompt
454+
body={
455+
<>
456+
<p data-test-subj="expression-failure">
457+
<FormattedMessage
458+
id="xpack.lens.editorFrame.expressionFailure"
459+
defaultMessage="An error occurred in the expression"
460+
/>
461+
</p>
462+
463+
<p>{localState.expressionBuildError[0].longMessage}</p>
464+
</>
465+
}
466+
iconColor="danger"
467+
iconType="alert"
468+
/>
465469
</EuiFlexItem>
466470
</EuiFlexGroup>
467471
);
@@ -482,20 +486,11 @@ export const InnerVisualizationWrapper = ({
482486
const visibleErrorMessage = getOriginalRequestErrorMessage(error) || errorMessage;
483487

484488
return (
485-
<EuiFlexGroup style={{ maxWidth: '100%' }} alignItems="center">
489+
<EuiFlexGroup>
486490
<EuiFlexItem>
487-
<EuiFlexGroup alignItems="center" direction="column">
488-
<EuiFlexItem>
489-
<EuiIcon type="alert" size="xl" color="danger" />
490-
</EuiFlexItem>
491-
<EuiFlexItem data-test-subj="expression-failure">
492-
<FormattedMessage
493-
id="xpack.lens.editorFrame.dataFailure"
494-
defaultMessage="An error occurred when loading data."
495-
/>
496-
</EuiFlexItem>
497-
{visibleErrorMessage ? (
498-
<EuiFlexItem className="eui-textBreakAll" grow={false}>
491+
<EuiEmptyPrompt
492+
actions={
493+
visibleErrorMessage ? (
499494
<EuiButtonEmpty
500495
onClick={() => {
501496
setLocalState((prevState: WorkspaceState) => ({
@@ -508,11 +503,25 @@ export const InnerVisualizationWrapper = ({
508503
defaultMessage: 'Show details of error',
509504
})}
510505
</EuiButtonEmpty>
506+
) : null
507+
}
508+
body={
509+
<>
510+
<p data-test-subj="expression-failure">
511+
<FormattedMessage
512+
id="xpack.lens.editorFrame.dataFailure"
513+
defaultMessage="An error occurred when loading data."
514+
/>
515+
</p>
511516

512-
{localState.expandError ? visibleErrorMessage : null}
513-
</EuiFlexItem>
514-
) : null}{' '}
515-
</EuiFlexGroup>
517+
{localState.expandError ? (
518+
<p className="eui-textBreakAll">visibleErrorMessage</p>
519+
) : null}
520+
</>
521+
}
522+
iconColor="danger"
523+
iconType="alert"
524+
/>
516525
</EuiFlexItem>
517526
</EuiFlexGroup>
518527
);

0 commit comments

Comments
 (0)