Translations for Advanced Settings (#23881)

* translate kbn.management.advanced_settings

* fix tests and update snapshots

* fix tests

* fix  issues

* fix id in get_category-name.js

* Update unit test snapshot

* update snapshot

* Fix issues
This commit is contained in:
Nox911 2018-10-19 20:56:50 +03:00 committed by Maryia Lapata
parent a5c28d5c6b
commit 371eca2052
20 changed files with 1174 additions and 723 deletions

View file

@ -1,495 +1,499 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`AdvancedSettings should render normally 1`] = `
<EuiPage
restrictWidth={true}
>
<div
className="mgtAdvancedSettings"
<I18nProvider>
<EuiPage
restrictWidth={true}
>
<EuiFlexGroup
alignItems="stretch"
component="div"
direction="row"
gutterSize="none"
justifyContent="flexStart"
responsive={true}
wrap={false}
<div
className="mgtAdvancedSettings"
>
<EuiFlexItem
<EuiFlexGroup
alignItems="stretch"
component="div"
grow={true}
direction="row"
gutterSize="none"
justifyContent="flexStart"
responsive={true}
wrap={false}
>
<advanced_settings_page_title />
</EuiFlexItem>
<EuiFlexItem
component="div"
grow={true}
>
<Search
categories={
Array [
"general",
"elasticsearch",
]
}
onQueryChange={[Function]}
query={
Query {
"ast": _AST {
"_clauses": Array [],
"_indexedClauses": Object {
"field": Object {},
"is": Object {},
"term": Array [],
},
},
"syntax": Object {
"parse": [Function],
"print": [Function],
},
"text": "",
<EuiFlexItem
component="div"
grow={true}
>
<advanced_settings_page_title />
</EuiFlexItem>
<EuiFlexItem
component="div"
grow={true}
>
<Search
categories={
Array [
"general",
"elasticsearch",
]
}
}
/>
</EuiFlexItem>
</EuiFlexGroup>
<advanced_settings_page_subtitle />
<EuiSpacer
size="m"
/>
<CallOuts />
<EuiSpacer
size="m"
/>
<Form
categories={
Array [
"general",
"elasticsearch",
]
}
categoryCounts={
Object {
"elasticsearch": 2,
"general": 11,
onQueryChange={[Function]}
query={
Query {
"ast": _AST {
"_clauses": Array [],
"_indexedClauses": Object {
"field": Object {},
"is": Object {},
"term": Array [],
},
},
"syntax": Object {
"parse": [Function],
"print": [Function],
},
"text": "",
}
}
/>
</EuiFlexItem>
</EuiFlexGroup>
<advanced_settings_page_subtitle />
<EuiSpacer
size="m"
/>
<CallOuts />
<EuiSpacer
size="m"
/>
<InjectIntl(FormUI)
categories={
Array [
"general",
"elasticsearch",
]
}
}
clear={[Function]}
clearQuery={[Function]}
save={[Function]}
settings={
Object {
"elasticsearch": Array [
Object {
"ariaName": "test array setting",
"category": Array [
"elasticsearch",
],
"defVal": Array [
"default_value",
],
"description": "Description for Test array setting",
"displayName": "Test array setting",
"isCustom": undefined,
"isOverridden": false,
"name": "test:array:setting",
"options": undefined,
"readonly": false,
"type": "array",
"value": undefined,
},
Object {
"ariaName": "test boolean setting",
"category": Array [
"elasticsearch",
],
"defVal": true,
"description": "Description for Test boolean setting",
"displayName": "Test boolean setting",
"isCustom": undefined,
"isOverridden": false,
"name": "test:boolean:setting",
"options": undefined,
"readonly": false,
"type": "boolean",
"value": undefined,
},
],
"general": Array [
Object {
"ariaName": "test customstring setting",
"category": Array [
"general",
],
"defVal": null,
"description": "Description for Test custom string setting",
"displayName": "Test custom string setting",
"isCustom": undefined,
"isOverridden": false,
"name": "test:customstring:setting",
"options": undefined,
"readonly": false,
"type": "string",
"value": undefined,
},
Object {
"ariaName": "test image setting",
"category": Array [
"general",
],
"defVal": null,
"description": "Description for Test image setting",
"displayName": "Test image setting",
"isCustom": undefined,
"isOverridden": false,
"name": "test:image:setting",
"options": undefined,
"readonly": false,
"type": "image",
"value": undefined,
},
Object {
"ariaName": "test is overridden json",
"category": Array [
"general",
],
"defVal": "{
categoryCounts={
Object {
"elasticsearch": 2,
"general": 11,
}
}
clear={[Function]}
clearQuery={[Function]}
save={[Function]}
settings={
Object {
"elasticsearch": Array [
Object {
"ariaName": "test array setting",
"category": Array [
"elasticsearch",
],
"defVal": Array [
"default_value",
],
"description": "Description for Test array setting",
"displayName": "Test array setting",
"isCustom": undefined,
"isOverridden": false,
"name": "test:array:setting",
"options": undefined,
"readonly": false,
"type": "array",
"value": undefined,
},
Object {
"ariaName": "test boolean setting",
"category": Array [
"elasticsearch",
],
"defVal": true,
"description": "Description for Test boolean setting",
"displayName": "Test boolean setting",
"isCustom": undefined,
"isOverridden": false,
"name": "test:boolean:setting",
"options": undefined,
"readonly": false,
"type": "boolean",
"value": undefined,
},
],
"general": Array [
Object {
"ariaName": "test customstring setting",
"category": Array [
"general",
],
"defVal": null,
"description": "Description for Test custom string setting",
"displayName": "Test custom string setting",
"isCustom": undefined,
"isOverridden": false,
"name": "test:customstring:setting",
"options": undefined,
"readonly": false,
"type": "string",
"value": undefined,
},
Object {
"ariaName": "test image setting",
"category": Array [
"general",
],
"defVal": null,
"description": "Description for Test image setting",
"displayName": "Test image setting",
"isCustom": undefined,
"isOverridden": false,
"name": "test:image:setting",
"options": undefined,
"readonly": false,
"type": "image",
"value": undefined,
},
Object {
"ariaName": "test is overridden json",
"category": Array [
"general",
],
"defVal": "{
\\"foo\\": \\"bar\\"
}",
"description": "Description for overridden json",
"displayName": "An overridden json",
"isCustom": undefined,
"isOverridden": true,
"name": "test:isOverridden:json",
"options": undefined,
"readonly": false,
"type": "json",
"value": undefined,
},
Object {
"ariaName": "test is overridden number",
"category": Array [
"general",
],
"defVal": 1234,
"description": "Description for overridden number",
"displayName": "An overridden number",
"isCustom": undefined,
"isOverridden": true,
"name": "test:isOverridden:number",
"options": undefined,
"readonly": false,
"type": "number",
"value": undefined,
},
Object {
"ariaName": "test is overridden select",
"category": Array [
"general",
],
"defVal": "orange",
"description": "Description for overridden select setting",
"displayName": "Test overridden select setting",
"isCustom": undefined,
"isOverridden": true,
"name": "test:isOverridden:select",
"options": Array [
"apple",
"orange",
"banana",
],
"readonly": false,
"type": "select",
"value": undefined,
},
Object {
"ariaName": "test is overridden string",
"category": Array [
"general",
],
"defVal": "foo",
"description": "Description for overridden string",
"displayName": "An overridden string",
"isCustom": undefined,
"isOverridden": true,
"name": "test:isOverridden:string",
"options": undefined,
"readonly": false,
"type": "string",
"value": undefined,
},
Object {
"ariaName": "test json setting",
"category": Array [
"general",
],
"defVal": "{\\"foo\\": \\"bar\\"}",
"description": "Description for Test json setting",
"displayName": "Test json setting",
"isCustom": undefined,
"isOverridden": false,
"name": "test:json:setting",
"options": undefined,
"readonly": false,
"type": "json",
"value": undefined,
},
Object {
"ariaName": "test markdown setting",
"category": Array [
"general",
],
"defVal": "",
"description": "Description for Test markdown setting",
"displayName": "Test markdown setting",
"isCustom": undefined,
"isOverridden": false,
"name": "test:markdown:setting",
"options": undefined,
"readonly": false,
"type": "markdown",
"value": undefined,
},
Object {
"ariaName": "test number setting",
"category": Array [
"general",
],
"defVal": 5,
"description": "Description for Test number setting",
"displayName": "Test number setting",
"isCustom": undefined,
"isOverridden": false,
"name": "test:number:setting",
"options": undefined,
"readonly": false,
"type": "number",
"value": undefined,
},
Object {
"ariaName": "test select setting",
"category": Array [
"general",
],
"defVal": "orange",
"description": "Description for Test select setting",
"displayName": "Test select setting",
"isCustom": undefined,
"isOverridden": false,
"name": "test:select:setting",
"options": Array [
"apple",
"orange",
"banana",
],
"readonly": false,
"type": "select",
"value": undefined,
},
Object {
"ariaName": "test string setting",
"category": Array [
"general",
],
"defVal": null,
"description": "Description for Test string setting",
"displayName": "Test string setting",
"isCustom": undefined,
"isOverridden": false,
"name": "test:string:setting",
"options": undefined,
"readonly": false,
"type": "string",
"value": undefined,
},
],
"description": "Description for overridden json",
"displayName": "An overridden json",
"isCustom": undefined,
"isOverridden": true,
"name": "test:isOverridden:json",
"options": undefined,
"readonly": false,
"type": "json",
"value": undefined,
},
Object {
"ariaName": "test is overridden number",
"category": Array [
"general",
],
"defVal": 1234,
"description": "Description for overridden number",
"displayName": "An overridden number",
"isCustom": undefined,
"isOverridden": true,
"name": "test:isOverridden:number",
"options": undefined,
"readonly": false,
"type": "number",
"value": undefined,
},
Object {
"ariaName": "test is overridden select",
"category": Array [
"general",
],
"defVal": "orange",
"description": "Description for overridden select setting",
"displayName": "Test overridden select setting",
"isCustom": undefined,
"isOverridden": true,
"name": "test:isOverridden:select",
"options": Array [
"apple",
"orange",
"banana",
],
"readonly": false,
"type": "select",
"value": undefined,
},
Object {
"ariaName": "test is overridden string",
"category": Array [
"general",
],
"defVal": "foo",
"description": "Description for overridden string",
"displayName": "An overridden string",
"isCustom": undefined,
"isOverridden": true,
"name": "test:isOverridden:string",
"options": undefined,
"readonly": false,
"type": "string",
"value": undefined,
},
Object {
"ariaName": "test json setting",
"category": Array [
"general",
],
"defVal": "{\\"foo\\": \\"bar\\"}",
"description": "Description for Test json setting",
"displayName": "Test json setting",
"isCustom": undefined,
"isOverridden": false,
"name": "test:json:setting",
"options": undefined,
"readonly": false,
"type": "json",
"value": undefined,
},
Object {
"ariaName": "test markdown setting",
"category": Array [
"general",
],
"defVal": "",
"description": "Description for Test markdown setting",
"displayName": "Test markdown setting",
"isCustom": undefined,
"isOverridden": false,
"name": "test:markdown:setting",
"options": undefined,
"readonly": false,
"type": "markdown",
"value": undefined,
},
Object {
"ariaName": "test number setting",
"category": Array [
"general",
],
"defVal": 5,
"description": "Description for Test number setting",
"displayName": "Test number setting",
"isCustom": undefined,
"isOverridden": false,
"name": "test:number:setting",
"options": undefined,
"readonly": false,
"type": "number",
"value": undefined,
},
Object {
"ariaName": "test select setting",
"category": Array [
"general",
],
"defVal": "orange",
"description": "Description for Test select setting",
"displayName": "Test select setting",
"isCustom": undefined,
"isOverridden": false,
"name": "test:select:setting",
"options": Array [
"apple",
"orange",
"banana",
],
"readonly": false,
"type": "select",
"value": undefined,
},
Object {
"ariaName": "test string setting",
"category": Array [
"general",
],
"defVal": null,
"description": "Description for Test string setting",
"displayName": "Test string setting",
"isCustom": undefined,
"isOverridden": false,
"name": "test:string:setting",
"options": undefined,
"readonly": false,
"type": "string",
"value": undefined,
},
],
}
}
}
showNoResultsMessage={true}
/>
<advanced_settings_page_footer
onQueryMatchChange={[Function]}
query={
Query {
"ast": _AST {
"_clauses": Array [],
"_indexedClauses": Object {
"field": Object {},
"is": Object {},
"term": Array [],
showNoResultsMessage={true}
/>
<advanced_settings_page_footer
onQueryMatchChange={[Function]}
query={
Query {
"ast": _AST {
"_clauses": Array [],
"_indexedClauses": Object {
"field": Object {},
"is": Object {},
"term": Array [],
},
},
},
"syntax": Object {
"parse": [Function],
"print": [Function],
},
"text": "",
"syntax": Object {
"parse": [Function],
"print": [Function],
},
"text": "",
}
}
}
/>
</div>
</EuiPage>
/>
</div>
</EuiPage>
</I18nProvider>
`;
exports[`AdvancedSettings should render specific setting if given setting key 1`] = `
<EuiPage
restrictWidth={true}
>
<div
className="mgtAdvancedSettings"
<I18nProvider>
<EuiPage
restrictWidth={true}
>
<EuiFlexGroup
alignItems="stretch"
component="div"
direction="row"
gutterSize="none"
justifyContent="flexStart"
responsive={true}
wrap={false}
<div
className="mgtAdvancedSettings"
>
<EuiFlexItem
<EuiFlexGroup
alignItems="stretch"
component="div"
grow={true}
direction="row"
gutterSize="none"
justifyContent="flexStart"
responsive={true}
wrap={false}
>
<advanced_settings_page_title />
</EuiFlexItem>
<EuiFlexItem
component="div"
grow={true}
>
<Search
categories={
Array [
"general",
"elasticsearch",
]
}
onQueryChange={[Function]}
query={
Query {
"ast": _AST {
"_clauses": Array [
Object {
"field": "ariaName",
"match": "must",
"operator": "eq",
"type": "field",
"value": "test string setting",
},
],
"_indexedClauses": Object {
"field": Object {
"ariaName": Array [
Object {
"field": "ariaName",
"match": "must",
"operator": "eq",
"type": "field",
"value": "test string setting",
},
],
},
"is": Object {},
"term": Array [],
},
},
"syntax": Object {
"parse": [Function],
"print": [Function],
},
"text": "ariaName:\\"test string setting\\"",
}
}
/>
</EuiFlexItem>
</EuiFlexGroup>
<advanced_settings_page_subtitle />
<EuiSpacer
size="m"
/>
<CallOuts />
<EuiSpacer
size="m"
/>
<Form
categories={
Array [
"general",
"elasticsearch",
]
}
categoryCounts={
Object {
"elasticsearch": 2,
"general": 11,
}
}
clear={[Function]}
clearQuery={[Function]}
save={[Function]}
settings={
Object {
"general": Array [
Object {
"ariaName": "test string setting",
"category": Array [
<EuiFlexItem
component="div"
grow={true}
>
<advanced_settings_page_title />
</EuiFlexItem>
<EuiFlexItem
component="div"
grow={true}
>
<Search
categories={
Array [
"general",
],
"defVal": null,
"description": "Description for Test string setting",
"displayName": "Test string setting",
"isCustom": undefined,
"isOverridden": false,
"name": "test:string:setting",
"options": undefined,
"readonly": false,
"type": "string",
"value": undefined,
},
],
"elasticsearch",
]
}
onQueryChange={[Function]}
query={
Query {
"ast": _AST {
"_clauses": Array [
Object {
"field": "ariaName",
"match": "must",
"operator": "eq",
"type": "field",
"value": "test string setting",
},
],
"_indexedClauses": Object {
"field": Object {
"ariaName": Array [
Object {
"field": "ariaName",
"match": "must",
"operator": "eq",
"type": "field",
"value": "test string setting",
},
],
},
"is": Object {},
"term": Array [],
},
},
"syntax": Object {
"parse": [Function],
"print": [Function],
},
"text": "ariaName:\\"test string setting\\"",
}
}
/>
</EuiFlexItem>
</EuiFlexGroup>
<advanced_settings_page_subtitle />
<EuiSpacer
size="m"
/>
<CallOuts />
<EuiSpacer
size="m"
/>
<InjectIntl(FormUI)
categories={
Array [
"general",
"elasticsearch",
]
}
}
showNoResultsMessage={true}
/>
<advanced_settings_page_footer
onQueryMatchChange={[Function]}
query={
Query {
"ast": _AST {
"_clauses": Array [
categoryCounts={
Object {
"elasticsearch": 2,
"general": 11,
}
}
clear={[Function]}
clearQuery={[Function]}
save={[Function]}
settings={
Object {
"general": Array [
Object {
"field": "ariaName",
"match": "must",
"operator": "eq",
"type": "field",
"value": "test string setting",
"ariaName": "test string setting",
"category": Array [
"general",
],
"defVal": null,
"description": "Description for Test string setting",
"displayName": "Test string setting",
"isCustom": undefined,
"isOverridden": false,
"name": "test:string:setting",
"options": undefined,
"readonly": false,
"type": "string",
"value": undefined,
},
],
"_indexedClauses": Object {
"field": Object {
"ariaName": Array [
Object {
"field": "ariaName",
"match": "must",
"operator": "eq",
"type": "field",
"value": "test string setting",
},
],
},
"is": Object {},
"term": Array [],
},
},
"syntax": Object {
"parse": [Function],
"print": [Function],
},
"text": "ariaName:\\"test string setting\\"",
}
}
}
/>
</div>
</EuiPage>
showNoResultsMessage={true}
/>
<advanced_settings_page_footer
onQueryMatchChange={[Function]}
query={
Query {
"ast": _AST {
"_clauses": Array [
Object {
"field": "ariaName",
"match": "must",
"operator": "eq",
"type": "field",
"value": "test string setting",
},
],
"_indexedClauses": Object {
"field": Object {
"ariaName": Array [
Object {
"field": "ariaName",
"match": "must",
"operator": "eq",
"type": "field",
"value": "test string setting",
},
],
},
"is": Object {},
"term": Array [],
},
},
"syntax": Object {
"parse": [Function],
"print": [Function],
},
"text": "ariaName:\\"test string setting\\"",
}
}
/>
</div>
</EuiPage>
</I18nProvider>
`;

View file

@ -43,6 +43,8 @@ import {
} from './components/default_component_registry';
import { getSettingsComponent } from './components/component_registry';
import { I18nProvider } from '@kbn/i18n/react';
export class AdvancedSettings extends Component {
static propTypes = {
config: PropTypes.object.isRequired,
@ -154,36 +156,38 @@ export class AdvancedSettings extends Component {
const PageFooter = getSettingsComponent(PAGE_FOOTER_COMPONENT);
return (
<EuiPage restrictWidth>
<div className="mgtAdvancedSettings">
<EuiFlexGroup gutterSize="none">
<EuiFlexItem>
<PageTitle />
</EuiFlexItem>
<EuiFlexItem>
<Search
query={query}
categories={this.categories}
onQueryChange={this.onQueryChange}
/>
</EuiFlexItem>
</EuiFlexGroup>
<PageSubtitle />
<EuiSpacer size="m" />
<CallOuts />
<EuiSpacer size="m" />
<Form
settings={filteredSettings}
categories={this.categories}
categoryCounts={this.categoryCounts}
clearQuery={this.clearQuery}
save={this.saveConfig}
clear={this.clearConfig}
showNoResultsMessage={!footerQueryMatched}
/>
<PageFooter query={query} onQueryMatchChange={this.onFooterQueryMatchChange} />
</div>
</EuiPage>
<I18nProvider>
<EuiPage restrictWidth>
<div className="mgtAdvancedSettings">
<EuiFlexGroup gutterSize="none">
<EuiFlexItem>
<PageTitle />
</EuiFlexItem>
<EuiFlexItem>
<Search
query={query}
categories={this.categories}
onQueryChange={this.onQueryChange}
/>
</EuiFlexItem>
</EuiFlexGroup>
<PageSubtitle />
<EuiSpacer size="m" />
<CallOuts />
<EuiSpacer size="m" />
<Form
settings={filteredSettings}
categories={this.categories}
categoryCounts={this.categoryCounts}
clearQuery={this.clearQuery}
save={this.saveConfig}
clear={this.clearConfig}
showNoResultsMessage={!footerQueryMatched}
/>
<PageFooter query={query} onQueryMatchChange={this.onFooterQueryMatchChange} />
</div>
</EuiPage>
</I18nProvider>
);
}
}

View file

@ -6,10 +6,20 @@ exports[`CallOuts should render normally 1`] = `
color="warning"
iconType="bolt"
size="m"
title="Caution: You can break stuff here"
title={
<FormattedMessage
defaultMessage="Caution: You can break stuff here"
id="kbn.management.settings.callOutCautionTitle"
values={Object {}}
/>
}
>
<p>
Be careful in here, these settings are for very advanced users only. Tweaks you make here can break large portions of Kibana. Some of these settings may be undocumented, unsupported or experimental. If a field has a default value, blanking the field will reset it to its default which may be unacceptable given other configuration directives. Deleting a custom setting will permanently remove it from Kibana's config.
<FormattedMessage
defaultMessage="Be careful in here, these settings are for very advanced users only. Tweaks you make here can break large portions of Kibana. Some of these settings may be undocumented, unsupported or experimental. If a field has a default value, blanking the field will reset it to its default which may be unacceptable given other configuration directives. Deleting a custom setting will permanently remove it from Kibana's config."
id="kbn.management.settings.callOutCautionDescription"
values={Object {}}
/>
</p>
</EuiCallOut>
</div>

View file

@ -22,22 +22,31 @@ import React from 'react';
import {
EuiCallOut,
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
export const CallOuts = () => {
return (
<div>
<EuiCallOut
title="Caution: You can break stuff here"
title={(
<FormattedMessage
id="kbn.management.settings.callOutCautionTitle"
defaultMessage="Caution: You can break stuff here"
/>
)}
color="warning"
iconType="bolt"
>
<p>
Be careful in here, these settings are for very advanced users only.
Tweaks you make here can break large portions of Kibana.
Some of these settings may be undocumented, unsupported or experimental.
If a field has a default value, blanking the field will reset it to its default which may be
unacceptable given other configuration directives.
Deleting a custom setting will permanently remove it from Kibana&apos;s config.
<FormattedMessage
id="kbn.management.settings.callOutCautionDescription"
defaultMessage="Be careful in here, these settings are for very advanced users only.
Tweaks you make here can break large portions of Kibana.
Some of these settings may be undocumented, unsupported or experimental.
If a field has a default value, blanking the field will reset it to its default which may be
unacceptable given other configuration directives.
Deleting a custom setting will permanently remove it from Kibana&apos;s config."
/>
</p>
</EuiCallOut>
</div>

View file

@ -35,10 +35,17 @@ exports[`Field for array setting should render as read only with help text if ov
size="xs"
>
<React.Fragment>
Default:
<EuiCode>
default_value
</EuiCode>
<FormattedMessage
defaultMessage="Default: {value}"
id="kbn.management.settings.field.defaultValueText"
values={
Object {
"value": <EuiCode>
default_value
</EuiCode>,
}
}
/>
</React.Fragment>
</EuiText>
</React.Fragment>
@ -69,7 +76,11 @@ exports[`Field for array setting should render as read only with help text if ov
grow={true}
size="xs"
>
This setting is overriden by the Kibana server and can not be changed.
<FormattedMessage
defaultMessage="This setting is overriden by the Kibana server and can not be changed."
id="kbn.management.settings.field.helpText"
values={Object {}}
/>
</EuiText>
}
isInvalid={false}
@ -133,7 +144,13 @@ exports[`Field for array setting should render custom setting icon if it is cust
<EuiIconTip
aria-label="Custom setting"
color="primary"
content="Custom setting"
content={
<FormattedMessage
defaultMessage="Custom setting"
id="kbn.management.settings.field.customSettingTooltip"
values={Object {}}
/>
}
type="asterisk"
/>
</h3>
@ -282,10 +299,17 @@ exports[`Field for array setting should render user value if there is user value
size="xs"
>
<React.Fragment>
Default:
<EuiCode>
default_value
</EuiCode>
<FormattedMessage
defaultMessage="Default: {value}"
id="kbn.management.settings.field.defaultValueText"
values={
Object {
"value": <EuiCode>
default_value
</EuiCode>,
}
}
/>
</React.Fragment>
</EuiText>
</React.Fragment>
@ -315,13 +339,17 @@ exports[`Field for array setting should render user value if there is user value
<span>
<span>
<EuiLink
aria-label="Reset array test setting to default"
aria-label="Reset {ariaName} to default"
color="primary"
data-test-subj="advancedSetting-resetField-array:test:setting"
onClick={[Function]}
type="button"
>
Reset to default
<FormattedMessage
defaultMessage="Reset to default"
id="kbn.management.settings.field.resetToDefaultLinkText"
values={Object {}}
/>
</EuiLink>
   
</span>
@ -386,10 +414,17 @@ exports[`Field for boolean setting should render as read only with help text if
size="xs"
>
<React.Fragment>
Default:
<EuiCode>
true
</EuiCode>
<FormattedMessage
defaultMessage="Default: {value}"
id="kbn.management.settings.field.defaultValueText"
values={
Object {
"value": <EuiCode>
true
</EuiCode>,
}
}
/>
</React.Fragment>
</EuiText>
</React.Fragment>
@ -420,7 +455,11 @@ exports[`Field for boolean setting should render as read only with help text if
grow={true}
size="xs"
>
This setting is overriden by the Kibana server and can not be changed.
<FormattedMessage
defaultMessage="This setting is overriden by the Kibana server and can not be changed."
id="kbn.management.settings.field.helpText"
values={Object {}}
/>
</EuiText>
}
isInvalid={false}
@ -482,7 +521,13 @@ exports[`Field for boolean setting should render custom setting icon if it is cu
<EuiIconTip
aria-label="Custom setting"
color="primary"
content="Custom setting"
content={
<FormattedMessage
defaultMessage="Custom setting"
id="kbn.management.settings.field.customSettingTooltip"
values={Object {}}
/>
}
type="asterisk"
/>
</h3>
@ -627,10 +672,17 @@ exports[`Field for boolean setting should render user value if there is user val
size="xs"
>
<React.Fragment>
Default:
<EuiCode>
true
</EuiCode>
<FormattedMessage
defaultMessage="Default: {value}"
id="kbn.management.settings.field.defaultValueText"
values={
Object {
"value": <EuiCode>
true
</EuiCode>,
}
}
/>
</React.Fragment>
</EuiText>
</React.Fragment>
@ -660,13 +712,17 @@ exports[`Field for boolean setting should render user value if there is user val
<span>
<span>
<EuiLink
aria-label="Reset boolean test setting to default"
aria-label="Reset {ariaName} to default"
color="primary"
data-test-subj="advancedSetting-resetField-boolean:test:setting"
onClick={[Function]}
type="button"
>
Reset to default
<FormattedMessage
defaultMessage="Reset to default"
id="kbn.management.settings.field.resetToDefaultLinkText"
values={Object {}}
/>
</EuiLink>
   
</span>
@ -729,10 +785,17 @@ exports[`Field for image setting should render as read only with help text if ov
size="xs"
>
<React.Fragment>
Default:
<EuiCode>
null
</EuiCode>
<FormattedMessage
defaultMessage="Default: {value}"
id="kbn.management.settings.field.defaultValueText"
values={
Object {
"value": <EuiCode>
null
</EuiCode>,
}
}
/>
</React.Fragment>
</EuiText>
</React.Fragment>
@ -763,7 +826,11 @@ exports[`Field for image setting should render as read only with help text if ov
grow={true}
size="xs"
>
This setting is overriden by the Kibana server and can not be changed.
<FormattedMessage
defaultMessage="This setting is overriden by the Kibana server and can not be changed."
id="kbn.management.settings.field.helpText"
values={Object {}}
/>
</EuiText>
}
isInvalid={false}
@ -824,7 +891,13 @@ exports[`Field for image setting should render custom setting icon if it is cust
<EuiIconTip
aria-label="Custom setting"
color="primary"
content="Custom setting"
content={
<FormattedMessage
defaultMessage="Custom setting"
id="kbn.management.settings.field.customSettingTooltip"
values={Object {}}
/>
}
type="asterisk"
/>
</h3>
@ -969,10 +1042,17 @@ exports[`Field for image setting should render user value if there is user value
size="xs"
>
<React.Fragment>
Default:
<EuiCode>
null
</EuiCode>
<FormattedMessage
defaultMessage="Default: {value}"
id="kbn.management.settings.field.defaultValueText"
values={
Object {
"value": <EuiCode>
null
</EuiCode>,
}
}
/>
</React.Fragment>
</EuiText>
</React.Fragment>
@ -1002,25 +1082,33 @@ exports[`Field for image setting should render user value if there is user value
<span>
<span>
<EuiLink
aria-label="Reset image test setting to default"
aria-label="Reset {ariaName} to default"
color="primary"
data-test-subj="advancedSetting-resetField-image:test:setting"
onClick={[Function]}
type="button"
>
Reset to default
<FormattedMessage
defaultMessage="Reset to default"
id="kbn.management.settings.field.resetToDefaultLinkText"
values={Object {}}
/>
</EuiLink>
   
</span>
<span>
<EuiLink
aria-label="Change image test setting"
aria-label="Change {ariaName}"
color="primary"
data-test-subj="advancedSetting-changeImage-image:test:setting"
onClick={[Function]}
type="button"
>
Change image
<FormattedMessage
defaultMessage="Change image"
id="kbn.management.settings.field.changeImageLinkText"
values={Object {}}
/>
</EuiLink>
</span>
</span>
@ -1081,14 +1169,21 @@ exports[`Field for json setting should render as read only with help text if ove
size="xs"
>
<React.Fragment>
Default:
<EuiCodeBlock
language="json"
overflowHeight={null}
paddingSize="s"
>
{}
</EuiCodeBlock>
<FormattedMessage
defaultMessage="Default: {value}"
id="kbn.management.settings.field.defaultValueTypeJsonText"
values={
Object {
"value": <EuiCodeBlock
language="json"
overflowHeight={null}
paddingSize="s"
>
{}
</EuiCodeBlock>,
}
}
/>
</React.Fragment>
</EuiText>
</React.Fragment>
@ -1119,7 +1214,11 @@ exports[`Field for json setting should render as read only with help text if ove
grow={true}
size="xs"
>
This setting is overriden by the Kibana server and can not be changed.
<FormattedMessage
defaultMessage="This setting is overriden by the Kibana server and can not be changed."
id="kbn.management.settings.field.helpText"
values={Object {}}
/>
</EuiText>
}
isInvalid={false}
@ -1199,7 +1298,13 @@ exports[`Field for json setting should render custom setting icon if it is custo
<EuiIconTip
aria-label="Custom setting"
color="primary"
content="Custom setting"
content={
<FormattedMessage
defaultMessage="Custom setting"
id="kbn.management.settings.field.customSettingTooltip"
values={Object {}}
/>
}
type="asterisk"
/>
</h3>
@ -1291,14 +1396,21 @@ exports[`Field for json setting should render default value if there is no user
size="xs"
>
<React.Fragment>
Default:
<EuiCodeBlock
language="json"
overflowHeight={null}
paddingSize="s"
>
{}
</EuiCodeBlock>
<FormattedMessage
defaultMessage="Default: {value}"
id="kbn.management.settings.field.defaultValueTypeJsonText"
values={
Object {
"value": <EuiCodeBlock
language="json"
overflowHeight={null}
paddingSize="s"
>
{}
</EuiCodeBlock>,
}
}
/>
</React.Fragment>
</EuiText>
</React.Fragment>
@ -1328,13 +1440,17 @@ exports[`Field for json setting should render default value if there is no user
<span>
<span>
<EuiLink
aria-label="Reset json test setting to default"
aria-label="Reset {ariaName} to default"
color="primary"
data-test-subj="advancedSetting-resetField-json:test:setting"
onClick={[Function]}
type="button"
>
Reset to default
<FormattedMessage
defaultMessage="Reset to default"
id="kbn.management.settings.field.resetToDefaultLinkText"
values={Object {}}
/>
</EuiLink>
   
</span>
@ -1415,14 +1531,21 @@ exports[`Field for json setting should render user value if there is user value
size="xs"
>
<React.Fragment>
Default:
<EuiCodeBlock
language="json"
overflowHeight={null}
paddingSize="s"
>
{}
</EuiCodeBlock>
<FormattedMessage
defaultMessage="Default: {value}"
id="kbn.management.settings.field.defaultValueTypeJsonText"
values={
Object {
"value": <EuiCodeBlock
language="json"
overflowHeight={null}
paddingSize="s"
>
{}
</EuiCodeBlock>,
}
}
/>
</React.Fragment>
</EuiText>
</React.Fragment>
@ -1452,13 +1575,17 @@ exports[`Field for json setting should render user value if there is user value
<span>
<span>
<EuiLink
aria-label="Reset json test setting to default"
aria-label="Reset {ariaName} to default"
color="primary"
data-test-subj="advancedSetting-resetField-json:test:setting"
onClick={[Function]}
type="button"
>
Reset to default
<FormattedMessage
defaultMessage="Reset to default"
id="kbn.management.settings.field.resetToDefaultLinkText"
values={Object {}}
/>
</EuiLink>
   
</span>
@ -1539,10 +1666,17 @@ exports[`Field for markdown setting should render as read only with help text if
size="xs"
>
<React.Fragment>
Default:
<EuiCode>
null
</EuiCode>
<FormattedMessage
defaultMessage="Default: {value}"
id="kbn.management.settings.field.defaultValueText"
values={
Object {
"value": <EuiCode>
null
</EuiCode>,
}
}
/>
</React.Fragment>
</EuiText>
</React.Fragment>
@ -1573,7 +1707,11 @@ exports[`Field for markdown setting should render as read only with help text if
grow={true}
size="xs"
>
This setting is overriden by the Kibana server and can not be changed.
<FormattedMessage
defaultMessage="This setting is overriden by the Kibana server and can not be changed."
id="kbn.management.settings.field.helpText"
values={Object {}}
/>
</EuiText>
}
isInvalid={false}
@ -1653,7 +1791,13 @@ exports[`Field for markdown setting should render custom setting icon if it is c
<EuiIconTip
aria-label="Custom setting"
color="primary"
content="Custom setting"
content={
<FormattedMessage
defaultMessage="Custom setting"
id="kbn.management.settings.field.customSettingTooltip"
values={Object {}}
/>
}
type="asterisk"
/>
</h3>
@ -1834,10 +1978,17 @@ exports[`Field for markdown setting should render user value if there is user va
size="xs"
>
<React.Fragment>
Default:
<EuiCode>
null
</EuiCode>
<FormattedMessage
defaultMessage="Default: {value}"
id="kbn.management.settings.field.defaultValueText"
values={
Object {
"value": <EuiCode>
null
</EuiCode>,
}
}
/>
</React.Fragment>
</EuiText>
</React.Fragment>
@ -1867,13 +2018,17 @@ exports[`Field for markdown setting should render user value if there is user va
<span>
<span>
<EuiLink
aria-label="Reset markdown test setting to default"
aria-label="Reset {ariaName} to default"
color="primary"
data-test-subj="advancedSetting-resetField-markdown:test:setting"
onClick={[Function]}
type="button"
>
Reset to default
<FormattedMessage
defaultMessage="Reset to default"
id="kbn.management.settings.field.resetToDefaultLinkText"
values={Object {}}
/>
</EuiLink>
   
</span>
@ -1954,10 +2109,17 @@ exports[`Field for number setting should render as read only with help text if o
size="xs"
>
<React.Fragment>
Default:
<EuiCode>
5
</EuiCode>
<FormattedMessage
defaultMessage="Default: {value}"
id="kbn.management.settings.field.defaultValueText"
values={
Object {
"value": <EuiCode>
5
</EuiCode>,
}
}
/>
</React.Fragment>
</EuiText>
</React.Fragment>
@ -1988,7 +2150,11 @@ exports[`Field for number setting should render as read only with help text if o
grow={true}
size="xs"
>
This setting is overriden by the Kibana server and can not be changed.
<FormattedMessage
defaultMessage="This setting is overriden by the Kibana server and can not be changed."
id="kbn.management.settings.field.helpText"
values={Object {}}
/>
</EuiText>
}
isInvalid={false}
@ -2052,7 +2218,13 @@ exports[`Field for number setting should render custom setting icon if it is cus
<EuiIconTip
aria-label="Custom setting"
color="primary"
content="Custom setting"
content={
<FormattedMessage
defaultMessage="Custom setting"
id="kbn.management.settings.field.customSettingTooltip"
values={Object {}}
/>
}
type="asterisk"
/>
</h3>
@ -2201,10 +2373,17 @@ exports[`Field for number setting should render user value if there is user valu
size="xs"
>
<React.Fragment>
Default:
<EuiCode>
5
</EuiCode>
<FormattedMessage
defaultMessage="Default: {value}"
id="kbn.management.settings.field.defaultValueText"
values={
Object {
"value": <EuiCode>
5
</EuiCode>,
}
}
/>
</React.Fragment>
</EuiText>
</React.Fragment>
@ -2234,13 +2413,17 @@ exports[`Field for number setting should render user value if there is user valu
<span>
<span>
<EuiLink
aria-label="Reset number test setting to default"
aria-label="Reset {ariaName} to default"
color="primary"
data-test-subj="advancedSetting-resetField-number:test:setting"
onClick={[Function]}
type="button"
>
Reset to default
<FormattedMessage
defaultMessage="Reset to default"
id="kbn.management.settings.field.resetToDefaultLinkText"
values={Object {}}
/>
</EuiLink>
   
</span>
@ -2305,10 +2488,17 @@ exports[`Field for select setting should render as read only with help text if o
size="xs"
>
<React.Fragment>
Default:
<EuiCode>
orange
</EuiCode>
<FormattedMessage
defaultMessage="Default: {value}"
id="kbn.management.settings.field.defaultValueText"
values={
Object {
"value": <EuiCode>
orange
</EuiCode>,
}
}
/>
</React.Fragment>
</EuiText>
</React.Fragment>
@ -2339,7 +2529,11 @@ exports[`Field for select setting should render as read only with help text if o
grow={true}
size="xs"
>
This setting is overriden by the Kibana server and can not be changed.
<FormattedMessage
defaultMessage="This setting is overriden by the Kibana server and can not be changed."
id="kbn.management.settings.field.helpText"
values={Object {}}
/>
</EuiText>
}
isInvalid={false}
@ -2420,7 +2614,13 @@ exports[`Field for select setting should render custom setting icon if it is cus
<EuiIconTip
aria-label="Custom setting"
color="primary"
content="Custom setting"
content={
<FormattedMessage
defaultMessage="Custom setting"
id="kbn.management.settings.field.customSettingTooltip"
values={Object {}}
/>
}
type="asterisk"
/>
</h3>
@ -2603,10 +2803,17 @@ exports[`Field for select setting should render user value if there is user valu
size="xs"
>
<React.Fragment>
Default:
<EuiCode>
orange
</EuiCode>
<FormattedMessage
defaultMessage="Default: {value}"
id="kbn.management.settings.field.defaultValueText"
values={
Object {
"value": <EuiCode>
orange
</EuiCode>,
}
}
/>
</React.Fragment>
</EuiText>
</React.Fragment>
@ -2636,13 +2843,17 @@ exports[`Field for select setting should render user value if there is user valu
<span>
<span>
<EuiLink
aria-label="Reset select test setting to default"
aria-label="Reset {ariaName} to default"
color="primary"
data-test-subj="advancedSetting-resetField-select:test:setting"
onClick={[Function]}
type="button"
>
Reset to default
<FormattedMessage
defaultMessage="Reset to default"
id="kbn.management.settings.field.resetToDefaultLinkText"
values={Object {}}
/>
</EuiLink>
   
</span>
@ -2724,10 +2935,17 @@ exports[`Field for string setting should render as read only with help text if o
size="xs"
>
<React.Fragment>
Default:
<EuiCode>
null
</EuiCode>
<FormattedMessage
defaultMessage="Default: {value}"
id="kbn.management.settings.field.defaultValueText"
values={
Object {
"value": <EuiCode>
null
</EuiCode>,
}
}
/>
</React.Fragment>
</EuiText>
</React.Fragment>
@ -2758,7 +2976,11 @@ exports[`Field for string setting should render as read only with help text if o
grow={true}
size="xs"
>
This setting is overriden by the Kibana server and can not be changed.
<FormattedMessage
defaultMessage="This setting is overriden by the Kibana server and can not be changed."
id="kbn.management.settings.field.helpText"
values={Object {}}
/>
</EuiText>
}
isInvalid={false}
@ -2822,7 +3044,13 @@ exports[`Field for string setting should render custom setting icon if it is cus
<EuiIconTip
aria-label="Custom setting"
color="primary"
content="Custom setting"
content={
<FormattedMessage
defaultMessage="Custom setting"
id="kbn.management.settings.field.customSettingTooltip"
values={Object {}}
/>
}
type="asterisk"
/>
</h3>
@ -2971,10 +3199,17 @@ exports[`Field for string setting should render user value if there is user valu
size="xs"
>
<React.Fragment>
Default:
<EuiCode>
null
</EuiCode>
<FormattedMessage
defaultMessage="Default: {value}"
id="kbn.management.settings.field.defaultValueText"
values={
Object {
"value": <EuiCode>
null
</EuiCode>,
}
}
/>
</React.Fragment>
</EuiText>
</React.Fragment>
@ -3004,13 +3239,17 @@ exports[`Field for string setting should render user value if there is user valu
<span>
<span>
<EuiLink
aria-label="Reset string test setting to default"
aria-label="Reset {ariaName} to default"
color="primary"
data-test-subj="advancedSetting-resetField-string:test:setting"
onClick={[Function]}
type="button"
>
Reset to default
<FormattedMessage
defaultMessage="Reset to default"
id="kbn.management.settings.field.resetToDefaultLinkText"
values={Object {}}
/>
</EuiLink>
   
</span>

View file

@ -49,7 +49,9 @@ import {
import { isDefaultValue } from '../../lib';
export class Field extends PureComponent {
import { FormattedMessage, injectI18n } from '@kbn/i18n/react';
class FieldUI extends PureComponent {
static propTypes = {
setting: PropTypes.object.isRequired,
@ -141,7 +143,11 @@ export class Field extends PureComponent {
JSON.parse(newUnsavedValue);
} catch (e) {
isInvalid = true;
error = 'Invalid JSON syntax';
error = (
<FormattedMessage
id="kbn.management.settings.field.codeEditorSyntaxErrorMessage"
defaultMessage="Invalid JSON syntax"
/>);
}
break;
default:
@ -208,12 +214,23 @@ export class Field extends PureComponent {
const isInvalid = !!(maxSize && maxSize.length && base64Image.length > maxSize.length);
this.setState({
isInvalid,
error: isInvalid ? `Image is too large, maximum size is ${maxSize.description}` : null,
error: isInvalid
? this.props.intl.formattedMessage({
id: 'kbn.management.settings.field.imageTooLargeErrorMessage',
defaultMessage: 'Image is too large, maximum size is {maxSizeDescription}'
}, {
maxSizeDescription: maxSize.description
}) : null,
changeImage: true,
unsavedValue: base64Image,
});
} catch (err) {
toastNotifications.addDanger('Image could not be saved');
toastNotifications.addDanger(
this.props.intl.formatMessage({
id: 'kbn.management.settings.field.imageChangeErrorMessage',
defaultMessage: 'Image could not be saved'
})
);
this.cancelChangeImage();
}
}
@ -299,7 +316,13 @@ export class Field extends PureComponent {
this.cancelChangeImage();
}
} catch (e) {
toastNotifications.addDanger(`Unable to save ${name}`);
toastNotifications.addDanger(
this.props.intl.formatMessage({
id: 'kbn.management.settings.field.saveFieldErrorMessage',
defaultMessage: 'Unable to save {name}'
},
{ name })
);
}
this.setLoading(false);
}
@ -312,7 +335,13 @@ export class Field extends PureComponent {
this.cancelChangeImage();
this.clearError();
} catch (e) {
toastNotifications.addDanger(`Unable to reset ${name}`);
toastNotifications.addDanger(
this.props.intl.formatMessage({
id: 'kbn.management.settings.field.resetFieldErrorMessage',
defaultMessage: 'Unable to reset {name}'
},
{ name })
);
}
this.setLoading(false);
}
@ -432,7 +461,10 @@ export class Field extends PureComponent {
if (setting.isOverridden) {
return (
<EuiText size="xs">
This setting is overriden by the Kibana server and can not be changed.
<FormattedMessage
id="kbn.management.settings.field.helpText"
defaultMessage="This setting is overriden by the Kibana server and can not be changed."
/>
</EuiText>
);
}
@ -457,7 +489,18 @@ export class Field extends PureComponent {
<h3>
{setting.displayName || setting.name}
{setting.isCustom ?
<EuiIconTip type="asterisk" color="primary" aria-label="Custom setting" content="Custom setting" />
<EuiIconTip
type="asterisk"
color="primary"
aria-label={this.props.intl.formatMessage({
id: 'kbn.management.settings.field.customSettingAriaLabel',
defaultMessage: 'Custom setting',
})}
content={(<FormattedMessage
id="kbn.management.settings.field.customSettingTooltip"
defaultMessage="Custom setting"
/>)}
/>
: ''}
</h3>
);
@ -499,18 +542,31 @@ export class Field extends PureComponent {
<EuiText size="xs">
{type === 'json' ? (
<Fragment>
Default:
<EuiCodeBlock
language="json"
paddingSize="s"
overflowHeight={defVal.length >= 500 ? 300 : null}
>
{this.getDisplayedDefaultValue(type, defVal)}
</EuiCodeBlock>
<FormattedMessage
id="kbn.management.settings.field.defaultValueTypeJsonText"
defaultMessage="Default: {value}"
values={{
value: (
<EuiCodeBlock
language="json"
paddingSize="s"
overflowHeight={defVal.length >= 500 ? 300 : null}
>
{this.getDisplayedDefaultValue(type, defVal)}
</EuiCodeBlock>
)
}}
/>
</Fragment>
) : (
<Fragment>
Default: <EuiCode>{this.getDisplayedDefaultValue(type, defVal)}</EuiCode>
<FormattedMessage
id="kbn.management.settings.field.defaultValueText"
defaultMessage="Default: {value}"
values={{
value: (<EuiCode>{this.getDisplayedDefaultValue(type, defVal)}</EuiCode>),
}}
/>
</Fragment>
)}
</EuiText>
@ -526,11 +582,20 @@ export class Field extends PureComponent {
return (
<span>
<EuiLink
aria-label={`Reset ${ariaName} to default`}
aria-label={this.props.intl.formatMessage({
id: 'kbn.management.settings.field.resetToDefaultLinkAriaLabel',
defaultMessage: 'Reset {ariaName} to default',
},
{
ariaName,
})}
onClick={this.resetField}
data-test-subj={`advancedSetting-resetField-${name}`}
>
Reset to default
<FormattedMessage
id="kbn.management.settings.field.resetToDefaultLinkText"
defaultMessage="Reset to default"
/>
</EuiLink>
&nbsp;&nbsp;&nbsp;
</span>
@ -546,11 +611,20 @@ export class Field extends PureComponent {
return (
<span>
<EuiLink
aria-label={`Change ${ariaName}`}
aria-label={this.props.intl.formatMessage({
id: 'kbn.management.settings.field.changeImageLinkAriaLabel',
defaultMessage: 'Change {ariaName}',
},
{
ariaName,
})}
onClick={this.changeImage}
data-test-subj={`advancedSetting-changeImage-${name}`}
>
Change image
<FormattedMessage
id="kbn.management.settings.field.changeImageLinkText"
defaultMessage="Change image"
/>
</EuiLink>
</span>
);
@ -560,6 +634,7 @@ export class Field extends PureComponent {
const { ariaName, name } = setting;
const { loading, isInvalid, changeImage, savedValue, unsavedValue } = this.state;
const isDisabled = loading || setting.isOverridden;
const { intl } = this.props;
if (savedValue === unsavedValue && !changeImage) {
return;
@ -571,22 +646,40 @@ export class Field extends PureComponent {
<EuiFlexItem grow={false}>
<EuiButton
fill
aria-label={`Save ${ariaName}`}
aria-label={intl.formatMessage({
id: 'kbn.management.settings.field.saveButtonAriaLabel',
defaultMessage: 'Save {ariaName}',
},
{
ariaName,
})}
onClick={this.saveEdit}
disabled={isDisabled || isInvalid}
data-test-subj={`advancedSetting-saveEditField-${name}`}
>
Save
<FormattedMessage
id="kbn.management.settings.field.saveButtonLabel"
defaultMessage="Save"
/>
</EuiButton>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiButtonEmpty
aria-label={`Cancel editing ${ariaName}`}
aria-label={intl.formatMessage({
id: 'kbn.management.settings.field.cancelEditingButtonAriaLabel',
defaultMessage: 'Cancel editing {ariaName}',
},
{
ariaName,
})}
onClick={() => changeImage ? this.cancelChangeImage() : this.cancelEdit()}
disabled={isDisabled}
data-test-subj={`advancedSetting-cancelEditField-${name}`}
>
Cancel
<FormattedMessage
id="kbn.management.settings.field.cancelEditingButtonLabel"
defaultMessage="Cancel"
/>
</EuiButtonEmpty>
</EuiFlexItem>
</EuiFlexGroup>
@ -625,3 +718,5 @@ export class Field extends PureComponent {
);
}
}
export const Field = injectI18n(FieldUI);

View file

@ -18,7 +18,7 @@
*/
import React from 'react';
import { mount, shallow } from 'enzyme';
import { shallowWithIntl, mountWithIntl } from 'test_utils/enzyme_helpers';
import { findTestSubject } from '@elastic/eui/lib/test';
import { Field } from './field';
@ -155,8 +155,8 @@ describe('Field', () => {
describe(`for ${type} setting`, () => {
it('should render default value if there is no user value set', async () => {
const component = shallow(
<Field
const component = shallowWithIntl(
<Field.WrappedComponent
setting={setting}
save={save}
clear={clear}
@ -167,8 +167,8 @@ describe('Field', () => {
});
it('should render as read only with help text if overridden', async () => {
const component = shallow(
<Field
const component = shallowWithIntl(
<Field.WrappedComponent
setting={{
...setting,
value: userValues[type],
@ -183,8 +183,8 @@ describe('Field', () => {
});
it('should render user value if there is user value is set', async () => {
const component = shallow(
<Field
const component = shallowWithIntl(
<Field.WrappedComponent
setting={{
...setting,
value: userValues[type],
@ -198,8 +198,8 @@ describe('Field', () => {
});
it('should render custom setting icon if it is custom', async () => {
const component = shallow(
<Field
const component = shallowWithIntl(
<Field.WrappedComponent
setting={{
...setting,
isCustom: true,
@ -215,8 +215,8 @@ describe('Field', () => {
if(type === 'image') {
describe(`for changing ${type} setting`, () => {
const component = mount(
<Field
const component = mountWithIntl(
<Field.WrappedComponent
setting={setting}
save={save}
clear={clear}
@ -268,8 +268,8 @@ describe('Field', () => {
});
} else if(type === 'markdown' || type === 'json') {
describe(`for changing ${type} setting`, () => {
const component = mount(
<Field
const component = mountWithIntl(
<Field.WrappedComponent
setting={setting}
save={save}
clear={clear}
@ -314,8 +314,8 @@ describe('Field', () => {
});
} else {
describe(`for changing ${type} setting`, () => {
const component = mount(
<Field
const component = mountWithIntl(
<Field.WrappedComponent
setting={setting}
save={save}
clear={clear}

View file

@ -9,14 +9,25 @@ exports[`Form should render no settings message when there are no settings 1`] =
hasShadow={false}
paddingSize="l"
>
No settings found
<EuiLink
color="primary"
onClick={[Function]}
type="button"
>
(Clear search)
</EuiLink>
<FormattedMessage
defaultMessage="No settings found {clearSearch}"
id="kbn.management.settings.form.noSearchResultText"
values={
Object {
"clearSearch": <EuiLink
color="primary"
onClick={[Function]}
type="button"
>
<FormattedMessage
defaultMessage="(clear search)"
id="kbn.management.settings.form.clearNoSearchResultText"
values={Object {}}
/>
</EuiLink>,
}
}
/>
</EuiPanel>
</React.Fragment>
`;
@ -184,18 +195,28 @@ exports[`Form should render normally 1`] = `
grow={false}
>
<em>
Search terms are hiding
9
settings
<EuiLink
color="primary"
onClick={[Function]}
type="button"
>
<em>
(clear search)
</em>
</EuiLink>
<FormattedMessage
defaultMessage="Search terms are hiding {settingsCount} settings {clearSearch}"
id="kbn.management.settings.form.searchResultText"
values={
Object {
"clearSearch": <EuiLink
color="primary"
onClick={[Function]}
type="button"
>
<em>
<FormattedMessage
defaultMessage="(clear search)"
id="kbn.management.settings.form.clearSearchResultText"
values={Object {}}
/>
</em>
</EuiLink>,
"settingsCount": 9,
}
}
/>
</em>
</EuiFlexItem>
</EuiFlexGroup>

View file

@ -32,8 +32,9 @@ import {
import { getCategoryName } from '../../lib';
import { Field } from '../field';
import { FormattedMessage, injectI18n } from '@kbn/i18n/react';
export class Form extends PureComponent {
class FormUI extends PureComponent {
static propTypes = {
settings: PropTypes.object.isRequired,
@ -52,11 +53,23 @@ export class Form extends PureComponent {
return (
<EuiFlexItem grow={false}>
<em>
Search terms are hiding {totalSettings - currentSettings} settings {(
<EuiLink onClick={clearQuery}>
<em>(clear search)</em>
</EuiLink>
)}
<FormattedMessage
id="kbn.management.settings.form.searchResultText"
defaultMessage="Search terms are hiding {settingsCount} settings {clearSearch}"
values={{
settingsCount: (totalSettings - currentSettings),
clearSearch: (
<EuiLink onClick={clearQuery}>
<em>
<FormattedMessage
id="kbn.management.settings.form.clearSearchResultText"
defaultMessage="(clear search)"
/>
</em>
</EuiLink>
),
}}
/>
</em>
</EuiFlexItem>
);
@ -100,7 +113,20 @@ export class Form extends PureComponent {
if (this.props.showNoResultsMessage) {
return (
<EuiPanel paddingSize="l">
No settings found <EuiLink onClick={clearQuery}>(Clear search)</EuiLink>
<FormattedMessage
id="kbn.management.settings.form.noSearchResultText"
defaultMessage="No settings found {clearSearch}"
values={{
clearSearch: (
<EuiLink onClick={clearQuery}>
<FormattedMessage
id="kbn.management.settings.form.clearNoSearchResultText"
defaultMessage="(clear search)"
/>
</EuiLink>
),
}}
/>
</EuiPanel>
);
}
@ -130,3 +156,5 @@ export class Form extends PureComponent {
);
}
}
export const Form = injectI18n(FormUI);

View file

@ -18,7 +18,7 @@
*/
import React from 'react';
import { shallow } from 'enzyme';
import { shallowWithIntl } from 'test_utils/enzyme_helpers';
import { Form } from './form';
@ -75,8 +75,8 @@ const clearQuery = () => { };
describe('Form', () => {
it('should render normally', async () => {
const component = shallow(
<Form
const component = shallowWithIntl(
<Form.WrappedComponent
settings={settings}
categories={categories}
categoryCounts={categoryCounts}
@ -91,8 +91,8 @@ describe('Form', () => {
});
it('should render no settings message when there are no settings', async () => {
const component = shallow(
<Form
const component = shallowWithIntl(
<Form.WrappedComponent
settings={{}}
categories={categories}
categoryCounts={categoryCounts}
@ -107,8 +107,8 @@ describe('Form', () => {
});
it('should not render no settings message when instructed not to', async () => {
const component = shallow(
<Form
const component = shallowWithIntl(
<Form.WrappedComponent
settings={{}}
categories={categories}
categoryCounts={categoryCounts}

View file

@ -17,12 +17,12 @@
* under the License.
*/
import React from 'react';
import { shallow } from 'enzyme';
import { shallowWithIntl } from 'test_utils/enzyme_helpers';
import { PageFooter } from './page_footer';
describe('PageFooter', () => {
it('should render normally', () => {
expect(shallow(<PageFooter />)).toMatchSnapshot();
expect(shallowWithIntl(<PageFooter />)).toMatchSnapshot();
});
});

View file

@ -17,12 +17,12 @@
* under the License.
*/
import React from 'react';
import { shallow } from 'enzyme';
import { shallowWithIntl } from 'test_utils/enzyme_helpers';
import { PageSubtitle } from './page_subtitle';
describe('PageSubtitle', () => {
it('should render normally', () => {
expect(shallow(<PageSubtitle />)).toMatchSnapshot();
expect(shallowWithIntl(<PageSubtitle />)).toMatchSnapshot();
});
});

View file

@ -7,7 +7,11 @@ exports[`PageTitle should render normally 1`] = `
<h1
data-test-subj="managementSettingsTitle"
>
Settings
<FormattedMessage
defaultMessage="Settings"
id="kbn.management.settings.pageTitle"
values={Object {}}
/>
</h1>
</EuiText>
`;

View file

@ -21,11 +21,17 @@ import React from 'react';
import {
EuiText
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
export const PageTitle = () => {
return (
<EuiText>
<h1 data-test-subj="managementSettingsTitle">Settings</h1>
<h1 data-test-subj="managementSettingsTitle">
<FormattedMessage
id="kbn.management.settings.pageTitle"
defaultMessage="Settings"
/>
</h1>
</EuiText>
);
};

View file

@ -17,12 +17,12 @@
* under the License.
*/
import React from 'react';
import { shallow } from 'enzyme';
import { shallowWithIntl } from 'test_utils/enzyme_helpers';
import { PageTitle } from './page_title';
describe('PageTitle', () => {
it('should render normally', () => {
expect(shallow(<PageTitle />)).toMatchSnapshot();
expect(shallowWithIntl(<PageTitle />)).toMatchSnapshot();
});
});

View file

@ -19,6 +19,7 @@
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { injectI18n } from '@kbn/i18n/react';
import {
EuiSearchBar,
@ -26,7 +27,7 @@ import {
import { getCategoryName } from '../../lib';
export class Search extends PureComponent {
class SearchUI extends PureComponent {
static propTypes = {
categories: PropTypes.array.isRequired,
@ -46,18 +47,25 @@ export class Search extends PureComponent {
}
render() {
const { query, onQueryChange } = this.props;
const { query, onQueryChange, intl } = this.props;
const box = {
incremental: true,
'aria-label': 'Search advanced settings' // hack until EuiSearchBar is fixed
'aria-label': intl.formatMessage({
id: 'kbn.management.settings.searchBarAriaLabel',
defaultMessage: 'Search advanced settings',
}), // hack until EuiSearchBar is fixed
};
const filters = [
{
type: 'field_value_selection',
field: 'category',
name: 'Category',
name: intl.formatMessage({
id: 'kbn.management.settings.categorySearchLabel',
defaultMessage: 'Category',
}),
multiSelect: 'or',
options: this.categories,
}
@ -74,3 +82,5 @@ export class Search extends PureComponent {
);
}
}
export const Search = injectI18n(SearchUI);

View file

@ -18,7 +18,8 @@
*/
import React from 'react';
import { shallow, mount } from 'enzyme';
import { shallowWithIntl, mountWithIntl } from 'test_utils/enzyme_helpers';
import { Query } from '@elastic/eui';
import { Search } from './search';
@ -29,8 +30,8 @@ const categories = ['general', 'dashboard', 'hiddenCategory', 'x-pack'];
describe('Search', () => {
it('should render normally', async () => {
const onQueryChange = () => {};
const component = shallow(
<Search
const component = shallowWithIntl(
<Search.WrappedComponent
query={query}
categories={categories}
onQueryChange={onQueryChange}
@ -44,8 +45,8 @@ describe('Search', () => {
//This test is brittle as it knows about implementation details
// (EuiFieldSearch uses onKeyup instead of onChange to handle input)
const onQueryChange = jest.fn();
const component = mount(
<Search
const component = mountWithIntl(
<Search.WrappedComponent
query={query}
categories={categories}
onQueryChange={onQueryChange}

View file

@ -26,6 +26,7 @@ import { FeatureCatalogueRegistryProvider, FeatureCatalogueCategory } from 'ui/r
import React from 'react';
import { render, unmountComponentAtNode } from 'react-dom';
import { AdvancedSettings } from './advanced_settings';
import { i18n } from '@kbn/i18n';
const REACT_ADVANCED_SETTINGS_DOM_ELEMENT_ID = 'reactAdvancedSettings';
@ -75,7 +76,9 @@ uiModules.get('apps/management')
});
management.getSection('kibana').register('settings', {
display: 'Advanced Settings',
display: i18n.translate('kbn.management.settings.sectionLabel', {
defaultMessage: 'Advanced Settings',
}),
order: 20,
url: '#/management/kibana/settings'
});

View file

@ -18,16 +18,33 @@
*/
import { StringUtils } from 'ui/utils/string_utils';
import { i18n } from '@kbn/i18n';
const names = {
general: 'General',
timelion: 'Timelion',
notifications: 'Notifications',
visualizations: 'Visualizations',
discover: 'Discover',
dashboard: 'Dashboard',
reporting: 'Reporting',
search: 'Search',
general: i18n.translate('kbn.management.settings.categoryNames.generalLabel', {
defaultMessage: 'General',
}),
timelion: i18n.translate('kbn.management.settings.categoryNames.timelionLabel', {
defaultMessage: 'Timelion',
}),
notifications: i18n.translate('kbn.management.settings.categoryNames.notificationsLabel', {
defaultMessage: 'Notifications',
}),
visualizations: i18n.translate('kbn.management.settings.categoryNames.visualizationsLabel', {
defaultMessage: 'Visualizations',
}),
discover: i18n.translate('kbn.management.settings.categoryNames.discoverLabel', {
defaultMessage: 'Discover',
}),
dashboard: i18n.translate('kbn.management.settings.categoryNames.dashboardLabel', {
defaultMessage: 'Dashboard',
}),
reporting: i18n.translate('kbn.management.settings.categoryNames.reportingLabel', {
defaultMessage: 'Reporting',
}),
search: i18n.translate('kbn.management.settings.categoryNames.searchLabel', {
defaultMessage: 'Search',
}),
};
export function getCategoryName(category) {

View file

@ -33,7 +33,7 @@ exports[`TelemetryForm renders as expected 1`] = `
<EuiSpacer
size="s"
/>
<Field
<InjectIntl(FieldUI)
clear={[Function]}
save={[Function]}
setting={