44 * you may not use this file except in compliance with the Elastic License.
55 */
66import React from 'react' ;
7- import { isEmpty } from 'lodash' ;
7+ import { i18n } from '@kbn/i18n' ;
8+ import isEmpty from 'lodash/isEmpty' ;
89
910import './brace_imports' ;
10-
1111import {
1212 EuiForm ,
1313 EuiButton ,
@@ -25,6 +25,17 @@ import { GrokdebuggerRequest } from '../../models/grokdebugger_request';
2525import { withKibana } from '../../../../../../src/plugins/kibana_react/public' ;
2626import { 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+
2839export 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