mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
i18n remove extra span tags (#23529)
remove extra span tags generated by FormattedMessage component translate missed labels
This commit is contained in:
parent
57b1a6ce71
commit
13944bb5c0
36 changed files with 464 additions and 281 deletions
|
@ -133,7 +133,7 @@ Object {
|
|||
"messages": Object {},
|
||||
"now": [Function],
|
||||
"onError": [Function],
|
||||
"textComponent": "span",
|
||||
"textComponent": Symbol(react.fragment),
|
||||
"timeZone": null,
|
||||
}
|
||||
`;
|
||||
|
|
|
@ -133,7 +133,7 @@ Object {
|
|||
"messages": Object {},
|
||||
"now": [Function],
|
||||
"onError": [Function],
|
||||
"textComponent": "span",
|
||||
"textComponent": Symbol(react.fragment),
|
||||
"timeZone": null,
|
||||
}
|
||||
`;
|
||||
|
|
|
@ -43,6 +43,7 @@ export class I18nProvider extends React.PureComponent {
|
|||
defaultLocale={i18n.getDefaultLocale()}
|
||||
formats={i18n.getFormats()}
|
||||
defaultFormats={i18n.getFormats()}
|
||||
textComponent={React.Fragment}
|
||||
>
|
||||
{children}
|
||||
</IntlProvider>
|
||||
|
|
|
@ -19,14 +19,26 @@ exports[`renders dynamic options should display disabled dynamic options with to
|
|||
describedByIds={Array []}
|
||||
fullWidth={false}
|
||||
hasEmptyLabelSpace={false}
|
||||
helpText="Allow multiple selection"
|
||||
helpText={
|
||||
<FormattedMessage
|
||||
defaultMessage="Allow multiple selection"
|
||||
id="inputControl.editor.listControl.multiselectDescription"
|
||||
values={Object {}}
|
||||
/>
|
||||
}
|
||||
id="multiselect-0"
|
||||
key="multiselect"
|
||||
>
|
||||
<EuiSwitch
|
||||
checked={true}
|
||||
data-test-subj="listControlMultiselectInput"
|
||||
label="Multiselect"
|
||||
label={
|
||||
<FormattedMessage
|
||||
defaultMessage="Multiselect"
|
||||
id="inputControl.editor.listControl.multiselectLabel"
|
||||
values={Object {}}
|
||||
/>
|
||||
}
|
||||
onChange={[Function]}
|
||||
/>
|
||||
</EuiFormRow>
|
||||
|
@ -34,7 +46,13 @@ exports[`renders dynamic options should display disabled dynamic options with to
|
|||
describedByIds={Array []}
|
||||
fullWidth={false}
|
||||
hasEmptyLabelSpace={false}
|
||||
helpText="Only available for \\"string\\" fields"
|
||||
helpText={
|
||||
<FormattedMessage
|
||||
defaultMessage="Only available for \\"string\\" fields"
|
||||
id="inputControl.editor.listControl.dynamicOptions.stringFieldDescription"
|
||||
values={Object {}}
|
||||
/>
|
||||
}
|
||||
id="dynamicOptions-0"
|
||||
key="dynamicOptions"
|
||||
>
|
||||
|
@ -42,7 +60,13 @@ exports[`renders dynamic options should display disabled dynamic options with to
|
|||
checked={true}
|
||||
data-test-subj="listControlDynamicOptionsSwitch"
|
||||
disabled={true}
|
||||
label="Dynamic Options"
|
||||
label={
|
||||
<FormattedMessage
|
||||
defaultMessage="Dynamic Options"
|
||||
id="inputControl.editor.listControl.dynamicOptionsLabel"
|
||||
values={Object {}}
|
||||
/>
|
||||
}
|
||||
onChange={[Function]}
|
||||
/>
|
||||
</EuiFormRow>
|
||||
|
@ -50,10 +74,22 @@ exports[`renders dynamic options should display disabled dynamic options with to
|
|||
describedByIds={Array []}
|
||||
fullWidth={false}
|
||||
hasEmptyLabelSpace={false}
|
||||
helpText="Number of options"
|
||||
helpText={
|
||||
<FormattedMessage
|
||||
defaultMessage="Number of options"
|
||||
id="inputControl.editor.listControl.sizeDescription"
|
||||
values={Object {}}
|
||||
/>
|
||||
}
|
||||
id="size-0"
|
||||
key="size"
|
||||
label="Size"
|
||||
label={
|
||||
<FormattedMessage
|
||||
defaultMessage="Size"
|
||||
id="inputControl.editor.listControl.sizeLabel"
|
||||
values={Object {}}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<EuiFieldNumber
|
||||
compressed={false}
|
||||
|
@ -87,14 +123,26 @@ exports[`renders dynamic options should display dynamic options for string field
|
|||
describedByIds={Array []}
|
||||
fullWidth={false}
|
||||
hasEmptyLabelSpace={false}
|
||||
helpText="Allow multiple selection"
|
||||
helpText={
|
||||
<FormattedMessage
|
||||
defaultMessage="Allow multiple selection"
|
||||
id="inputControl.editor.listControl.multiselectDescription"
|
||||
values={Object {}}
|
||||
/>
|
||||
}
|
||||
id="multiselect-0"
|
||||
key="multiselect"
|
||||
>
|
||||
<EuiSwitch
|
||||
checked={true}
|
||||
data-test-subj="listControlMultiselectInput"
|
||||
label="Multiselect"
|
||||
label={
|
||||
<FormattedMessage
|
||||
defaultMessage="Multiselect"
|
||||
id="inputControl.editor.listControl.multiselectLabel"
|
||||
values={Object {}}
|
||||
/>
|
||||
}
|
||||
onChange={[Function]}
|
||||
/>
|
||||
</EuiFormRow>
|
||||
|
@ -102,7 +150,13 @@ exports[`renders dynamic options should display dynamic options for string field
|
|||
describedByIds={Array []}
|
||||
fullWidth={false}
|
||||
hasEmptyLabelSpace={false}
|
||||
helpText="Update options in response to user input"
|
||||
helpText={
|
||||
<FormattedMessage
|
||||
defaultMessage="Update options in response to user input"
|
||||
id="inputControl.editor.listControl.dynamicOptions.updateDescription"
|
||||
values={Object {}}
|
||||
/>
|
||||
}
|
||||
id="dynamicOptions-0"
|
||||
key="dynamicOptions"
|
||||
>
|
||||
|
@ -110,7 +164,13 @@ exports[`renders dynamic options should display dynamic options for string field
|
|||
checked={true}
|
||||
data-test-subj="listControlDynamicOptionsSwitch"
|
||||
disabled={false}
|
||||
label="Dynamic Options"
|
||||
label={
|
||||
<FormattedMessage
|
||||
defaultMessage="Dynamic Options"
|
||||
id="inputControl.editor.listControl.dynamicOptionsLabel"
|
||||
values={Object {}}
|
||||
/>
|
||||
}
|
||||
onChange={[Function]}
|
||||
/>
|
||||
</EuiFormRow>
|
||||
|
@ -136,14 +196,26 @@ exports[`renders dynamic options should display size field when dynamic options
|
|||
describedByIds={Array []}
|
||||
fullWidth={false}
|
||||
hasEmptyLabelSpace={false}
|
||||
helpText="Allow multiple selection"
|
||||
helpText={
|
||||
<FormattedMessage
|
||||
defaultMessage="Allow multiple selection"
|
||||
id="inputControl.editor.listControl.multiselectDescription"
|
||||
values={Object {}}
|
||||
/>
|
||||
}
|
||||
id="multiselect-0"
|
||||
key="multiselect"
|
||||
>
|
||||
<EuiSwitch
|
||||
checked={true}
|
||||
data-test-subj="listControlMultiselectInput"
|
||||
label="Multiselect"
|
||||
label={
|
||||
<FormattedMessage
|
||||
defaultMessage="Multiselect"
|
||||
id="inputControl.editor.listControl.multiselectLabel"
|
||||
values={Object {}}
|
||||
/>
|
||||
}
|
||||
onChange={[Function]}
|
||||
/>
|
||||
</EuiFormRow>
|
||||
|
@ -151,7 +223,13 @@ exports[`renders dynamic options should display size field when dynamic options
|
|||
describedByIds={Array []}
|
||||
fullWidth={false}
|
||||
hasEmptyLabelSpace={false}
|
||||
helpText="Update options in response to user input"
|
||||
helpText={
|
||||
<FormattedMessage
|
||||
defaultMessage="Update options in response to user input"
|
||||
id="inputControl.editor.listControl.dynamicOptions.updateDescription"
|
||||
values={Object {}}
|
||||
/>
|
||||
}
|
||||
id="dynamicOptions-0"
|
||||
key="dynamicOptions"
|
||||
>
|
||||
|
@ -159,7 +237,13 @@ exports[`renders dynamic options should display size field when dynamic options
|
|||
checked={false}
|
||||
data-test-subj="listControlDynamicOptionsSwitch"
|
||||
disabled={false}
|
||||
label="Dynamic Options"
|
||||
label={
|
||||
<FormattedMessage
|
||||
defaultMessage="Dynamic Options"
|
||||
id="inputControl.editor.listControl.dynamicOptionsLabel"
|
||||
values={Object {}}
|
||||
/>
|
||||
}
|
||||
onChange={[Function]}
|
||||
/>
|
||||
</EuiFormRow>
|
||||
|
@ -167,10 +251,22 @@ exports[`renders dynamic options should display size field when dynamic options
|
|||
describedByIds={Array []}
|
||||
fullWidth={false}
|
||||
hasEmptyLabelSpace={false}
|
||||
helpText="Number of options"
|
||||
helpText={
|
||||
<FormattedMessage
|
||||
defaultMessage="Number of options"
|
||||
id="inputControl.editor.listControl.sizeDescription"
|
||||
values={Object {}}
|
||||
/>
|
||||
}
|
||||
id="size-0"
|
||||
key="size"
|
||||
label="Size"
|
||||
label={
|
||||
<FormattedMessage
|
||||
defaultMessage="Size"
|
||||
id="inputControl.editor.listControl.sizeLabel"
|
||||
values={Object {}}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<EuiFieldNumber
|
||||
compressed={false}
|
||||
|
@ -204,10 +300,22 @@ exports[`renders should display chaining input when parents are provided 1`] = `
|
|||
describedByIds={Array []}
|
||||
fullWidth={false}
|
||||
hasEmptyLabelSpace={false}
|
||||
helpText="Options are based on the value of parent control. Disabled if parent is not set."
|
||||
helpText={
|
||||
<FormattedMessage
|
||||
defaultMessage="Options are based on the value of parent control. Disabled if parent is not set."
|
||||
id="inputControl.editor.listControl.parentDescription"
|
||||
values={Object {}}
|
||||
/>
|
||||
}
|
||||
id="parentSelect-0"
|
||||
key="parentSelect"
|
||||
label="Parent control"
|
||||
label={
|
||||
<FormattedMessage
|
||||
defaultMessage="Parent control"
|
||||
id="inputControl.editor.listControl.parentLabel"
|
||||
values={Object {}}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<EuiSelect
|
||||
compressed={false}
|
||||
|
@ -237,14 +345,26 @@ exports[`renders should display chaining input when parents are provided 1`] = `
|
|||
describedByIds={Array []}
|
||||
fullWidth={false}
|
||||
hasEmptyLabelSpace={false}
|
||||
helpText="Allow multiple selection"
|
||||
helpText={
|
||||
<FormattedMessage
|
||||
defaultMessage="Allow multiple selection"
|
||||
id="inputControl.editor.listControl.multiselectDescription"
|
||||
values={Object {}}
|
||||
/>
|
||||
}
|
||||
id="multiselect-0"
|
||||
key="multiselect"
|
||||
>
|
||||
<EuiSwitch
|
||||
checked={true}
|
||||
data-test-subj="listControlMultiselectInput"
|
||||
label="Multiselect"
|
||||
label={
|
||||
<FormattedMessage
|
||||
defaultMessage="Multiselect"
|
||||
id="inputControl.editor.listControl.multiselectLabel"
|
||||
values={Object {}}
|
||||
/>
|
||||
}
|
||||
onChange={[Function]}
|
||||
/>
|
||||
</EuiFormRow>
|
||||
|
@ -252,7 +372,13 @@ exports[`renders should display chaining input when parents are provided 1`] = `
|
|||
describedByIds={Array []}
|
||||
fullWidth={false}
|
||||
hasEmptyLabelSpace={false}
|
||||
helpText="Update options in response to user input"
|
||||
helpText={
|
||||
<FormattedMessage
|
||||
defaultMessage="Update options in response to user input"
|
||||
id="inputControl.editor.listControl.dynamicOptions.updateDescription"
|
||||
values={Object {}}
|
||||
/>
|
||||
}
|
||||
id="dynamicOptions-0"
|
||||
key="dynamicOptions"
|
||||
>
|
||||
|
@ -260,7 +386,13 @@ exports[`renders should display chaining input when parents are provided 1`] = `
|
|||
checked={false}
|
||||
data-test-subj="listControlDynamicOptionsSwitch"
|
||||
disabled={false}
|
||||
label="Dynamic Options"
|
||||
label={
|
||||
<FormattedMessage
|
||||
defaultMessage="Dynamic Options"
|
||||
id="inputControl.editor.listControl.dynamicOptionsLabel"
|
||||
values={Object {}}
|
||||
/>
|
||||
}
|
||||
onChange={[Function]}
|
||||
/>
|
||||
</EuiFormRow>
|
||||
|
@ -268,10 +400,22 @@ exports[`renders should display chaining input when parents are provided 1`] = `
|
|||
describedByIds={Array []}
|
||||
fullWidth={false}
|
||||
hasEmptyLabelSpace={false}
|
||||
helpText="Number of options"
|
||||
helpText={
|
||||
<FormattedMessage
|
||||
defaultMessage="Number of options"
|
||||
id="inputControl.editor.listControl.sizeDescription"
|
||||
values={Object {}}
|
||||
/>
|
||||
}
|
||||
id="size-0"
|
||||
key="size"
|
||||
label="Size"
|
||||
label={
|
||||
<FormattedMessage
|
||||
defaultMessage="Size"
|
||||
id="inputControl.editor.listControl.sizeLabel"
|
||||
values={Object {}}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<EuiFieldNumber
|
||||
compressed={false}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
import _ from 'lodash';
|
||||
import PropTypes from 'prop-types';
|
||||
import React, { Component } from 'react';
|
||||
import { injectI18n } from '@kbn/i18n/react';
|
||||
import { injectI18n, FormattedMessage } from '@kbn/i18n/react';
|
||||
|
||||
import {
|
||||
EuiFormRow,
|
||||
|
@ -141,10 +141,7 @@ class FieldSelectUi extends Component {
|
|||
return (
|
||||
<EuiFormRow
|
||||
id={selectId}
|
||||
label={intl.formatMessage({
|
||||
id: 'inputControl.editor.fieldSelect.fieldLabel',
|
||||
defaultMessage: 'Field'
|
||||
})}
|
||||
label={<FormattedMessage id="inputControl.editor.fieldSelect.fieldLabel" defaultMessage="Field" />}
|
||||
>
|
||||
<EuiComboBox
|
||||
placeholder={intl.formatMessage({
|
||||
|
|
|
@ -21,7 +21,7 @@ import PropTypes from 'prop-types';
|
|||
import React, { Component } from 'react';
|
||||
import { IndexPatternSelectFormRow } from './index_pattern_select_form_row';
|
||||
import { FieldSelect } from './field_select';
|
||||
import { injectI18n } from '@kbn/i18n/react';
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
|
||||
import {
|
||||
EuiFormRow,
|
||||
|
@ -34,7 +34,7 @@ function filterField(field) {
|
|||
return field.aggregatable && ['number', 'boolean', 'date', 'ip', 'string'].includes(field.type);
|
||||
}
|
||||
|
||||
class ListControlEditorUi extends Component {
|
||||
export class ListControlEditor extends Component {
|
||||
state = {
|
||||
isLoadingFieldType: true,
|
||||
isStringField: false,
|
||||
|
@ -103,7 +103,6 @@ class ListControlEditorUi extends Component {
|
|||
}
|
||||
|
||||
const options = [];
|
||||
const { intl } = this.props;
|
||||
if (this.props.parentCandidates && this.props.parentCandidates.length > 0) {
|
||||
const parentCandidatesOptions = [
|
||||
{ value: '', text: '' },
|
||||
|
@ -112,14 +111,11 @@ class ListControlEditorUi extends Component {
|
|||
options.push(
|
||||
<EuiFormRow
|
||||
id={`parentSelect-${this.props.controlIndex}`}
|
||||
label={intl.formatMessage({
|
||||
id: 'inputControl.editor.listControl.parentLabel',
|
||||
defaultMessage: 'Parent control'
|
||||
})}
|
||||
helpText={intl.formatMessage({
|
||||
id: 'inputControl.editor.listControl.parentDescription',
|
||||
defaultMessage: 'Options are based on the value of parent control. Disabled if parent is not set.'
|
||||
})}
|
||||
label={<FormattedMessage id="inputControl.editor.listControl.parentLabel" defaultMessage="Parent control" />}
|
||||
helpText={<FormattedMessage
|
||||
id="inputControl.editor.listControl.parentDescription"
|
||||
defaultMessage="Options are based on the value of parent control. Disabled if parent is not set."
|
||||
/>}
|
||||
key="parentSelect"
|
||||
>
|
||||
<EuiSelect
|
||||
|
@ -137,16 +133,13 @@ class ListControlEditorUi extends Component {
|
|||
<EuiFormRow
|
||||
id={`multiselect-${this.props.controlIndex}`}
|
||||
key="multiselect"
|
||||
helpText={intl.formatMessage({
|
||||
id: 'inputControl.editor.listControl.multiselectDescription',
|
||||
defaultMessage: 'Allow multiple selection'
|
||||
})}
|
||||
helpText={<FormattedMessage
|
||||
id="inputControl.editor.listControl.multiselectDescription"
|
||||
defaultMessage="Allow multiple selection"
|
||||
/>}
|
||||
>
|
||||
<EuiSwitch
|
||||
label={intl.formatMessage({
|
||||
id: 'inputControl.editor.listControl.multiselectLabel',
|
||||
defaultMessage: 'Multiselect'
|
||||
})}
|
||||
label={<FormattedMessage id="inputControl.editor.listControl.multiselectLabel" defaultMessage="Multiselect" />}
|
||||
checked={this.props.controlParams.options.multiselect}
|
||||
onChange={(evt) => {
|
||||
this.props.handleCheckboxOptionChange(this.props.controlIndex, 'multiselect', evt);
|
||||
|
@ -157,14 +150,17 @@ class ListControlEditorUi extends Component {
|
|||
);
|
||||
|
||||
const dynamicOptionsHelpText = this.state.isStringField
|
||||
? intl.formatMessage({
|
||||
id: 'inputControl.editor.listControl.dynamicOptions.updateDescription',
|
||||
defaultMessage: 'Update options in response to user input'
|
||||
})
|
||||
: intl.formatMessage({
|
||||
id: 'inputControl.editor.listControl.dynamicOptions.stringFieldDescription',
|
||||
defaultMessage: 'Only available for "string" fields'
|
||||
});
|
||||
? (
|
||||
<FormattedMessage
|
||||
id="inputControl.editor.listControl.dynamicOptions.updateDescription"
|
||||
defaultMessage="Update options in response to user input"
|
||||
/>
|
||||
) : (
|
||||
<FormattedMessage
|
||||
id="inputControl.editor.listControl.dynamicOptions.stringFieldDescription"
|
||||
defaultMessage="Only available for "string" fields"
|
||||
/>
|
||||
);
|
||||
options.push(
|
||||
<EuiFormRow
|
||||
id={`dynamicOptions-${this.props.controlIndex}`}
|
||||
|
@ -172,10 +168,7 @@ class ListControlEditorUi extends Component {
|
|||
helpText={dynamicOptionsHelpText}
|
||||
>
|
||||
<EuiSwitch
|
||||
label={intl.formatMessage({
|
||||
id: 'inputControl.editor.listControl.dynamicOptionsLabel',
|
||||
defaultMessage: 'Dynamic Options'
|
||||
})}
|
||||
label={<FormattedMessage id="inputControl.editor.listControl.dynamicOptionsLabel" defaultMessage="Dynamic Options" />}
|
||||
checked={this.props.controlParams.options.dynamicOptions}
|
||||
onChange={(evt) => {
|
||||
this.props.handleCheckboxOptionChange(this.props.controlIndex, 'dynamicOptions', evt);
|
||||
|
@ -191,15 +184,9 @@ class ListControlEditorUi extends Component {
|
|||
options.push(
|
||||
<EuiFormRow
|
||||
id={`size-${this.props.controlIndex}`}
|
||||
label={intl.formatMessage({
|
||||
id: 'inputControl.editor.listControl.sizeLabel',
|
||||
defaultMessage: 'Size'
|
||||
})}
|
||||
label={<FormattedMessage id="inputControl.editor.listControl.sizeLabel" defaultMessage="Size" />}
|
||||
key="size"
|
||||
helpText={intl.formatMessage({
|
||||
id: 'inputControl.editor.listControl.sizeDescription',
|
||||
defaultMessage: 'Number of options'
|
||||
})}
|
||||
helpText={<FormattedMessage id="inputControl.editor.listControl.sizeDescription" defaultMessage="Number of options" />}
|
||||
>
|
||||
<EuiFieldNumber
|
||||
min={1}
|
||||
|
@ -242,7 +229,7 @@ class ListControlEditorUi extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
ListControlEditorUi.propTypes = {
|
||||
ListControlEditor.propTypes = {
|
||||
getIndexPattern: PropTypes.func.isRequired,
|
||||
controlIndex: PropTypes.number.isRequired,
|
||||
controlParams: PropTypes.object.isRequired,
|
||||
|
@ -257,4 +244,3 @@ ListControlEditorUi.propTypes = {
|
|||
handleParentChange: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
export const ListControlEditor = injectI18n(ListControlEditorUi);
|
||||
|
|
|
@ -19,7 +19,8 @@
|
|||
|
||||
import React from 'react';
|
||||
import sinon from 'sinon';
|
||||
import { shallowWithIntl, mountWithIntl } from 'test_utils/enzyme_helpers';
|
||||
import { shallow } from 'enzyme';
|
||||
import { mountWithIntl } from 'test_utils/enzyme_helpers';
|
||||
import { findTestSubject } from '@elastic/eui/lib/test';
|
||||
import { getIndexPatternMock } from './__tests__/get_index_pattern_mock';
|
||||
|
||||
|
@ -66,7 +67,7 @@ describe('renders', () => {
|
|||
size: 5,
|
||||
}
|
||||
};
|
||||
const component = shallowWithIntl(<ListControlEditor.WrappedComponent
|
||||
const component = shallow(<ListControlEditor
|
||||
getIndexPattern={getIndexPatternMock}
|
||||
controlIndex={0}
|
||||
controlParams={controlParams}
|
||||
|
@ -91,7 +92,7 @@ describe('renders', () => {
|
|||
{ value: '1', text: 'fieldA' },
|
||||
{ value: '2', text: 'fieldB' }
|
||||
];
|
||||
const component = shallowWithIntl(<ListControlEditor.WrappedComponent
|
||||
const component = shallow(<ListControlEditor
|
||||
getIndexPattern={getIndexPatternMock}
|
||||
controlIndex={0}
|
||||
controlParams={controlParams}
|
||||
|
@ -125,7 +126,7 @@ describe('renders', () => {
|
|||
size: 5,
|
||||
}
|
||||
};
|
||||
const component = shallowWithIntl(<ListControlEditor.WrappedComponent
|
||||
const component = shallow(<ListControlEditor
|
||||
getIndexPattern={getIndexPatternMock}
|
||||
controlIndex={0}
|
||||
controlParams={controlParams}
|
||||
|
@ -158,7 +159,7 @@ describe('renders', () => {
|
|||
size: 5,
|
||||
}
|
||||
};
|
||||
const component = shallowWithIntl(<ListControlEditor.WrappedComponent
|
||||
const component = shallow(<ListControlEditor
|
||||
getIndexPattern={getIndexPatternMock}
|
||||
controlIndex={0}
|
||||
controlParams={controlParams}
|
||||
|
@ -191,7 +192,7 @@ describe('renders', () => {
|
|||
size: 5,
|
||||
}
|
||||
};
|
||||
const component = shallowWithIntl(<ListControlEditor.WrappedComponent
|
||||
const component = shallow(<ListControlEditor
|
||||
getIndexPattern={getIndexPatternMock}
|
||||
controlIndex={0}
|
||||
controlParams={controlParams}
|
||||
|
@ -214,7 +215,7 @@ describe('renders', () => {
|
|||
});
|
||||
|
||||
test('handleCheckboxOptionChange - multiselect', async () => {
|
||||
const component = mountWithIntl(<ListControlEditor.WrappedComponent
|
||||
const component = mountWithIntl(<ListControlEditor
|
||||
getIndexPattern={getIndexPatternMock}
|
||||
controlIndex={0}
|
||||
controlParams={controlParams}
|
||||
|
@ -251,7 +252,7 @@ test('handleCheckboxOptionChange - multiselect', async () => {
|
|||
});
|
||||
|
||||
test('handleNumberOptionChange - size', async () => {
|
||||
const component = mountWithIntl(<ListControlEditor.WrappedComponent
|
||||
const component = mountWithIntl(<ListControlEditor
|
||||
getIndexPattern={getIndexPatternMock}
|
||||
controlIndex={0}
|
||||
controlParams={controlParams}
|
||||
|
|
|
@ -56,7 +56,7 @@ exports[`Header should render normally 1`] = `
|
|||
label={
|
||||
<FormattedMessage
|
||||
defaultMessage="Include system indices"
|
||||
id="kbn.management.createIndexPattern.includeSystemIndicesToggleSwitch"
|
||||
id="kbn.management.createIndexPattern.includeSystemIndicesToggleSwitchLabel"
|
||||
values={Object {}}
|
||||
/>
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ exports[`Header should render without including system indices 1`] = `
|
|||
label={
|
||||
<FormattedMessage
|
||||
defaultMessage="Include system indices"
|
||||
id="kbn.management.createIndexPattern.includeSystemIndicesToggleSwitch"
|
||||
id="kbn.management.createIndexPattern.includeSystemIndicesToggleSwitchLabel"
|
||||
values={Object {}}
|
||||
/>
|
||||
}
|
||||
|
|
|
@ -44,7 +44,6 @@ export const Header = ({
|
|||
defaultMessage="Create index pattern"
|
||||
/>
|
||||
</h1>
|
||||
|
||||
</EuiTitle>
|
||||
<EuiFlexGroup justifyContent="spaceBetween" alignItems="flexEnd">
|
||||
<EuiFlexItem grow={false}>
|
||||
|
@ -62,7 +61,7 @@ export const Header = ({
|
|||
<EuiFlexItem grow={false}>
|
||||
<EuiSwitch
|
||||
label={<FormattedMessage
|
||||
id="kbn.management.createIndexPattern.includeSystemIndicesToggleSwitch"
|
||||
id="kbn.management.createIndexPattern.includeSystemIndicesToggleSwitchLabel"
|
||||
defaultMessage="Include system indices"
|
||||
/>}
|
||||
id="checkboxShowSystemIndices"
|
||||
|
|
|
@ -61,17 +61,15 @@ export const AdvancedOptionsComponent = ({
|
|||
{ isVisible ?
|
||||
<EuiForm>
|
||||
<EuiFormRow
|
||||
label={intl.formatMessage({
|
||||
id: 'kbn.management.createIndexPattern.stepTime.options.patternHeader',
|
||||
defaultMessage: 'Custom index pattern ID'
|
||||
})}
|
||||
helpText={
|
||||
<FormattedMessage
|
||||
id="kbn.management.createIndexPattern.stepTime.options.patternLabel"
|
||||
defaultMessage="Kibana will provide a unique identifier for each index pattern. If you do not want to use this unique ID,
|
||||
enter a custom one."
|
||||
/>
|
||||
}
|
||||
label={<FormattedMessage
|
||||
id="kbn.management.createIndexPattern.stepTime.options.patternHeader"
|
||||
defaultMessage="Custom index pattern ID"
|
||||
/>}
|
||||
helpText={<FormattedMessage
|
||||
id="kbn.management.createIndexPattern.stepTime.options.patternLabel"
|
||||
defaultMessage="Kibana will provide a unique identifier for each index pattern. If you do not want to use this unique ID,
|
||||
enter a custom one."
|
||||
/>}
|
||||
>
|
||||
<EuiFieldText
|
||||
name="indexPatternId"
|
||||
|
|
|
@ -6,7 +6,13 @@ exports[`CallOuts should render normally 1`] = `
|
|||
color="danger"
|
||||
iconType="cross"
|
||||
size="m"
|
||||
title="Deprecation languages in use"
|
||||
title={
|
||||
<FormattedMessage
|
||||
defaultMessage="Deprecation languages in use"
|
||||
id="kbn.management.editIndexPattern.scripted.deprecationLangHeader"
|
||||
values={Object {}}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<p>
|
||||
<FormattedMessage
|
||||
|
@ -20,7 +26,11 @@ exports[`CallOuts should render normally 1`] = `
|
|||
href="http://www.elastic.co/painlessDocs"
|
||||
type="button"
|
||||
>
|
||||
Painless
|
||||
<FormattedMessage
|
||||
defaultMessage="Painless"
|
||||
id="kbn.management.editIndexPattern.scripted.deprecationLangLabel.painlessDescription"
|
||||
values={Object {}}
|
||||
/>
|
||||
</EuiLink>,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,14 +18,14 @@
|
|||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { shallowWithIntl } from 'test_utils/enzyme_helpers';
|
||||
import { shallow } from 'enzyme';
|
||||
|
||||
import { CallOutsComponent } from '../call_outs';
|
||||
import { CallOuts } from '../call_outs';
|
||||
|
||||
describe('CallOuts', () => {
|
||||
it('should render normally', async () => {
|
||||
const component = shallowWithIntl(
|
||||
<CallOutsComponent
|
||||
const component = shallow(
|
||||
<CallOuts
|
||||
deprecatedLangsInUse={['php']}
|
||||
painlessDocLink="http://www.elastic.co/painlessDocs"
|
||||
/>
|
||||
|
@ -35,8 +35,8 @@ describe('CallOuts', () => {
|
|||
});
|
||||
|
||||
it('should render without any call outs', async () => {
|
||||
const component = shallowWithIntl(
|
||||
<CallOutsComponent
|
||||
const component = shallow(
|
||||
<CallOuts
|
||||
deprecatedLangsInUse={[]}
|
||||
painlessDocLink="http://www.elastic.co/painlessDocs"
|
||||
/>
|
||||
|
|
|
@ -25,12 +25,11 @@ import {
|
|||
EuiSpacer,
|
||||
} from '@elastic/eui';
|
||||
|
||||
import { injectI18n, FormattedMessage } from '@kbn/i18n/react';
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
|
||||
export const CallOutsComponent = ({
|
||||
export const CallOuts = ({
|
||||
deprecatedLangsInUse,
|
||||
painlessDocLink,
|
||||
intl
|
||||
}) => {
|
||||
if (!deprecatedLangsInUse.length) {
|
||||
return null;
|
||||
|
@ -39,9 +38,10 @@ export const CallOutsComponent = ({
|
|||
return (
|
||||
<div>
|
||||
<EuiCallOut
|
||||
title={intl.formatMessage({
|
||||
id: 'kbn.management.editIndexPattern.scripted.deprecationLangHeader', defaultMessage: 'Deprecation languages in use'
|
||||
})}
|
||||
title={<FormattedMessage
|
||||
id="kbn.management.editIndexPattern.scripted.deprecationLangHeader"
|
||||
defaultMessage="Deprecation languages in use"
|
||||
/>}
|
||||
color="danger"
|
||||
iconType="cross"
|
||||
>
|
||||
|
@ -54,8 +54,12 @@ export const CallOutsComponent = ({
|
|||
deprecatedLangsInUse: deprecatedLangsInUse.join(', '),
|
||||
link: (
|
||||
<EuiLink href={painlessDocLink}>
|
||||
Painless
|
||||
</EuiLink>)
|
||||
<FormattedMessage
|
||||
id="kbn.management.editIndexPattern.scripted.deprecationLangLabel.painlessDescription"
|
||||
defaultMessage="Painless"
|
||||
/>
|
||||
</EuiLink>
|
||||
)
|
||||
}}
|
||||
/>
|
||||
</p>
|
||||
|
@ -64,5 +68,3 @@ export const CallOutsComponent = ({
|
|||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export const CallOuts = injectI18n(CallOutsComponent);
|
||||
|
|
|
@ -234,72 +234,69 @@ exports[`SourceFiltersTable should should a loading indicator when saving 1`] =
|
|||
`;
|
||||
|
||||
exports[`SourceFiltersTable should show a delete modal 1`] = `
|
||||
Object {
|
||||
"component": <div>
|
||||
<header />
|
||||
<InjectIntl(AddFilterComponent)
|
||||
onAddFilter={[Function]}
|
||||
/>
|
||||
<eui-spacer
|
||||
size="l"
|
||||
/>
|
||||
<Table
|
||||
deleteFilter={[Function]}
|
||||
fieldWildcardMatcher={[Function]}
|
||||
indexPattern={
|
||||
Object {
|
||||
"sourceFilters": Array [
|
||||
Object {
|
||||
"value": "tim*",
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
isSaving={false}
|
||||
items={
|
||||
Array [
|
||||
<div>
|
||||
<header />
|
||||
<InjectIntl(AddFilterComponent)
|
||||
onAddFilter={[Function]}
|
||||
/>
|
||||
<eui-spacer
|
||||
size="l"
|
||||
/>
|
||||
<Table
|
||||
deleteFilter={[Function]}
|
||||
fieldWildcardMatcher={[Function]}
|
||||
indexPattern={
|
||||
Object {
|
||||
"sourceFilters": Array [
|
||||
Object {
|
||||
"clientId": 1,
|
||||
"value": "tim*",
|
||||
},
|
||||
]
|
||||
],
|
||||
}
|
||||
}
|
||||
isSaving={false}
|
||||
items={
|
||||
Array [
|
||||
Object {
|
||||
"clientId": 1,
|
||||
"value": "tim*",
|
||||
},
|
||||
]
|
||||
}
|
||||
saveFilter={[Function]}
|
||||
/>
|
||||
<eui-overlay-mask>
|
||||
<eui-confirm-modal
|
||||
cancelButtonText={
|
||||
<FormattedMessage
|
||||
defaultMessage="Cancel"
|
||||
id="kbn.management.editIndexPattern.source.deleteFilter.cancelButtonLabel"
|
||||
values={Object {}}
|
||||
/>
|
||||
}
|
||||
confirmButtonText={
|
||||
<FormattedMessage
|
||||
defaultMessage="Delete"
|
||||
id="kbn.management.editIndexPattern.source.deleteFilter.deleteButtonLabel"
|
||||
values={Object {}}
|
||||
/>
|
||||
}
|
||||
onCancel={[Function]}
|
||||
onConfirm={[Function]}
|
||||
title={
|
||||
<FormattedMessage
|
||||
defaultMessage="Delete source filter '{value}'?"
|
||||
id="kbn.management.editIndexPattern.source.deleteSourceFilterLabel"
|
||||
values={
|
||||
Object {
|
||||
"value": "tim*",
|
||||
}
|
||||
}
|
||||
/>
|
||||
}
|
||||
saveFilter={[Function]}
|
||||
/>
|
||||
<eui-overlay-mask>
|
||||
<eui-confirm-modal
|
||||
cancelButtonText="Cancel"
|
||||
confirmButtonText="Delete"
|
||||
onCancel={[Function]}
|
||||
onConfirm={[Function]}
|
||||
title="Delete source filter '{value}'?"
|
||||
/>
|
||||
</eui-overlay-mask>
|
||||
</div>,
|
||||
"i18n": Array [
|
||||
Array [
|
||||
Object {
|
||||
"defaultMessage": "Delete source filter '{value}'?",
|
||||
"id": "kbn.management.editIndexPattern.source.deleteSourceFilterLabel",
|
||||
},
|
||||
Object {
|
||||
"value": "tim*",
|
||||
},
|
||||
],
|
||||
Array [
|
||||
Object {
|
||||
"defaultMessage": "Cancel",
|
||||
"id": "kbn.management.editIndexPattern.source.deleteFilter.cancelButton",
|
||||
},
|
||||
],
|
||||
Array [
|
||||
Object {
|
||||
"defaultMessage": "Delete",
|
||||
"id": "kbn.management.editIndexPattern.source.deleteFilter.deleteButton",
|
||||
},
|
||||
],
|
||||
],
|
||||
}
|
||||
</eui-overlay-mask>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`SourceFiltersTable should update a filter 1`] = `
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { shallowWithIntl, intl } from 'test_utils/enzyme_helpers';
|
||||
import { shallow } from 'enzyme';
|
||||
|
||||
import { SourceFiltersTableComponent } from '../source_filters_table';
|
||||
import { SourceFiltersTable } from '../source_filters_table';
|
||||
|
||||
jest.mock('@elastic/eui', () => ({
|
||||
EuiButton: 'eui-button',
|
||||
|
@ -57,11 +57,9 @@ const indexPattern = {
|
|||
|
||||
|
||||
describe('SourceFiltersTable', () => {
|
||||
afterEach(() => intl.formatMessage.mockClear());
|
||||
|
||||
it('should render normally', async () => {
|
||||
const component = shallowWithIntl(
|
||||
<SourceFiltersTableComponent
|
||||
const component = shallow(
|
||||
<SourceFiltersTable
|
||||
indexPattern={indexPattern}
|
||||
fieldWildcardMatcher={() => {}}
|
||||
/>
|
||||
|
@ -71,8 +69,8 @@ describe('SourceFiltersTable', () => {
|
|||
});
|
||||
|
||||
it('should filter based on the query bar', async () => {
|
||||
const component = shallowWithIntl(
|
||||
<SourceFiltersTableComponent
|
||||
const component = shallow(
|
||||
<SourceFiltersTable
|
||||
indexPattern={indexPattern}
|
||||
fieldWildcardMatcher={() => {}}
|
||||
/>
|
||||
|
@ -83,8 +81,8 @@ describe('SourceFiltersTable', () => {
|
|||
});
|
||||
|
||||
it('should should a loading indicator when saving', async () => {
|
||||
const component = shallowWithIntl(
|
||||
<SourceFiltersTableComponent
|
||||
const component = shallow(
|
||||
<SourceFiltersTable
|
||||
indexPattern={{
|
||||
sourceFilters: [{ value: 'tim*' }]
|
||||
}}
|
||||
|
@ -97,8 +95,8 @@ describe('SourceFiltersTable', () => {
|
|||
});
|
||||
|
||||
it('should show a delete modal', async () => {
|
||||
const component = shallowWithIntl(
|
||||
<SourceFiltersTableComponent
|
||||
const component = shallow(
|
||||
<SourceFiltersTable
|
||||
indexPattern={{
|
||||
sourceFilters: [{ value: 'tim*' }]
|
||||
}}
|
||||
|
@ -108,16 +106,13 @@ describe('SourceFiltersTable', () => {
|
|||
|
||||
component.instance().startDeleteFilter({ value: 'tim*' });
|
||||
component.update(); // We are not calling `.setState` directly so we need to re-render
|
||||
expect({
|
||||
component,
|
||||
i18n: intl.formatMessage.mock.calls,
|
||||
}).toMatchSnapshot();
|
||||
expect(component).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('should remove a filter', async () => {
|
||||
const save = jest.fn();
|
||||
const component = shallowWithIntl(
|
||||
<SourceFiltersTableComponent
|
||||
const component = shallow(
|
||||
<SourceFiltersTable
|
||||
indexPattern={{
|
||||
save,
|
||||
sourceFilters: [{ value: 'tim*' }, { value: 'na*' }]
|
||||
|
@ -137,8 +132,8 @@ describe('SourceFiltersTable', () => {
|
|||
|
||||
it('should add a filter', async () => {
|
||||
const save = jest.fn();
|
||||
const component = shallowWithIntl(
|
||||
<SourceFiltersTableComponent
|
||||
const component = shallow(
|
||||
<SourceFiltersTable
|
||||
indexPattern={{
|
||||
save,
|
||||
sourceFilters: [{ value: 'tim*' }]
|
||||
|
@ -156,8 +151,8 @@ describe('SourceFiltersTable', () => {
|
|||
|
||||
it('should update a filter', async () => {
|
||||
const save = jest.fn();
|
||||
const component = shallowWithIntl(
|
||||
<SourceFiltersTableComponent
|
||||
const component = shallow(
|
||||
<SourceFiltersTable
|
||||
indexPattern={{
|
||||
save,
|
||||
sourceFilters: [{ value: 'tim*' }]
|
||||
|
|
|
@ -37,7 +37,7 @@ exports[`AddFilter should ignore strings with just spaces 1`] = `
|
|||
>
|
||||
<FormattedMessage
|
||||
defaultMessage="Add"
|
||||
id="kbn.management.editIndexPattern.source.addButton"
|
||||
id="kbn.management.editIndexPattern.source.addButtonLabel"
|
||||
values={Object {}}
|
||||
/>
|
||||
</EuiButton>
|
||||
|
@ -82,7 +82,7 @@ exports[`AddFilter should render normally 1`] = `
|
|||
>
|
||||
<FormattedMessage
|
||||
defaultMessage="Add"
|
||||
id="kbn.management.editIndexPattern.source.addButton"
|
||||
id="kbn.management.editIndexPattern.source.addButtonLabel"
|
||||
values={Object {}}
|
||||
/>
|
||||
</EuiButton>
|
||||
|
|
|
@ -69,7 +69,7 @@ export class AddFilterComponent extends Component {
|
|||
isDisabled={filter.length === 0}
|
||||
onClick={this.onAddFilter}
|
||||
>
|
||||
<FormattedMessage id="kbn.management.editIndexPattern.source.addButton" defaultMessage="Add" />
|
||||
<FormattedMessage id="kbn.management.editIndexPattern.source.addButtonLabel" defaultMessage="Add" />
|
||||
</EuiButton>
|
||||
</EuiFlexItem>
|
||||
</EuiFlexGroup>
|
||||
|
|
|
@ -31,9 +31,9 @@ import {
|
|||
import { Table } from './components/table';
|
||||
import { Header } from './components/header';
|
||||
import { AddFilter } from './components/add_filter';
|
||||
import { injectI18n } from '@kbn/i18n/react';
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
|
||||
export class SourceFiltersTableComponent extends Component {
|
||||
export class SourceFiltersTable extends Component {
|
||||
static propTypes = {
|
||||
indexPattern: PropTypes.object.isRequired,
|
||||
filterFilter: PropTypes.string,
|
||||
|
@ -154,7 +154,6 @@ export class SourceFiltersTableComponent extends Component {
|
|||
|
||||
renderDeleteConfirmationModal() {
|
||||
const { filterToDelete } = this.state;
|
||||
const { intl } = this.props;
|
||||
|
||||
if (!filterToDelete) {
|
||||
return null;
|
||||
|
@ -163,15 +162,23 @@ export class SourceFiltersTableComponent extends Component {
|
|||
return (
|
||||
<EuiOverlayMask>
|
||||
<EuiConfirmModal
|
||||
title={intl.formatMessage(
|
||||
{ id: 'kbn.management.editIndexPattern.source.deleteSourceFilterLabel', defaultMessage: 'Delete source filter \'{value}\'?' },
|
||||
{ value: filterToDelete.value })}
|
||||
title={<FormattedMessage
|
||||
id="kbn.management.editIndexPattern.source.deleteSourceFilterLabel"
|
||||
defaultMessage="Delete source filter '{value}'?"
|
||||
values={{
|
||||
value: filterToDelete.value,
|
||||
}}
|
||||
/>}
|
||||
onCancel={this.hideDeleteConfirmationModal}
|
||||
onConfirm={this.deleteFilter}
|
||||
cancelButtonText={intl.formatMessage({
|
||||
id: 'kbn.management.editIndexPattern.source.deleteFilter.cancelButton', defaultMessage: 'Cancel' })}
|
||||
confirmButtonText={intl.formatMessage({
|
||||
id: 'kbn.management.editIndexPattern.source.deleteFilter.deleteButton', defaultMessage: 'Delete' })}
|
||||
cancelButtonText={<FormattedMessage
|
||||
id="kbn.management.editIndexPattern.source.deleteFilter.cancelButtonLabel"
|
||||
defaultMessage="Cancel"
|
||||
/>}
|
||||
confirmButtonText={<FormattedMessage
|
||||
id="kbn.management.editIndexPattern.source.deleteFilter.deleteButtonLabel"
|
||||
defaultMessage="Delete"
|
||||
/>}
|
||||
defaultFocusedButton={EUI_MODAL_CONFIRM_BUTTON}
|
||||
/>
|
||||
</EuiOverlayMask>
|
||||
|
@ -204,5 +211,3 @@ export class SourceFiltersTableComponent extends Component {
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
export const SourceFiltersTable = injectI18n(SourceFiltersTableComponent);
|
||||
|
|
|
@ -862,7 +862,11 @@ exports[`FieldEditor should show deprecated lang warning 1`] = `
|
|||
href="(docLink for scriptedFields.painless)"
|
||||
target="_window"
|
||||
>
|
||||
Painless
|
||||
<FormattedMessage
|
||||
defaultMessage="Painless"
|
||||
id="common.ui.fieldEditor.warningLabel.painlessLinkLabel"
|
||||
values={Object {}}
|
||||
/>
|
||||
</eui-link>,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,7 +77,13 @@ exports[`StaticLookupFormatEditorComponent should render multiple lookup entries
|
|||
describedByIds={Array []}
|
||||
fullWidth={false}
|
||||
hasEmptyLabelSpace={false}
|
||||
label="Value for unknown key"
|
||||
label={
|
||||
<FormattedMessage
|
||||
defaultMessage="Value for unknown key"
|
||||
id="common.ui.fieldEditor.staticLookup.unknownKeyLabel"
|
||||
values={Object {}}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<EuiFieldText
|
||||
compressed={false}
|
||||
|
@ -165,7 +171,13 @@ exports[`StaticLookupFormatEditorComponent should render normally 1`] = `
|
|||
describedByIds={Array []}
|
||||
fullWidth={false}
|
||||
hasEmptyLabelSpace={false}
|
||||
label="Value for unknown key"
|
||||
label={
|
||||
<FormattedMessage
|
||||
defaultMessage="Value for unknown key"
|
||||
id="common.ui.fieldEditor.staticLookup.unknownKeyLabel"
|
||||
values={Object {}}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<EuiFieldText
|
||||
compressed={false}
|
||||
|
|
|
@ -144,8 +144,7 @@ export class StaticLookupFormatEditorComponent extends DefaultFormatEditor {
|
|||
</EuiButton>
|
||||
<EuiSpacer size="l" />
|
||||
<EuiFormRow
|
||||
label={intl.formatMessage(
|
||||
{ id: 'common.ui.fieldEditor.staticLookup.unknownKeyLabel', defaultMessage: 'Value for unknown key' })}
|
||||
label={<FormattedMessage id="common.ui.fieldEditor.staticLookup.unknownKeyLabel" defaultMessage="Value for unknown key" />}
|
||||
>
|
||||
<EuiFieldText
|
||||
value={formatParams.unknownKeyValue || ''}
|
||||
|
|
|
@ -60,7 +60,7 @@ exports[`UrlFormatEditor should render label template help 1`] = `
|
|||
>
|
||||
<FormattedMessage
|
||||
defaultMessage="URL template help"
|
||||
id="common.ui.fieldEditor.url.template.helpButton"
|
||||
id="common.ui.fieldEditor.url.template.helpLinkText"
|
||||
values={Object {}}
|
||||
/>
|
||||
</EuiLink>
|
||||
|
@ -94,7 +94,11 @@ exports[`UrlFormatEditor should render label template help 1`] = `
|
|||
onClick={[Function]}
|
||||
type="button"
|
||||
>
|
||||
Label template help
|
||||
<FormattedMessage
|
||||
defaultMessage="Label template help"
|
||||
id="common.ui.fieldEditor.url.labelTemplateHelpText"
|
||||
values={Object {}}
|
||||
/>
|
||||
</EuiLink>
|
||||
}
|
||||
isInvalid={false}
|
||||
|
@ -181,7 +185,7 @@ exports[`UrlFormatEditor should render normally 1`] = `
|
|||
>
|
||||
<FormattedMessage
|
||||
defaultMessage="URL template help"
|
||||
id="common.ui.fieldEditor.url.template.helpButton"
|
||||
id="common.ui.fieldEditor.url.template.helpLinkText"
|
||||
values={Object {}}
|
||||
/>
|
||||
</EuiLink>
|
||||
|
@ -215,7 +219,11 @@ exports[`UrlFormatEditor should render normally 1`] = `
|
|||
onClick={[Function]}
|
||||
type="button"
|
||||
>
|
||||
Label template help
|
||||
<FormattedMessage
|
||||
defaultMessage="Label template help"
|
||||
id="common.ui.fieldEditor.url.labelTemplateHelpText"
|
||||
values={Object {}}
|
||||
/>
|
||||
</EuiLink>
|
||||
}
|
||||
isInvalid={false}
|
||||
|
@ -302,7 +310,7 @@ exports[`UrlFormatEditor should render url template help 1`] = `
|
|||
>
|
||||
<FormattedMessage
|
||||
defaultMessage="URL template help"
|
||||
id="common.ui.fieldEditor.url.template.helpButton"
|
||||
id="common.ui.fieldEditor.url.template.helpLinkText"
|
||||
values={Object {}}
|
||||
/>
|
||||
</EuiLink>
|
||||
|
@ -336,7 +344,11 @@ exports[`UrlFormatEditor should render url template help 1`] = `
|
|||
onClick={[Function]}
|
||||
type="button"
|
||||
>
|
||||
Label template help
|
||||
<FormattedMessage
|
||||
defaultMessage="Label template help"
|
||||
id="common.ui.fieldEditor.url.labelTemplateHelpText"
|
||||
values={Object {}}
|
||||
/>
|
||||
</EuiLink>
|
||||
}
|
||||
isInvalid={false}
|
||||
|
|
|
@ -158,10 +158,10 @@ export class UrlFormatEditor extends DefaultFormatEditor {
|
|||
) : null}
|
||||
|
||||
<EuiFormRow
|
||||
label={<FormattedMessage id="common.ui.fieldEditor.url.urlTemplateLabel" defaultMessage="URL template"/>}
|
||||
label={<FormattedMessage id="common.ui.fieldEditor.url.urlTemplateLabel" defaultMessage="URL template" />}
|
||||
helpText={(
|
||||
<EuiLink onClick={this.showUrlTemplateHelp}>
|
||||
<FormattedMessage id="common.ui.fieldEditor.url.template.helpButton" defaultMessage="URL template help" />
|
||||
<FormattedMessage id="common.ui.fieldEditor.url.template.helpLinkText" defaultMessage="URL template help" />
|
||||
</EuiLink>)}
|
||||
isInvalid={!!error}
|
||||
error={error}
|
||||
|
@ -176,8 +176,15 @@ export class UrlFormatEditor extends DefaultFormatEditor {
|
|||
</EuiFormRow>
|
||||
|
||||
<EuiFormRow
|
||||
label={<FormattedMessage id="common.ui.fieldEditor.url.labelTemplateLabel" defaultMessage="Label template"/>}
|
||||
helpText={(<EuiLink onClick={this.showLabelTemplateHelp}>Label template help</EuiLink>)}
|
||||
label={<FormattedMessage id="common.ui.fieldEditor.url.labelTemplateLabel" defaultMessage="Label template" />}
|
||||
helpText={(
|
||||
<EuiLink onClick={this.showLabelTemplateHelp}>
|
||||
<FormattedMessage
|
||||
id="common.ui.fieldEditor.url.labelTemplateHelpText"
|
||||
defaultMessage="Label template help"
|
||||
/>
|
||||
</EuiLink>
|
||||
)}
|
||||
isInvalid={!!error}
|
||||
error={error}
|
||||
>
|
||||
|
|
|
@ -5,7 +5,13 @@ exports[`FormatEditorSamples should render normally 1`] = `
|
|||
describedByIds={Array []}
|
||||
fullWidth={false}
|
||||
hasEmptyLabelSpace={false}
|
||||
label="Samples"
|
||||
label={
|
||||
<FormattedMessage
|
||||
defaultMessage="Samples"
|
||||
id="common.ui.fieldEditor.samplesHeader"
|
||||
values={Object {}}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<EuiBasicTable
|
||||
className="fieldFormatEditor__samples"
|
||||
|
|
|
@ -27,7 +27,7 @@ import {
|
|||
|
||||
import './samples.less';
|
||||
|
||||
import { injectI18n } from '@kbn/i18n/react';
|
||||
import { injectI18n, FormattedMessage } from '@kbn/i18n/react';
|
||||
|
||||
export class FormatEditorSamplesComponent extends PureComponent {
|
||||
static propTypes = {
|
||||
|
@ -68,7 +68,7 @@ export class FormatEditorSamplesComponent extends PureComponent {
|
|||
|
||||
return samples.length ? (
|
||||
<EuiFormRow
|
||||
label={intl.formatMessage({ id: 'common.ui.fieldEditor.samplesHeader', defaultMessage: 'Samples' })}
|
||||
label={<FormattedMessage id="common.ui.fieldEditor.samplesHeader" defaultMessage="Samples" />}
|
||||
>
|
||||
<EuiBasicTable
|
||||
className="fieldFormatEditor__samples"
|
||||
|
|
|
@ -6,7 +6,13 @@ exports[`ScriptingDisabledCallOut should render normally 1`] = `
|
|||
color="danger"
|
||||
iconType="alert"
|
||||
size="m"
|
||||
title="Scripting disabled"
|
||||
title={
|
||||
<FormattedMessage
|
||||
defaultMessage="Scripting disabled"
|
||||
id="common.ui.fieldEditor.disabledCallOutHeader"
|
||||
values={Object {}}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<p>
|
||||
<FormattedMessage
|
||||
|
|
|
@ -6,7 +6,13 @@ exports[`ScriptingWarningCallOut should render normally 1`] = `
|
|||
color="warning"
|
||||
iconType="alert"
|
||||
size="m"
|
||||
title="Proceed with caution"
|
||||
title={
|
||||
<FormattedMessage
|
||||
defaultMessage="Proceed with caution"
|
||||
id="common.ui.fieldEditor.warningCallOutHeader"
|
||||
values={Object {}}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<p>
|
||||
<FormattedMessage
|
||||
|
|
|
@ -24,16 +24,15 @@ import {
|
|||
EuiSpacer,
|
||||
} from '@elastic/eui';
|
||||
|
||||
import { injectI18n, FormattedMessage } from '@kbn/i18n/react';
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
|
||||
export const ScriptingDisabledCallOutComponent = ({
|
||||
export const ScriptingDisabledCallOut = ({
|
||||
isVisible = false,
|
||||
intl,
|
||||
}) => {
|
||||
return isVisible ? (
|
||||
<Fragment>
|
||||
<EuiCallOut
|
||||
title={intl.formatMessage({ id: 'common.ui.fieldEditor.disabledCallOutHeader', defaultMessage: 'Scripting disabled' })}
|
||||
title={<FormattedMessage id="common.ui.fieldEditor.disabledCallOutHeader" defaultMessage="Scripting disabled" />}
|
||||
color="danger"
|
||||
iconType="alert"
|
||||
>
|
||||
|
@ -50,6 +49,4 @@ export const ScriptingDisabledCallOutComponent = ({
|
|||
) : null;
|
||||
};
|
||||
|
||||
ScriptingDisabledCallOutComponent.displayName = 'ScriptingDisabledCallOut';
|
||||
|
||||
export const ScriptingDisabledCallOut = injectI18n(ScriptingDisabledCallOutComponent);
|
||||
ScriptingDisabledCallOut.displayName = 'ScriptingDisabledCallOut';
|
||||
|
|
|
@ -18,14 +18,14 @@
|
|||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { shallowWithIntl } from 'test_utils/enzyme_helpers';
|
||||
import { shallow } from 'enzyme';
|
||||
|
||||
import { ScriptingDisabledCallOutComponent } from './disabled_call_out';
|
||||
import { ScriptingDisabledCallOut } from './disabled_call_out';
|
||||
|
||||
describe('ScriptingDisabledCallOut', () => {
|
||||
it('should render normally', async () => {
|
||||
const component = shallowWithIntl(
|
||||
<ScriptingDisabledCallOutComponent
|
||||
const component = shallow(
|
||||
<ScriptingDisabledCallOut
|
||||
isVisible={true}
|
||||
/>
|
||||
);
|
||||
|
@ -34,8 +34,8 @@ describe('ScriptingDisabledCallOut', () => {
|
|||
});
|
||||
|
||||
it('should render nothing if not visible', async () => {
|
||||
const component = shallowWithIntl(
|
||||
<ScriptingDisabledCallOutComponent />
|
||||
const component = shallow(
|
||||
<ScriptingDisabledCallOut />
|
||||
);
|
||||
|
||||
expect(component).toMatchSnapshot();
|
||||
|
|
|
@ -27,16 +27,15 @@ import {
|
|||
EuiSpacer,
|
||||
} from '@elastic/eui';
|
||||
|
||||
import { injectI18n, FormattedMessage } from '@kbn/i18n/react';
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
|
||||
export const ScriptingWarningCallOutComponent = ({
|
||||
export const ScriptingWarningCallOut = ({
|
||||
isVisible = false,
|
||||
intl,
|
||||
}) => {
|
||||
return isVisible ? (
|
||||
<Fragment>
|
||||
<EuiCallOut
|
||||
title={intl.formatMessage({ id: 'common.ui.fieldEditor.warningCallOutHeader', defaultMessage: 'Proceed with caution' })}
|
||||
title={<FormattedMessage id="common.ui.fieldEditor.warningCallOutHeader" defaultMessage="Proceed with caution" />}
|
||||
color="warning"
|
||||
iconType="alert"
|
||||
>
|
||||
|
@ -77,6 +76,4 @@ export const ScriptingWarningCallOutComponent = ({
|
|||
) : null;
|
||||
};
|
||||
|
||||
ScriptingWarningCallOutComponent.displayName = 'ScriptingWarningCallOut';
|
||||
|
||||
export const ScriptingWarningCallOut = injectI18n(ScriptingWarningCallOutComponent);
|
||||
ScriptingWarningCallOut.displayName = 'ScriptingWarningCallOut';
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { shallowWithIntl } from 'test_utils/enzyme_helpers';
|
||||
import { shallow } from 'enzyme';
|
||||
|
||||
import { ScriptingWarningCallOutComponent } from './warning_call_out';
|
||||
import { ScriptingWarningCallOut } from './warning_call_out';
|
||||
|
||||
jest.mock('ui/documentation_links', () => ({
|
||||
getDocLink: (doc) => `(docLink for ${doc})`,
|
||||
|
@ -28,8 +28,8 @@ jest.mock('ui/documentation_links', () => ({
|
|||
|
||||
describe('ScriptingWarningCallOut', () => {
|
||||
it('should render normally', async () => {
|
||||
const component = shallowWithIntl(
|
||||
<ScriptingWarningCallOutComponent
|
||||
const component = shallow(
|
||||
<ScriptingWarningCallOut
|
||||
isVisible={true}
|
||||
/>
|
||||
);
|
||||
|
@ -38,8 +38,8 @@ describe('ScriptingWarningCallOut', () => {
|
|||
});
|
||||
|
||||
it('should render nothing if not visible', async () => {
|
||||
const component = shallowWithIntl(
|
||||
<ScriptingWarningCallOutComponent />
|
||||
const component = shallow(
|
||||
<ScriptingWarningCallOut />
|
||||
);
|
||||
|
||||
expect(component).toMatchSnapshot();
|
||||
|
|
|
@ -35,7 +35,7 @@ export const ScriptingSyntax = () => (
|
|||
<EuiSpacer />
|
||||
<EuiText>
|
||||
<h3>
|
||||
<FormattedMessage id="common.ui.fieldEditor.syntaxHeader" defaultMessage="Syntax"/>
|
||||
<FormattedMessage id="common.ui.fieldEditor.syntaxHeader" defaultMessage="Syntax" />
|
||||
</h3>
|
||||
<p>
|
||||
<FormattedMessage
|
||||
|
@ -48,7 +48,8 @@ export const ScriptingSyntax = () => (
|
|||
target="_window"
|
||||
href={getDocLink('scriptedFields.painless')}
|
||||
>
|
||||
Painless <EuiIcon type="link" />
|
||||
<FormattedMessage id="common.ui.fieldEditor.syntax.defaultLabel.painlessLink" defaultMessage="Painless" />
|
||||
{' '}<EuiIcon type="link" />
|
||||
</EuiLink>
|
||||
)
|
||||
}}
|
||||
|
@ -56,7 +57,7 @@ export const ScriptingSyntax = () => (
|
|||
</p>
|
||||
<p>
|
||||
<EuiCode>
|
||||
<FormattedMessage id="common.ui.fieldEditor.syntax.default.formatLabel" defaultMessage="doc['some_field'].value"/>
|
||||
<FormattedMessage id="common.ui.fieldEditor.syntax.default.formatLabel" defaultMessage="doc['some_field'].value" />
|
||||
</EuiCode>
|
||||
</p>
|
||||
<p>
|
||||
|
|
|
@ -291,7 +291,10 @@ export class FieldEditorComponent extends PureComponent {
|
|||
language: <EuiCode>{field.lang}</EuiCode>,
|
||||
painlessLink: (
|
||||
<EuiLink target="_window" href={getDocLink('scriptedFields.painless')}>
|
||||
Painless
|
||||
<FormattedMessage
|
||||
id="common.ui.fieldEditor.warningLabel.painlessLinkLabel"
|
||||
defaultMessage="Painless"
|
||||
/>
|
||||
</EuiLink>
|
||||
)
|
||||
}}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
import React, { Component } from 'react';
|
||||
import { injectI18n } from '@kbn/i18n/react';
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
import { Route } from 'react-router-dom';
|
||||
import { ShowJson } from './show_json';
|
||||
import { Summary } from './summary';
|
||||
|
@ -30,7 +30,7 @@ function capitalizeFirstLetter(string) {
|
|||
}
|
||||
|
||||
const tabs = ['Summary', 'Settings', 'Mapping', 'Stats', 'Edit settings'];
|
||||
export class DetailPanelUi extends Component {
|
||||
export class DetailPanel extends Component {
|
||||
renderTabs() {
|
||||
const { panelType, indexName, indexStatus, openDetailPanel } = this.props;
|
||||
|
||||
|
@ -51,7 +51,7 @@ export class DetailPanelUi extends Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
const { panelType, indexName, closeDetailPanel, intl } = this.props;
|
||||
const { panelType, indexName, closeDetailPanel } = this.props;
|
||||
if (!panelType) {
|
||||
return null;
|
||||
}
|
||||
|
@ -95,10 +95,7 @@ export class DetailPanelUi extends Component {
|
|||
anchorPosition="upRight"
|
||||
detailPanel={true}
|
||||
iconType="arrowUp"
|
||||
label={intl.formatMessage({
|
||||
id: 'xpack.idxMgmt.detailPanel.manageContextMenuLabel',
|
||||
defaultMessage: 'Manage',
|
||||
})}
|
||||
label={<FormattedMessage id="xpack.idxMgmt.detailPanel.manageContextMenuLabel" defaultMessage="Manage" />}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
|
@ -109,5 +106,3 @@ export class DetailPanelUi extends Component {
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
export const DetailPanel = injectI18n(DetailPanelUi);
|
|
@ -285,8 +285,8 @@ class IndexActionsContextMenuUi extends Component {
|
|||
<p>
|
||||
<FormattedMessage
|
||||
id="xpack.idxMgmt.indexActionsMenu.forceMerge.forceMergeDescription"
|
||||
defaultMessage="You are about to force merge {mergedKeyword}"
|
||||
values={{ mergedKeyword: oneIndexSelected ? 'this' : 'these' }}
|
||||
defaultMessage="You are about to force merge {oneIndexSelected, plural, one {this} other {these}}"
|
||||
values={{ oneIndexSelected: oneIndexSelected ? 1 : 0 }}
|
||||
/>
|
||||
{' '}
|
||||
{entity}:
|
||||
|
@ -377,8 +377,8 @@ class IndexActionsContextMenuUi extends Component {
|
|||
<p>
|
||||
<FormattedMessage
|
||||
id="xpack.idxMgmt.indexActionsMenu.deleteEntity.deleteDescription"
|
||||
defaultMessage="You are about to delete {mergedKeyword}"
|
||||
values={{ mergedKeyword: oneIndexSelected ? 'this' : 'these' }}
|
||||
defaultMessage="You are about to delete {oneIndexSelected, plural, one {this} other {these}"
|
||||
values={{ oneIndexSelected: oneIndexSelected ? 1 : 0 }}
|
||||
/>
|
||||
{' '}
|
||||
{entity}:
|
||||
|
|
|
@ -284,12 +284,10 @@ export class IndexTableUi extends Component {
|
|||
id="checkboxShowSystemIndices"
|
||||
checked={showSystemIndices}
|
||||
onChange={event => showSystemIndicesChanged(event.target.checked)}
|
||||
label={
|
||||
intl.formatMessage({
|
||||
id: 'xpack.idxMgmt.indexTable.systemIndicesSwitchLabel',
|
||||
defaultMessage: 'Include system indices',
|
||||
})
|
||||
}
|
||||
label={<FormattedMessage
|
||||
id="xpack.idxMgmt.indexTable.systemIndicesSwitchLabel"
|
||||
defaultMessage="Include system indices"
|
||||
/>}
|
||||
/>
|
||||
</EuiFlexItem>
|
||||
</EuiFlexGroup>
|
||||
|
@ -324,7 +322,12 @@ export class IndexTableUi extends Component {
|
|||
defaultMessage: 'Search',
|
||||
})
|
||||
}
|
||||
aria-label="Search indices"
|
||||
aria-label={
|
||||
intl.formatMessage({
|
||||
id: 'xpack.idxMgmt.indexTable.systemIndicesSearchIndicesAriaLabel',
|
||||
defaultMessage: 'Search indices',
|
||||
})
|
||||
}
|
||||
/>
|
||||
</EuiFlexItem>
|
||||
</EuiFlexGroup>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue