Skip to content

Commit bc9bc7d

Browse files
committed
[Grok] Fix missing error message in error toasts (#77499)
1 parent 8576293 commit bc9bc7d

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

x-pack/plugins/grokdebugger/public/components/grok_debugger/grok_debugger.js

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66
import React from 'react';
7-
import { isEmpty } from 'lodash';
7+
import { i18n } from '@kbn/i18n';
8+
import isEmpty from 'lodash/isEmpty';
89

910
import './brace_imports';
10-
1111
import {
1212
EuiForm,
1313
EuiButton,
@@ -25,6 +25,17 @@ import { GrokdebuggerRequest } from '../../models/grokdebugger_request';
2525
import { withKibana } from '../../../../../../src/plugins/kibana_react/public';
2626
import { FormattedMessage } from '@kbn/i18n/react';
2727

28+
const i18nTexts = {
29+
simulate: {
30+
errorTitle: i18n.translate('xpack.grokDebugger.simulate.errorTitle', {
31+
defaultMessage: 'Simulate error',
32+
}),
33+
unknownErrorTitle: i18n.translate('xpack.grokDebugger.unknownErrorTitle', {
34+
defaultMessage: 'Something went wrong',
35+
}),
36+
},
37+
};
38+
2839
export class GrokDebuggerComponent extends React.Component {
2940
constructor(props) {
3041
super(props);
@@ -84,12 +95,13 @@ export class GrokDebuggerComponent extends React.Component {
8495

8596
if (!isEmpty(simulateResponse.error)) {
8697
notifications.toasts.addDanger({
87-
body: simulateResponse.error,
98+
title: i18nTexts.simulate.errorTitle,
99+
text: simulateResponse.error,
88100
});
89101
}
90102
} catch (e) {
91-
notifications.toasts.addDanger({
92-
body: e,
103+
notifications.toasts.addError(e, {
104+
title: i18nTexts.simulate.unknownErrorTitle,
93105
});
94106
}
95107
};

0 commit comments

Comments
 (0)