mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
translate dev-tools-console
This commit is contained in:
parent
573b74b6a2
commit
a0a0b29284
27 changed files with 423 additions and 136 deletions
|
@ -8,11 +8,21 @@
|
|||
|
||||
import { FeatureCatalogueRegistryProvider, FeatureCatalogueCategory } from 'ui/registry/feature_catalogue';
|
||||
|
||||
FeatureCatalogueRegistryProvider.register(() => {
|
||||
FeatureCatalogueRegistryProvider.register(i18n => {
|
||||
return {
|
||||
id: 'grokdebugger',
|
||||
title: 'Grok Debugger',
|
||||
description: 'Simulate and debug grok patterns for data transformation on ingestion.',
|
||||
title: i18n('xpack.grokDebugger.registryProviderTitle', {
|
||||
defaultMessage: '{grokLogParsingTool} Debugger',
|
||||
values: {
|
||||
grokLogParsingTool: 'Grok'
|
||||
}
|
||||
}),
|
||||
description: i18n('xpack.grokDebugger.registryProviderDescription', {
|
||||
defaultMessage: 'Simulate and debug {grokLogParsingTool} patterns for data transformation on ingestion.',
|
||||
values: {
|
||||
grokLogParsingTool: 'grok'
|
||||
}
|
||||
}),
|
||||
icon: 'grokApp',
|
||||
path: '/app/kibana#/dev_tools/grokdebugger',
|
||||
showOnHomePage: false,
|
||||
|
|
|
@ -15,6 +15,7 @@ import {
|
|||
EuiSpacer
|
||||
} from '@elastic/eui';
|
||||
import { EDITOR } from '../../../../../common/constants';
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
|
||||
export function CustomPatternsInput({ value, onChange }) {
|
||||
const sampleCustomPatterns = `POSTFIX_QUEUEID [0-9A-F]{10,11}
|
||||
|
@ -23,14 +24,24 @@ MSG message-id=<%{GREEDYDATA}>`;
|
|||
return (
|
||||
<EuiAccordion
|
||||
id="customPatternsInput"
|
||||
buttonContent="Custom Patterns"
|
||||
buttonContent={(
|
||||
<FormattedMessage
|
||||
id="xpack.grokDebugger.customPatternsButtonLabel"
|
||||
defaultMessage="Custom Patterns"
|
||||
/>
|
||||
)}
|
||||
data-test-subj="btnToggleCustomPatternsInput"
|
||||
>
|
||||
|
||||
<EuiSpacer size="m" />
|
||||
|
||||
<EuiCallOut
|
||||
title="Enter one custom pattern per line. For example:"
|
||||
title={(
|
||||
<FormattedMessage
|
||||
id="xpack.grokDebugger.customPatterns.callOutTitle"
|
||||
defaultMessage="Enter one custom pattern per line. For example:"
|
||||
/>
|
||||
)}
|
||||
>
|
||||
<EuiCodeBlock>
|
||||
{ sampleCustomPatterns }
|
||||
|
|
|
@ -11,11 +11,17 @@ import {
|
|||
EuiCodeEditor
|
||||
} from '@elastic/eui';
|
||||
import { EDITOR } from '../../../../../common/constants';
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
|
||||
export function EventInput({ value, onChange }) {
|
||||
return (
|
||||
<EuiFormRow
|
||||
label="Sample Data"
|
||||
label={(
|
||||
<FormattedMessage
|
||||
id="xpack.grokDebugger.sampleDataLabel"
|
||||
defaultMessage="Sample Data"
|
||||
/>
|
||||
)}
|
||||
fullWidth
|
||||
data-test-subj="aceEventInput"
|
||||
>
|
||||
|
|
|
@ -10,11 +10,17 @@ import {
|
|||
EuiPanel,
|
||||
EuiCodeEditor
|
||||
} from '@elastic/eui';
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
|
||||
export function EventOutput({ value }) {
|
||||
return (
|
||||
<EuiFormRow
|
||||
label="Structured Data"
|
||||
label={(
|
||||
<FormattedMessage
|
||||
id="xpack.grokDebugger.structuredDataLabel"
|
||||
defaultMessage="Structured Data"
|
||||
/>
|
||||
)}
|
||||
fullWidth
|
||||
data-test-subj="aceEventOutput"
|
||||
>
|
||||
|
|
|
@ -20,6 +20,7 @@ import { CustomPatternsInput } from '../custom_patterns_input';
|
|||
import { EventOutput } from '../event_output';
|
||||
import { GrokdebuggerRequest } from '../../../../models/grokdebugger_request';
|
||||
import { toastNotifications } from 'ui/notify';
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
|
||||
export class GrokDebugger extends React.Component {
|
||||
constructor(props) {
|
||||
|
@ -123,7 +124,10 @@ export class GrokDebugger extends React.Component {
|
|||
isDisabled={this.isSimulateDisabled()}
|
||||
data-test-subj="btnSimulate"
|
||||
>
|
||||
Simulate
|
||||
<FormattedMessage
|
||||
id="xpack.grokDebugger.simulateButtonLabel"
|
||||
defaultMessage="Simulate"
|
||||
/>
|
||||
</EuiButton>
|
||||
<EuiSpacer />
|
||||
<EventOutput value={this.state.structuredEvent} />
|
||||
|
|
|
@ -12,11 +12,17 @@ import {
|
|||
} from '@elastic/eui';
|
||||
import { EDITOR } from '../../../../../common/constants';
|
||||
import { GrokMode } from '../../../../lib/ace';
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
|
||||
export function PatternInput({ value, onChange }) {
|
||||
return (
|
||||
<EuiFormRow
|
||||
label="Grok Pattern"
|
||||
label={(
|
||||
<FormattedMessage
|
||||
id="xpack.grokDebugger.grokPatternLabel"
|
||||
defaultMessage="Grok Pattern"
|
||||
/>
|
||||
)}
|
||||
fullWidth
|
||||
data-test-subj="acePatternInput"
|
||||
>
|
||||
|
|
|
@ -9,6 +9,7 @@ import 'plugins/grokdebugger/services/grokdebugger';
|
|||
import { GrokDebugger } from '../../components/grok_debugger';
|
||||
import { render } from 'react-dom';
|
||||
import React from 'react';
|
||||
import { I18nProvider } from '@kbn/i18n/react';
|
||||
|
||||
const app = uiModules.get('xpack/grokdebugger');
|
||||
|
||||
|
@ -18,7 +19,7 @@ app.directive('grokdebugger', function ($injector) {
|
|||
return {
|
||||
restrict: 'E',
|
||||
link: (scope, el) => {
|
||||
render(<GrokDebugger grokdebuggerService={grokdebuggerService} />, el[0]);
|
||||
render(<I18nProvider><GrokDebugger grokdebuggerService={grokdebuggerService} /></I18nProvider>, el[0]);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
|
|
@ -7,12 +7,14 @@
|
|||
import { DevToolsRegistryProvider } from 'ui/registry/dev_tools';
|
||||
import { XPackInfoProvider } from 'plugins/xpack_main/services/xpack_info';
|
||||
|
||||
DevToolsRegistryProvider.register((Private) => {
|
||||
DevToolsRegistryProvider.register((Private, i18n) => {
|
||||
const xpackInfo = Private(XPackInfoProvider);
|
||||
return {
|
||||
order: 6,
|
||||
name: 'grokdebugger',
|
||||
display: 'Grok Debugger',
|
||||
display: i18n('xpack.grokDebugger.displayName', {
|
||||
defaultMessage: 'Grok Debugger',
|
||||
}),
|
||||
url: '#/dev_tools/grokdebugger',
|
||||
disabled: !xpackInfo.get('features.grokdebugger.enableLink', false),
|
||||
tooltipContent: xpackInfo.get('features.grokdebugger.message')
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
export function checkLicense(xpackLicenseInfo) {
|
||||
// If, for some reason, we cannot get the license information
|
||||
// from Elasticsearch, assume worst case and disable the Watcher UI
|
||||
|
@ -11,7 +13,12 @@ export function checkLicense(xpackLicenseInfo) {
|
|||
return {
|
||||
enableLink: false,
|
||||
enableAPIRoute: false,
|
||||
message: 'You cannot use the Grok Debugger because license information is not available at this time.'
|
||||
message: i18n.translate('xpack.grokDebugger.unavailableLicenseInformationMessage', {
|
||||
defaultMessage: 'You cannot use the {grokLogParsingTool} Debugger because license information is not available at this time.',
|
||||
values: {
|
||||
grokLogParsingTool: 'Grok'
|
||||
}
|
||||
}),
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -23,7 +30,13 @@ export function checkLicense(xpackLicenseInfo) {
|
|||
return {
|
||||
enableLink: false,
|
||||
enableAPIRoute: false,
|
||||
message: `You cannot use the Grok Debugger because your ${licenseType} license has expired.`
|
||||
message: i18n.translate('xpack.grokDebugger.licenseHasExpiredMessage', {
|
||||
defaultMessage: 'You cannot use the {grokLogParsingTool} Debugger because your {licenseType} license has expired.',
|
||||
values: {
|
||||
licenseType,
|
||||
grokLogParsingTool: 'Grok'
|
||||
},
|
||||
}),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
import { get, isEmpty, omit } from 'lodash';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
/**
|
||||
* This model captures the grok debugger response from upstream to be passed to
|
||||
|
@ -21,7 +22,14 @@ export class GrokdebuggerResponse {
|
|||
const docs = get(upstreamGrokdebuggerResponse, 'docs');
|
||||
const error = docs[0].error;
|
||||
if (!isEmpty(error)) {
|
||||
const opts = { 'error': 'Provided Grok patterns do not match data in the input' };
|
||||
const opts = { 'error': i18n.translate(
|
||||
'xpack.grokDebugger.patternsErrorMessage', {
|
||||
defaultMessage: 'Provided {grokLogParsingTool} patterns do not match data in the input',
|
||||
values: {
|
||||
grokLogParsingTool: 'Grok'
|
||||
}
|
||||
}
|
||||
), };
|
||||
return new GrokdebuggerResponse(opts);
|
||||
}
|
||||
const structuredEvent = omit(get(docs, '0.doc._source'), 'rawEvent');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue