Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
c7ec189
Merge pull request #1 from elastic/master
Nox911 Sep 24, 2018
fa01b88
Merge pull request #2 from elastic/master
Nox911 Sep 27, 2018
70f6c7e
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Sep 27, 2018
68587a0
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Sep 28, 2018
42aa7d3
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Oct 2, 2018
efeaefe
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Oct 2, 2018
8a054ed
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Oct 8, 2018
9344b53
Translations for Aggregations in Visual Builder
maryia-lapata Oct 12, 2018
b0d1660
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Oct 16, 2018
62b6ad1
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Oct 17, 2018
acbad4b
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Oct 18, 2018
6d54fa4
Merge branch 'master' into feature/translations/visual-builder
maryia-lapata Oct 19, 2018
4f7167a
Refactoring
maryia-lapata Oct 19, 2018
0c07f3d
Translate agg_lookup
maryia-lapata Oct 19, 2018
d20c082
Update ids
maryia-lapata Oct 19, 2018
60fabf4
Merge branch 'master' into feature/translations/visual-builder
maryia-lapata Oct 21, 2018
a850650
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Oct 22, 2018
351af7b
Merge branch 'master' into feature/translations/visual-builder
maryia-lapata Oct 23, 2018
da82652
Merge branch 'feature/translations/visual-builder' of https://github.…
maryia-lapata Oct 23, 2018
0a200ce
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Oct 25, 2018
b2a8244
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Oct 29, 2018
b4b979e
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Oct 30, 2018
d349a4f
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Oct 31, 2018
ae285b9
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Nov 2, 2018
3051641
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Nov 5, 2018
6a7ae24
Merge branch 'master' into feature/translations/visual-builder
pavel06081991 Nov 6, 2018
0fe3d6a
Merge branch 'master' into feature/translations/visual-builder
pavel06081991 Nov 6, 2018
6231971
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Nov 8, 2018
f86a3d4
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Nov 9, 2018
cf813c7
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Nov 13, 2018
1aba03f
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Nov 14, 2018
33f0b9c
Merge branch 'master' into feature/translations/visual-builder
Nox911 Nov 15, 2018
491009b
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Nov 15, 2018
cf76734
Merge branch 'master' into feature/translations/visual-builder
Nox911 Nov 15, 2018
8a0081c
Add translation
Nox911 Nov 15, 2018
d10e9c0
Replace namespace metrics to tsvb
Nox911 Nov 16, 2018
079ce89
Change order in i18nrc file
Nox911 Nov 16, 2018
34e1e46
Fix issues
Nox911 Nov 20, 2018
4077953
Fix issues
Nox911 Nov 21, 2018
e249ecb
Fix label calculating
Nox911 Nov 21, 2018
5e0ac27
Fix minor issue
Nox911 Nov 22, 2018
e243126
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Nov 22, 2018
9bee1da
Merge branch 'master' into feature/translations/visual-builder
Nox911 Nov 22, 2018
e74bd61
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Nov 22, 2018
767ddbf
Merge branch 'master' into feature/translations/visual-builder
Nox911 Nov 22, 2018
8bc5ffa
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Nov 23, 2018
5787937
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Nov 23, 2018
f17fa1e
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Nov 24, 2018
c63b0a6
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Nov 26, 2018
4f59486
Merge branch 'master' into feature/translations/visual-builder
Nox911 Nov 26, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
"tableVis": "src/core_plugins/table_vis",
"regionMap": "src/core_plugins/region_map",
"statusPage": "src/core_plugins/status_page",
"tagCloud": "src/core_plugins/tagcloud",
"tagCloud": "src/core_plugins/tagcloud",
"tileMap": "src/core_plugins/tile_map",
"timelion": "src/core_plugins/timelion",
"tsvb": "src/core_plugins/metrics",
Expand Down
67 changes: 36 additions & 31 deletions src/core_plugins/metrics/common/agg_lookup.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,37 +18,39 @@
*/

import _ from 'lodash';
import { i18n } from '@kbn/i18n';

const lookup = {
count: 'Count',
calculation: 'Calculation',
std_deviation: 'Std. Deviation',
variance: 'Variance',
sum_of_squares: 'Sum of Sq.',
avg: 'Average',
max: 'Max',
min: 'Min',
sum: 'Sum',
percentile: 'Percentile',
percentile_rank: 'Percentile Rank',
cardinality: 'Cardinality',
value_count: 'Value Count',
derivative: 'Derivative',
cumulative_sum: 'Cumulative Sum',
moving_average: 'Moving Average',
avg_bucket: 'Overall Average',
min_bucket: 'Overall Min',
max_bucket: 'Overall Max',
sum_bucket: 'Overall Sum',
variance_bucket: 'Overall Variance',
sum_of_squares_bucket: 'Overall Sum of Sq.',
std_deviation_bucket: 'Overall Std. Deviation',
series_agg: 'Series Agg',
math: 'Math',
serial_diff: 'Serial Difference',
filter_ratio: 'Filter Ratio',
positive_only: 'Positive Only',
static: 'Static Value',
top_hit: 'Top Hit',
count: i18n.translate('tsvb.aggLookup.countLabel', { defaultMessage: 'Count' }),
calculation: i18n.translate('tsvb.aggLookup.calculationLabel', { defaultMessage: 'Calculation' }),
std_deviation: i18n.translate('tsvb.aggLookup.deviationLabel', { defaultMessage: 'Std. Deviation' }),
variance: i18n.translate('tsvb.aggLookup.varianceLabel', { defaultMessage: 'Variance' }),
sum_of_squares: i18n.translate('tsvb.aggLookup.sumOfSqLabel', { defaultMessage: 'Sum of Sq.' }),
avg: i18n.translate('tsvb.aggLookup.averageLabel', { defaultMessage: 'Average' }),
max: i18n.translate('tsvb.aggLookup.maxLabel', { defaultMessage: 'Max' }),
min: i18n.translate('tsvb.aggLookup.minLabel', { defaultMessage: 'Min' }),
sum: i18n.translate('tsvb.aggLookup.sumLabel', { defaultMessage: 'Sum' }),
percentile: i18n.translate('tsvb.aggLookup.percentileLabel', { defaultMessage: 'Percentile' }),
percentile_rank: i18n.translate('tsvb.aggLookup.percentileRankLabel', { defaultMessage: 'Percentile Rank' }),
cardinality: i18n.translate('tsvb.aggLookup.cardinalityLabel', { defaultMessage: 'Cardinality' }),
value_count: i18n.translate('tsvb.aggLookup.valueCountLabel', { defaultMessage: 'Value Count' }),
derivative: i18n.translate('tsvb.aggLookup.derivativeLabel', { defaultMessage: 'Derivative' }),
cumulative_sum: i18n.translate('tsvb.aggLookup.cumulativeSumLabel', { defaultMessage: 'Cumulative Sum' }),
moving_average: i18n.translate('tsvb.aggLookup.movingAverageLabel', { defaultMessage: 'Moving Average' }),
avg_bucket: i18n.translate('tsvb.aggLookup.overallAverageLabel', { defaultMessage: 'Overall Average' }),
min_bucket: i18n.translate('tsvb.aggLookup.overallMinLabel', { defaultMessage: 'Overall Min' }),
max_bucket: i18n.translate('tsvb.aggLookup.overallMaxLabel', { defaultMessage: 'Overall Max' }),
sum_bucket: i18n.translate('tsvb.aggLookup.overallSumLabel', { defaultMessage: 'Overall Sum' }),
variance_bucket: i18n.translate('tsvb.aggLookup.overallVarianceLabel', { defaultMessage: 'Overall Variance' }),
sum_of_squares_bucket: i18n.translate('tsvb.aggLookup.overallSumOfSqLabel', { defaultMessage: 'Overall Sum of Sq.' }),
std_deviation_bucket: i18n.translate('tsvb.aggLookup.overallStdDeviationLabel', { defaultMessage: 'Overall Std. Deviation' }),
series_agg: i18n.translate('tsvb.aggLookup.seriesAggLabel', { defaultMessage: 'Series Agg' }),
math: i18n.translate('tsvb.aggLookup.mathLabel', { defaultMessage: 'Math' }),
serial_diff: i18n.translate('tsvb.aggLookup.serialDifferenceLabel', { defaultMessage: 'Serial Difference' }),
filter_ratio: i18n.translate('tsvb.aggLookup.filterRatioLabel', { defaultMessage: 'Filter Ratio' }),
positive_only: i18n.translate('tsvb.aggLookup.positiveOnlyLabel', { defaultMessage: 'Positive Only' }),
static: i18n.translate('tsvb.aggLookup.staticValueLabel', { defaultMessage: 'Static Value' }),
top_hit: i18n.translate('tsvb.aggLookup.topHitLabel', { defaultMessage: 'Top Hit' }),
};

const pipeline = [
Expand Down Expand Up @@ -98,7 +100,10 @@ export function createOptions(type = '_all', siblings = []) {
const disabled = _.includes(pipeline, value) ? !enablePipelines : false;
return {
label: disabled
? `${label} (use the "+" button to add this pipeline agg)`
? i18n.translate('tsvb.aggLookup.addPipelineAggDescription', {
defaultMessage: '{label} (use the "+" button to add this pipeline agg)',
values: { label }
})
: label,
value,
disabled,
Expand Down
47 changes: 35 additions & 12 deletions src/core_plugins/metrics/common/calculate_label.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

import { includes, startsWith } from 'lodash';
import lookup from './agg_lookup';
import { i18n } from '@kbn/i18n';

const paths = [
'cumulative_sum',
'derivative',
Expand All @@ -34,22 +36,34 @@ const paths = [
'positive_only',
];
export default function calculateLabel(metric, metrics) {
if (!metric) return 'Unknown';
if (!metric) return i18n.translate('tsvb.calculateLabel.unknownLabel', { defaultMessage: 'Unknown' });
if (metric.alias) return metric.alias;

if (metric.type === 'count') return 'Count';
if (metric.type === 'calculation') return 'Bucket Script';
if (metric.type === 'math') return 'Math';
if (metric.type === 'series_agg') return `Series Agg (${metric.function})`;
if (metric.type === 'filter_ratio') return 'Filter Ratio';
if (metric.type === 'static') return `Static Value of ${metric.value}`;
if (metric.type === 'count') return i18n.translate('tsvb.calculateLabel.countLabel', { defaultMessage: 'Count' });
if (metric.type === 'calculation') {
return i18n.translate('tsvb.calculateLabel.bucketScriptsLabel', { defaultMessage: 'Bucket Script' });
}
if (metric.type === 'math') return i18n.translate('tsvb.calculateLabel.mathLabel', { defaultMessage: 'Math' });
if (metric.type === 'series_agg') {
return i18n.translate('tsvb.calculateLabel.seriesAggLabel',
{ defaultMessage: 'Series Agg ({metricFunction})', values: { metricFunction: metric.function } }
);
}
if (metric.type === 'filter_ratio') return i18n.translate('tsvb.calculateLabel.filterRatioLabel', { defaultMessage: 'Filter Ratio' });
if (metric.type === 'static') {
return i18n.translate('tsvb.calculateLabel.staticValueLabel',
{ defaultMessage: 'Static Value of {metricValue}', values: { metricValue: metric.value } }
);
}

if (metric.type === 'percentile_rank') {
return `${lookup[metric.type]} (${metric.value}) of ${metric.field}`;
return i18n.translate('tsvb.calculateLabel.percentileRankLabel', {
defaultMessage: '{lookupMetricType} ({metricValue}) of {metricField}',
values: { lookupMetricType: lookup[metric.type], metricValue: metric.value, metricField: metric.field }
});
}

if (includes(paths, metric.type)) {
let additionalLabel = '';
const targetMetric = metrics.find(m => startsWith(metric.field, m.id));
const targetLabel = calculateLabel(targetMetric, metrics);
// For percentiles we need to parse the field id to extract the percentile
Expand All @@ -59,11 +73,20 @@ export default function calculateLabel(metric, metrics) {
const percentileValueMatch = /\[([0-9\.]+)\]$/;
const matches = metric.field.match(percentileValueMatch);
if (matches) {
additionalLabel += ` (${matches[1]})`;
return i18n.translate('tsvb.calculateLabel.lookupMetricTypeOfTargetWithAdditionalLabel', {
defaultMessage: '{lookupMetricType} of {targetLabel} ({additionalLabel})',
values: { lookupMetricType: lookup[metric.type], targetLabel, additionalLabel: matches[1] }
});
}
}
return `${lookup[metric.type]} of ${targetLabel}${additionalLabel}`;
return i18n.translate('tsvb.calculateLabel.lookupMetricTypeOfTargetLabel', {
defaultMessage: '{lookupMetricType} of {targetLabel}',
values: { lookupMetricType: lookup[metric.type], targetLabel }
});
}

return `${lookup[metric.type]} of ${metric.field}`;
return i18n.translate('tsvb.calculateLabel.lookupMetricTypeOfMetricFieldRankLabel', {
defaultMessage: '{lookupMetricType} of {metricField}',
values: { lookupMetricType: lookup[metric.type], metricField: metric.field }
});
}
25 changes: 19 additions & 6 deletions src/core_plugins/metrics/public/components/aggs/agg_row.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,14 @@ import React from 'react';
import _ from 'lodash';
import AddDeleteButtons from '../add_delete_buttons';
import { EuiToolTip, EuiButtonIcon, EuiIcon, EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
import { injectI18n, FormattedMessage } from '@kbn/i18n/react';

function AggRow(props) {
function AggRowUi(props) {
let iconType = 'eyeClosed';
let iconColor = 'subdued';
const last = _.last(props.siblings);
const { intl } = props;

if (last.id === props.model.id) {
iconType = 'eye';
iconColor = 'text';
Expand All @@ -36,8 +39,17 @@ function AggRow(props) {
if (!props.disableDelete) {
dragHandle = (
<EuiFlexItem grow={false}>
<EuiToolTip content="Drag to sort">
<EuiButtonIcon className="tvbAggRow__sortHandle" aria-label="Drag to sort" iconType="grab" />
<EuiToolTip
content={(<FormattedMessage
id="tsvb.aggRow.dragToSortTooltip"
defaultMessage="Drag to sort"
/>)}
>
<EuiButtonIcon
className="tvbAggRow__sortHandle"
aria-label={intl.formatMessage({ id: 'tsvb.aggRow.dragToSortAriaLabel', defaultMessage: 'Drag to sort' })}
iconType="grab"
/>
</EuiToolTip>
</EuiFlexItem>
);
Expand All @@ -56,8 +68,8 @@ function AggRow(props) {
<EuiFlexItem grow={false}>
<AddDeleteButtons
testSubj="addMetric"
addTooltip="Add metric"
deleteTooltip="Delete metric"
addTooltip={intl.formatMessage({ id: 'tsvb.aggRow.addMetricButtonTooltip', defaultMessage: 'Add Metric' })}
deleteTooltip={intl.formatMessage({ id: 'tsvb.aggRow.deleteMetricButtonTooltip', defaultMessage: 'Delete Metric' })}
onAdd={props.onAdd}
onDelete={props.onDelete}
disableDelete={props.disableDelete}
Expand All @@ -68,12 +80,13 @@ function AggRow(props) {
);
}

AggRow.propTypes = {
AggRowUi.propTypes = {
disableDelete: PropTypes.bool,
model: PropTypes.object,
onAdd: PropTypes.func,
onDelete: PropTypes.func,
siblings: PropTypes.array,
};

const AggRow = injectI18n(AggRowUi);
export default AggRow;
Loading