diff --git a/.i18nrc.json b/.i18nrc.json
index b2f9245b46808..e196715a32f7f 100644
--- a/.i18nrc.json
+++ b/.i18nrc.json
@@ -13,6 +13,7 @@
"statusPage": "src/core_plugins/status_page",
"tileMap": "src/core_plugins/tile_map",
"timelion": "src/core_plugins/timelion",
+ "tsvb": "src/core_plugins/metrics",
"tagCloud": "src/core_plugins/tagcloud",
"xpack.graph": "x-pack/plugins/graph",
"xpack.grokDebugger": "x-pack/plugins/grokdebugger",
diff --git a/src/core_plugins/metrics/public/components/lib/durations.js b/src/core_plugins/metrics/public/components/lib/durations.js
index da4057eaa66af..dc16a32f2406c 100644
--- a/src/core_plugins/metrics/public/components/lib/durations.js
+++ b/src/core_plugins/metrics/public/components/lib/durations.js
@@ -17,21 +17,55 @@
* under the License.
*/
+import { i18n } from '@kbn/i18n';
+
export const durationOutputOptions = [
- { label: 'milliseconds', value: 'ms' },
- { label: 'seconds', value: 's' },
- { label: 'minutes', value: 'm' },
- { label: 'hours', value: 'h' },
- { label: 'days', value: 'd' },
- { label: 'weeks', value: 'w' },
- { label: 'months', value: 'M' },
- { label: 'years', value: 'Y' }
+ {
+ label: i18n.translate('tsvb.durationOptions.millisecondsLabel', { defaultMessage: 'milliseconds' }),
+ value: 'ms'
+ },
+ {
+ label: i18n.translate('tsvb.durationOptions.secondsLabel', { defaultMessage: 'seconds' }),
+ value: 's'
+ },
+ {
+ label: i18n.translate('tsvb.durationOptions.minutesLabel', { defaultMessage: 'minutes' }),
+ value: 'm'
+ },
+ {
+ label: i18n.translate('tsvb.durationOptions.hoursLabel', { defaultMessage: 'hours' }),
+ value: 'h'
+ },
+ {
+ label: i18n.translate('tsvb.durationOptions.daysLabel', { defaultMessage: 'days' }),
+ value: 'd'
+ },
+ {
+ label: i18n.translate('tsvb.durationOptions.weeksLabel', { defaultMessage: 'weeks' }),
+ value: 'w'
+ },
+ {
+ label: i18n.translate('tsvb.durationOptions.monthsLabel', { defaultMessage: 'months' }),
+ value: 'M'
+ },
+ {
+ label: i18n.translate('tsvb.durationOptions.yearsLabel', { defaultMessage: 'years' }),
+ value: 'Y'
+ }
];
export const durationInputOptions = [
- { label: 'picoseconds', value: 'ps' },
- { label: 'nanoseconds', value: 'ns' },
- { label: 'microseconds', value: 'us' },
+ {
+ label: i18n.translate('tsvb.durationOptions.picosecondsLabel', { defaultMessage: 'picoseconds' }),
+ value: 'ps'
+ },
+ {
+ label: i18n.translate('tsvb.durationOptions.nanosecondsLabel', { defaultMessage: 'nanoseconds' }),
+ value: 'ns'
+ },
+ {
+ label: i18n.translate('tsvb.durationOptions.microsecondsLabel', { defaultMessage: 'microseconds' }),
+ value: 'us' },
...durationOutputOptions
];
diff --git a/src/core_plugins/metrics/public/components/lib/get_axis_label_string.js b/src/core_plugins/metrics/public/components/lib/get_axis_label_string.js
index 726b3ffaa41d9..c19cfffdc4538 100644
--- a/src/core_plugins/metrics/public/components/lib/get_axis_label_string.js
+++ b/src/core_plugins/metrics/public/components/lib/get_axis_label_string.js
@@ -20,14 +20,16 @@
import { relativeOptions } from '../../../../../ui/public/timepicker/relative_options';
import _ from 'lodash';
import moment from 'moment';
+import { i18n } from '@kbn/i18n';
+
const unitLookup = {
- s: 'seconds',
- m: 'minutes',
- h: 'hours',
- d: 'days',
- w: 'weeks',
- M: 'months',
- y: 'years'
+ s: i18n.translate('tsvb.axisLabelOptions.secondsLabel', { defaultMessage: 'seconds' }),
+ m: i18n.translate('tsvb.axisLabelOptions.minutesLabel', { defaultMessage: 'minutes' }),
+ h: i18n.translate('tsvb.axisLabelOptions.hoursLabel', { defaultMessage: 'hours' }),
+ d: i18n.translate('tsvb.axisLabelOptions.daysLabel', { defaultMessage: 'days' }),
+ w: i18n.translate('tsvb.axisLabelOptions.weeksLabel', { defaultMessage: 'weeks' }),
+ M: i18n.translate('tsvb.axisLabelOptions.monthsLabel', { defaultMessage: 'months' }),
+ y: i18n.translate('tsvb.axisLabelOptions.yearsLabel', { defaultMessage: 'years' })
};
export function getAxisLabelString(interval) {
const units = _.pluck(_.clone(relativeOptions).reverse(), 'value')
@@ -38,7 +40,8 @@ export function getAxisLabelString(interval) {
if (Math.abs(as) > 1) {
const unitValue = Math.round(Math.abs(as));
const unitString = unitLookup[units[i]];
- return `per ${unitValue} ${unitString}`;
+ return i18n.translate('tsvb.axisLabelOptions.axisLabel',
+ { defaultMessage: 'per {unitValue} {unitString}', values: { unitValue, unitString } });
}
}
}
diff --git a/src/core_plugins/metrics/public/components/lib/replace_vars.js b/src/core_plugins/metrics/public/components/lib/replace_vars.js
index 16158e25d04f6..97d439636dd29 100644
--- a/src/core_plugins/metrics/public/components/lib/replace_vars.js
+++ b/src/core_plugins/metrics/public/components/lib/replace_vars.js
@@ -19,6 +19,8 @@
import _ from 'lodash';
import handlebars from 'handlebars/dist/handlebars';
+import { i18n } from '@kbn/i18n';
+
export default function replaceVars(str, args = {}, vars = {}) {
try {
const template = handlebars.compile(str, { strict: true });
@@ -36,15 +38,17 @@ export default function replaceVars(str, args = {}, vars = {}) {
const badVar = e.message.split(/"/)[1];
e.error = {
caused_by: {
- reason: `{{${badVar}}} is an unknown variable`,
- title: 'Error processing your markdown'
+ reason: i18n.translate('tsvb.replaceVars.errors.unknownVarDescription',
+ { defaultMessage: '{badVar} is an unknown variable', values: { badVar: '{{' + badVar + '}}' } }),
+ title: i18n.translate('tsvb.replaceVars.errors.unknownVarTitle', { defaultMessage: 'Error processing your markdown' })
}
};
} else {
e.error = {
caused_by: {
- reason: 'Please verify you are only using markdown, known variables, and built-in Handlebars expressions',
- title: 'Error processing your markdown'
+ reason: i18n.translate('tsvb.replaceVars.errors.markdownErrorDescription', {
+ defaultMessage: 'Please verify you are only using markdown, known variables, and built-in Handlebars expressions' }),
+ title: i18n.translate('tsvb.replaceVars.errors.markdownErrorTitle', { defaultMessage: 'Error processing your markdown' })
}
};
}
diff --git a/src/core_plugins/metrics/public/components/panel_config/gauge.js b/src/core_plugins/metrics/public/components/panel_config/gauge.js
index f275f7d1fc9dc..e1fe00d12345a 100644
--- a/src/core_plugins/metrics/public/components/panel_config/gauge.js
+++ b/src/core_plugins/metrics/public/components/panel_config/gauge.js
@@ -43,8 +43,9 @@ import {
EuiTitle,
EuiHorizontalRule,
} from '@elastic/eui';
+import { injectI18n, FormattedMessage } from '@kbn/i18n/react';
-class GaugePanelConfig extends Component {
+class GaugePanelConfigUi extends Component {
constructor(props) {
super(props);
@@ -70,6 +71,7 @@ class GaugePanelConfig extends Component {
render() {
const { selectedTab } = this.state;
+ const { intl } = this.props;
const defaults = {
gauge_max: '',
filter: '',
@@ -81,8 +83,16 @@ class GaugePanelConfig extends Component {
const handleSelectChange = createSelectHandler(this.props.onChange);
const handleTextChange = createTextHandler(this.props.onChange);
const styleOptions = [
- { label: 'Circle', value: 'circle' },
- { label: 'Half Circle', value: 'half' }
+ {
+ label: intl.formatMessage({
+ id: 'tsvb.gauge.styleOptions.circleLabel', defaultMessage: 'Circle' }),
+ value: 'circle'
+ },
+ {
+ label: intl.formatMessage({
+ id: 'tsvb.gauge.styleOptions.halfCircleLabel', defaultMessage: 'Half Circle' }),
+ value: 'half'
+ }
];
const htmlId = htmlIdGenerator();
const selectedGaugeStyleOption = styleOptions.find(option => {
@@ -104,7 +114,14 @@ class GaugePanelConfig extends Component {
view = (
- Data
+
+
+
+
+
)}
fullWidth
>
- Ignore global filter?
+
+
+
- Style
+
+
+
+
+
)}
>
{/*
EUITODO: The following input couldn't be converted to EUI because of type mis-match.
@@ -169,7 +204,10 @@ class GaugePanelConfig extends Component {
)}
>
)}
>
)}
>
- Background color:
+
+
+
- Inner color:
+
+
+
- Color rules
+
+
+
+
+
this.switchTab('data')}
>
- Data
+
this.switchTab('options')}
>
- Panel options
+
{view}
@@ -269,10 +336,11 @@ class GaugePanelConfig extends Component {
}
-GaugePanelConfig.propTypes = {
+GaugePanelConfigUi.propTypes = {
fields: PropTypes.object,
model: PropTypes.object,
onChange: PropTypes.func,
};
+const GaugePanelConfig = injectI18n(GaugePanelConfigUi);
export default GaugePanelConfig;
diff --git a/src/core_plugins/metrics/public/components/panel_config/markdown.js b/src/core_plugins/metrics/public/components/panel_config/markdown.js
index e48e62fab76ea..1854a23e728db 100644
--- a/src/core_plugins/metrics/public/components/panel_config/markdown.js
+++ b/src/core_plugins/metrics/public/components/panel_config/markdown.js
@@ -45,8 +45,9 @@ import {
EuiHorizontalRule,
} from '@elastic/eui';
const lessC = less(window, { env: 'production' });
+import { injectI18n, FormattedMessage } from '@kbn/i18n/react';
-class MarkdownPanelConfig extends Component {
+class MarkdownPanelConfigUi extends Component {
constructor(props) {
super(props);
@@ -78,13 +79,23 @@ class MarkdownPanelConfig extends Component {
const { selectedTab } = this.state;
const handleSelectChange = createSelectHandler(this.props.onChange);
const handleTextChange = createTextHandler(this.props.onChange);
+ const { intl } = this.props;
const htmlId = htmlIdGenerator();
const alignOptions = [
- { label: 'Top', value: 'top' },
- { label: 'Middle', value: 'middle' },
- { label: 'Bottom', value: 'bottom' }
+ {
+ label: intl.formatMessage({ id: 'tsvb.markdown.alignOptions.topLabel', defaultMessage: 'Top' }),
+ value: 'top'
+ },
+ {
+ label: intl.formatMessage({ id: 'tsvb.markdown.alignOptions.middleLabel', defaultMessage: 'Middle' }),
+ value: 'middle'
+ },
+ {
+ label: intl.formatMessage({ id: 'tsvb.markdown.alignOptions.bottomLabel', defaultMessage: 'Bottom' }),
+ value: 'bottom'
+ }
];
const selectedAlignOption = alignOptions.find(option => {
return model.markdown_vertical_align === option.value;
@@ -106,7 +117,14 @@ class MarkdownPanelConfig extends Component {
view = (
- Data
+
+
+
+
+
)}
fullWidth
>
- Ignore global filter?
+
+
+
- Style
+
+
+
+
+
- Background color:
+
+
+
- Show scrollbars?
+
+
+
- Vertical alignment:
+
+
+
- Custom CSS (supports Less)
+
+
+
+
+
this.switchTab('markdown')}
>
- Markdown
+
this.switchTab('data')}
>
- Data
+
this.switchTab('options')}
>
- Panel options
+
{view}
@@ -231,11 +295,12 @@ class MarkdownPanelConfig extends Component {
}
}
-MarkdownPanelConfig.propTypes = {
+MarkdownPanelConfigUi.propTypes = {
fields: PropTypes.object,
model: PropTypes.object,
onChange: PropTypes.func,
dateFormat: PropTypes.string
};
+const MarkdownPanelConfig = injectI18n(MarkdownPanelConfigUi);
export default MarkdownPanelConfig;
diff --git a/src/core_plugins/metrics/public/components/panel_config/metric.js b/src/core_plugins/metrics/public/components/panel_config/metric.js
index eea7608670bff..06cf98a0ad191 100644
--- a/src/core_plugins/metrics/public/components/panel_config/metric.js
+++ b/src/core_plugins/metrics/public/components/panel_config/metric.js
@@ -39,6 +39,7 @@ import {
EuiTitle,
EuiHorizontalRule,
} from '@elastic/eui';
+import { FormattedMessage } from '@kbn/i18n/react';
class MetricPanelConfig extends Component {
@@ -82,7 +83,14 @@ class MetricPanelConfig extends Component {
view = (
- Data
+
+
+
+
+
)}
fullWidth
>
- Ignore global filter?
+
+
+
- Color rules
+
+
+
+
+
this.switchTab('data')}
>
- Data
+
this.switchTab('options')}
data-test-subj="metricEditorPanelOptionsBtn"
>
- Panel options
+
{view}
diff --git a/src/core_plugins/metrics/public/components/panel_config/table.js b/src/core_plugins/metrics/public/components/panel_config/table.js
index fbed539877417..1c07d8ef65a1b 100644
--- a/src/core_plugins/metrics/public/components/panel_config/table.js
+++ b/src/core_plugins/metrics/public/components/panel_config/table.js
@@ -42,6 +42,7 @@ import {
EuiCode,
EuiText,
} from '@elastic/eui';
+import { FormattedMessage } from '@kbn/i18n/react';
class TablePanelConfig extends Component {
@@ -78,15 +79,23 @@ class TablePanelConfig extends Component {
- For the table visualization you need to define a field to
- group by using a terms aggregation.
+
-
+ )}
+ >
)}
fullWidth
>
)}
>
{/*
EUITODO: The following input couldn't be converted to EUI because of type mis-match.
@@ -143,15 +158,28 @@ class TablePanelConfig extends Component {
view = (
- Data
+
+
+
+
+
)}
helpText={
- This supports mustache templating.
- {'{{key}}'} is set to the term.
+ {'{{key}}'}) }}
+ />
}
>
@@ -175,7 +203,10 @@ class TablePanelConfig extends Component {
)}
fullWidth
>
- Ignore global filter?
+
+
+
this.switchTab('data')}
>
- Columns
+
this.switchTab('options')}
>
- Panel options
+
{view}
diff --git a/src/core_plugins/metrics/public/components/panel_config/timeseries.js b/src/core_plugins/metrics/public/components/panel_config/timeseries.js
index 25281b08ef943..6cc0db1fe761f 100644
--- a/src/core_plugins/metrics/public/components/panel_config/timeseries.js
+++ b/src/core_plugins/metrics/public/components/panel_config/timeseries.js
@@ -41,8 +41,9 @@ import {
EuiTitle,
EuiHorizontalRule,
} from '@elastic/eui';
+import { injectI18n, FormattedMessage } from '@kbn/i18n/react';
-class TimeseriesPanelConfig extends Component {
+class TimeseriesPanelConfigUi extends Component {
constructor(props) {
super(props);
@@ -66,24 +67,46 @@ class TimeseriesPanelConfig extends Component {
const handleSelectChange = createSelectHandler(this.props.onChange);
const handleTextChange = createTextHandler(this.props.onChange);
const htmlId = htmlIdGenerator();
+ const { intl } = this.props;
+
const positionOptions = [
- { label: 'Right', value: 'right' },
- { label: 'Left', value: 'left' }
+ {
+ label: intl.formatMessage({ id: 'tsvb.timeseries.positionOptions.rightLabel', defaultMessage: 'Right' }),
+ value: 'right'
+ },
+ {
+ label: intl.formatMessage({ id: 'tsvb.timeseries.positionOptions.leftLabel', defaultMessage: 'Left' }),
+ value: 'left'
+ }
];
const selectedPositionOption = positionOptions.find(option => {
return model.axis_position === option.value;
});
const scaleOptions = [
- { label: 'Normal', value: 'normal' },
- { label: 'Log', value: 'log' }
+ {
+ label: intl.formatMessage({ id: 'tsvb.timeseries.scaleOptions.normalLabel', defaultMessage: 'Normal' }),
+ value: 'normal'
+ },
+ {
+ label: intl.formatMessage({ id: 'tsvb.timeseries.scaleOptions.logLabel', defaultMessage: 'Log' }),
+ value: 'log' }
];
const selectedAxisScaleOption = scaleOptions.find(option => {
return model.axis_scale === option.value;
});
const legendPositionOptions = [
- { label: 'Right', value: 'right' },
- { label: 'Left', value: 'left' },
- { label: 'Bottom', value: 'bottom' }
+ {
+ label: intl.formatMessage({ id: 'tsvb.timeseries.legendPositionOptions.rightLabel', defaultMessage: 'Right' }),
+ value: 'right'
+ },
+ {
+ label: intl.formatMessage({ id: 'tsvb.timeseries.legendPositionOptions.leftLabel', defaultMessage: 'Left' }),
+ value: 'left'
+ },
+ {
+ label: intl.formatMessage({ id: 'tsvb.timeseries.legendPositionOptions.bottomLabel', defaultMessage: 'Bottom' }),
+ value: 'bottom'
+ }
];
const selectedLegendPosOption = legendPositionOptions.find(option => {
return model.legend_position === option.value;
@@ -112,7 +135,14 @@ class TimeseriesPanelConfig extends Component {
view = (
- Data
+
+
+
+
+
)}
fullWidth
>
- Ignore global filter?
+
+
+
- Style
+
+
+
+
+
-
+ )}
+ >
-
+ )}
+ >
-
+ )}
+ >
-
+ )}
+ >
- Background color:
+
+
+
- Show legend?
+
+
+
- Legend position
+
+
+
- Display grid
+
+
+
this.switchTab('data')}
>
- Data
+
this.switchTab('options')}
>
- Panel options
+
this.switchTab('annotations')}
>
- Annotations
+
{view}
@@ -277,10 +375,11 @@ class TimeseriesPanelConfig extends Component {
}
-TimeseriesPanelConfig.propTypes = {
+TimeseriesPanelConfigUi.propTypes = {
fields: PropTypes.object,
model: PropTypes.object,
onChange: PropTypes.func,
};
+const TimeseriesPanelConfig = injectI18n(TimeseriesPanelConfigUi);
export default TimeseriesPanelConfig;
diff --git a/src/core_plugins/metrics/public/components/panel_config/top_n.js b/src/core_plugins/metrics/public/components/panel_config/top_n.js
index 4721f4f42d251..2f7bbb0070538 100644
--- a/src/core_plugins/metrics/public/components/panel_config/top_n.js
+++ b/src/core_plugins/metrics/public/components/panel_config/top_n.js
@@ -41,6 +41,7 @@ import {
EuiHorizontalRule,
EuiCode,
} from '@elastic/eui';
+import { FormattedMessage } from '@kbn/i18n/react';
class TopNPanelConfig extends Component {
@@ -83,15 +84,28 @@ class TopNPanelConfig extends Component {
view = (
- Data
+
+
+
+
+
)}
helpText={
- This supports mustache templating.
- {'{{key}}'} is set to the term.
+ {'{{key}}'}) }}
+ />
}
>
@@ -115,7 +129,10 @@ class TopNPanelConfig extends Component {
)}
fullWidth
>
- Ignore global filter?
+
+
+
- Style
+
+
+
+
+
- Background color:
+
+
+
- Color rules
+
+
+
+
+
this.switchTab('data')}
>
- Data
+
this.switchTab('options')}
>
- Panel options
+
{view}
diff --git a/src/core_plugins/metrics/public/components/splits/everything.js b/src/core_plugins/metrics/public/components/splits/everything.js
index 4eb7c5e031323..e6aead092faac 100644
--- a/src/core_plugins/metrics/public/components/splits/everything.js
+++ b/src/core_plugins/metrics/public/components/splits/everything.js
@@ -22,6 +22,7 @@ import GroupBySelect from './group_by_select';
import PropTypes from 'prop-types';
import React from 'react';
import { htmlIdGenerator, EuiFlexGroup, EuiFlexItem, EuiFormRow } from '@elastic/eui';
+import { FormattedMessage } from '@kbn/i18n/react';
function SplitByEverything(props) {
const { onChange, model } = props;
@@ -30,7 +31,13 @@ function SplitByEverything(props) {
return (
-
+ )}
+ >
{
const { onChange } = props;
@@ -34,7 +35,13 @@ export const SplitByFilter = props => {
return (
-
+ )}
+ >
{
-
+ )}
+ >
@@ -65,8 +68,8 @@ class FilterItems extends Component {
-
+ )}
+ >
{
@@ -46,9 +61,10 @@ function GroupBySelect(props) {
}
-GroupBySelect.propTypes = {
+GroupBySelectUi.propTypes = {
onChange: PropTypes.func,
value: PropTypes.string
};
+const GroupBySelect = injectI18n(GroupBySelectUi);
export default GroupBySelect;
diff --git a/src/core_plugins/metrics/public/components/splits/terms.js b/src/core_plugins/metrics/public/components/splits/terms.js
index db5d08246a8f3..5376f48e8b76a 100644
--- a/src/core_plugins/metrics/public/components/splits/terms.js
+++ b/src/core_plugins/metrics/public/components/splits/terms.js
@@ -25,21 +25,34 @@ import createSelectHandler from '../lib/create_select_handler';
import FieldSelect from '../aggs/field_select';
import MetricSelect from '../aggs/metric_select';
import { htmlIdGenerator, EuiFlexGroup, EuiFlexItem, EuiFormRow, EuiFieldNumber, EuiComboBox, EuiSpacer } from '@elastic/eui';
+import { injectI18n, FormattedMessage } from '@kbn/i18n/react';
-export const SplitByTerms = props => {
+const SplitByTermsUi = props => {
const htmlId = htmlIdGenerator();
const handleTextChange = createTextHandler(props.onChange);
const handleSelectChange = createSelectHandler(props.onChange);
- const { indexPattern } = props;
+ const { indexPattern, intl } = props;
const defaults = { terms_direction: 'desc', terms_size: 10, terms_order_by: '_count' };
const model = { ...defaults, ...props.model };
const { metrics } = model;
- const defaultCount = { value: '_count', label: 'Doc Count (default)' };
- const terms = { value: '_term', label: 'Terms' };
+ const defaultCount = {
+ value: '_count',
+ label: intl.formatMessage({ id: 'tsvb.splits.terms.defaultCountLabel', defaultMessage: 'Doc Count (default)' })
+ };
+ const terms = {
+ value: '_term',
+ label: intl.formatMessage({ id: 'tsvb.splits.terms.termsLabel', defaultMessage: 'Terms' })
+ };
const dirOptions = [
- { value: 'desc', label: 'Descending' },
- { value: 'asc', label: 'Ascending' },
+ {
+ value: 'desc',
+ label: intl.formatMessage({ id: 'tsvb.splits.terms.dirOptions.descendingLabel', defaultMessage: 'Descending' })
+ },
+ {
+ value: 'asc',
+ label: intl.formatMessage({ id: 'tsvb.splits.terms.dirOptions.ascendingLabel', defaultMessage: 'Ascending' })
+ },
];
const selectedDirectionOption = dirOptions.find(option => {
return model.terms_direction === option.value;
@@ -49,7 +62,13 @@ export const SplitByTerms = props => {
-
+ )}
+ >
{
-
+ )}
+ >
{
-
+ )}
+ >
-
+ )}
+ >
{
-
+ )}
+ >
{
);
};
-SplitByTerms.propTypes = {
+SplitByTermsUi.propTypes = {
model: PropTypes.object,
onChange: PropTypes.func,
indexPattern: PropTypes.string,
fields: PropTypes.object
};
+
+export const SplitByTerms = injectI18n(SplitByTermsUi);
\ No newline at end of file
diff --git a/src/core_plugins/metrics/public/components/vis_types/gauge/series.js b/src/core_plugins/metrics/public/components/vis_types/gauge/series.js
index 6c95520995fd3..0d336010fe49a 100644
--- a/src/core_plugins/metrics/public/components/vis_types/gauge/series.js
+++ b/src/core_plugins/metrics/public/components/vis_types/gauge/series.js
@@ -28,8 +28,9 @@ import { EuiToolTip, EuiTabs, EuiTab, EuiFlexGroup, EuiFlexItem, EuiFieldText, E
import createAggRowRender from '../../lib/create_agg_row_render';
import createTextHandler from '../../lib/create_text_handler';
import { createUpDownHandler } from '../../lib/sort_keyhandler';
+import { injectI18n, FormattedMessage } from '@kbn/i18n/react';
-function GaugeSeries(props) {
+function GaugeSeriesUi(props) {
const {
panel,
fields,
@@ -39,7 +40,8 @@ function GaugeSeries(props) {
disableDelete,
disableAdd,
selectedTab,
- visible
+ visible,
+ intl
} = props;
const defaults = { label: '' };
@@ -96,14 +98,20 @@ function GaugeSeries(props) {
isSelected={selectedTab === 'metrics'}
onClick={() => props.switchTab('metrics')}
>
- Metrics
+
props.switchTab('options')}
>
- Options
+
{seriesBody}
@@ -124,11 +132,16 @@ function GaugeSeries(props) {
if (!props.disableDelete) {
dragHandle = (
-
+ )}
+ >
@@ -150,7 +163,7 @@ function GaugeSeries(props) {
iconType={caretIcon}
color="text"
onClick={props.toggleVisible}
- aria-label="Toggle series editor"
+ aria-label={intl.formatMessage({ id: 'tsvb.gauge.editor.toggleEditorAriaLabel', defaultMessage: 'Toggle series editor' })}
aria-expanded={props.visible}
/>
@@ -163,7 +176,7 @@ function GaugeSeries(props) {
@@ -172,9 +185,9 @@ function GaugeSeries(props) {
props.switchTab('metrics')}
>
- Metrics
+
props.switchTab('options')}
>
- Options
+
{seriesBody}
@@ -122,7 +130,7 @@ function MarkdownSeries(props) {
iconType={caretIcon}
color="text"
onClick={props.toggleVisible}
- aria-label="Toggle series editor"
+ aria-label={intl.formatMessage({ id: 'tsvb.markdown.editor.toggleEditorAriaLabel', defaultMessage: 'Toggle series editor' })}
aria-expanded={props.visible}
/>
@@ -131,7 +139,7 @@ function MarkdownSeries(props) {
@@ -140,16 +148,16 @@ function MarkdownSeries(props) {
props.switchTab('metrics')}
>
- Metrics
+
props.switchTab('options')}
>
- Options
+
{seriesBody}
@@ -129,11 +137,16 @@ function MetricSeries(props) {
if (!props.disableDelete) {
dragHandle = (
-
+ )}
+ >
@@ -154,7 +167,7 @@ function MetricSeries(props) {
iconType={caretIcon}
color="text"
onClick={props.toggleVisible}
- aria-label="Toggle series editor"
+ aria-label={intl.formatMessage({ id: 'tsvb.metric.editor.toggleEditorAriaLabel', defaultMessage: 'Toggle series editor' })}
aria-expanded={props.visible}
/>
@@ -165,7 +178,7 @@ function MetricSeries(props) {
@@ -174,9 +187,9 @@ function MetricSeries(props) {
{}}
- isEditorMode={true}
- appState={params.appState}
- />, this.el);
+ render(
+
+ {}}
+ isEditorMode={true}
+ appState={params.appState}
+ />
+ ,
+ this.el);
}
resize() {
diff --git a/src/core_plugins/metrics/public/kbn_vis_types/request_handler.js b/src/core_plugins/metrics/public/kbn_vis_types/request_handler.js
index 67a0f34ee72d7..05f800d17e65a 100644
--- a/src/core_plugins/metrics/public/kbn_vis_types/request_handler.js
+++ b/src/core_plugins/metrics/public/kbn_vis_types/request_handler.js
@@ -22,8 +22,8 @@ import { timezoneProvider } from 'ui/vis/lib/timezone';
import { timefilter } from 'ui/timefilter';
import { BuildESQueryProvider } from 'ui/courier';
-const MetricsRequestHandlerProvider = function (Private, Notifier, config, $http) {
- const notify = new Notifier({ location: 'Metrics' });
+const MetricsRequestHandlerProvider = function (Private, Notifier, config, $http, i18n) {
+ const notify = new Notifier({ location: i18n('tsvb.requestHandler.notifier.locationNameTitle', { defaultMessage: 'Metrics' }) });
const buildEsQuery = Private(BuildESQueryProvider);
return {
diff --git a/src/core_plugins/metrics/public/lib/fetch_fields.js b/src/core_plugins/metrics/public/lib/fetch_fields.js
index 9a2c2d1c78e12..0d066eb60b41b 100644
--- a/src/core_plugins/metrics/public/lib/fetch_fields.js
+++ b/src/core_plugins/metrics/public/lib/fetch_fields.js
@@ -18,6 +18,7 @@
*/
import { kfetch } from 'ui/kfetch';
import { toastNotifications } from 'ui/notify';
+import { i18n } from '@kbn/i18n';
async function fetchFields(indexPatterns = ['*']) {
const patterns = Array.isArray(indexPatterns) ? indexPatterns : [indexPatterns];
@@ -40,7 +41,9 @@ async function fetchFields(indexPatterns = ['*']) {
return fields;
} catch(error) {
toastNotifications.addDanger({
- title: 'Unable to load index_pattern fields',
+ title: i18n.translate('tsvb.fetchFields.loadIndexPatternFieldsErrorMessage', {
+ defaultMessage: 'Unable to load index_pattern fields'
+ }),
text: error.message,
});
}
diff --git a/src/core_plugins/metrics/public/lib/validate_interval.js b/src/core_plugins/metrics/public/lib/validate_interval.js
index 00a8c0bef2aba..8959e63fec835 100644
--- a/src/core_plugins/metrics/public/lib/validate_interval.js
+++ b/src/core_plugins/metrics/public/lib/validate_interval.js
@@ -19,6 +19,8 @@
import { parseInterval } from 'ui/utils/parse_interval';
import { GTE_INTERVAL_RE } from '../../common/interval_regexp';
+import { i18n } from '@kbn/i18n';
+
export function validateInterval(bounds, panel, maxBuckets) {
const { interval } = panel;
const { min, max } = bounds;
@@ -32,7 +34,10 @@ export function validateInterval(bounds, panel, maxBuckets) {
const span = max.valueOf() - min.valueOf();
const buckets = Math.floor(span / duration.asMilliseconds());
if (buckets > maxBuckets) {
- throw new Error(`Max buckets exceeded: ${buckets} is greater than ${maxBuckets}, try a larger time interval in the panel options.`);
+ throw new Error(i18n.translate('tsvb.validateInterval.notifier.maxBucketsExceededErrorMessage', {
+ defaultMessage: 'Max buckets exceeded: {buckets} is greater than {maxBuckets}, try a larger time interval in the panel options.',
+ values: { buckets, maxBuckets }
+ }));
}
}
}