[i18n] Translate Agg_types(part_3) (#26118)
* Translate agg_types - metrics * Fix issues
This commit is contained in:
parent
624f060316
commit
51a418ea43
|
@ -18,12 +18,18 @@
|
|||
*/
|
||||
|
||||
import { MetricAggType } from './metric_agg_type';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
export const avgMetricAgg = new MetricAggType({
|
||||
name: 'avg',
|
||||
title: 'Average',
|
||||
title: i18n.translate('common.ui.aggTypes.metrics.averageTitle', {
|
||||
defaultMessage: 'Average'
|
||||
}),
|
||||
makeLabel: function (aggConfig) {
|
||||
return 'Average ' + aggConfig.getFieldDisplayName();
|
||||
return i18n.translate('common.ui.aggTypes.metrics.averageLabel', {
|
||||
defaultMessage: 'Average {field}',
|
||||
values: { field: aggConfig.getFieldDisplayName() }
|
||||
});
|
||||
},
|
||||
params: [
|
||||
{
|
||||
|
|
|
@ -21,11 +21,18 @@ import { get } from 'lodash';
|
|||
import { MetricAggType } from './metric_agg_type';
|
||||
import { makeNestedLabel } from './lib/make_nested_label';
|
||||
import { siblingPipelineAggHelper } from './lib/sibling_pipeline_agg_helper';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
const overallAverageLabel = i18n.translate('common.ui.aggTypes.metrics.overallAverageLabel', {
|
||||
defaultMessage: 'overall average'
|
||||
});
|
||||
|
||||
export const bucketAvgMetricAgg = new MetricAggType({
|
||||
name: 'avg_bucket',
|
||||
title: 'Average Bucket',
|
||||
makeLabel: agg => makeNestedLabel(agg, 'overall average'),
|
||||
title: i18n.translate('common.ui.aggTypes.metrics.averageBucketTitle', {
|
||||
defaultMessage: 'Average Bucket'
|
||||
}),
|
||||
makeLabel: agg => makeNestedLabel(agg, overallAverageLabel),
|
||||
subtype: siblingPipelineAggHelper.subtype,
|
||||
params: [
|
||||
...siblingPipelineAggHelper.params()
|
||||
|
|
|
@ -20,11 +20,18 @@
|
|||
import { MetricAggType } from './metric_agg_type';
|
||||
import { makeNestedLabel } from './lib/make_nested_label';
|
||||
import { siblingPipelineAggHelper } from './lib/sibling_pipeline_agg_helper';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
const overallMaxLabel = i18n.translate('common.ui.aggTypes.metrics.overallMaxLabel', {
|
||||
defaultMessage: 'overall max'
|
||||
});
|
||||
|
||||
export const bucketMaxMetricAgg = new MetricAggType({
|
||||
name: 'max_bucket',
|
||||
title: 'Max Bucket',
|
||||
makeLabel: agg => makeNestedLabel(agg, 'overall max'),
|
||||
title: i18n.translate('common.ui.aggTypes.metrics.maxBucketTitle', {
|
||||
defaultMessage: 'Max Bucket'
|
||||
}),
|
||||
makeLabel: agg => makeNestedLabel(agg, overallMaxLabel),
|
||||
subtype: siblingPipelineAggHelper.subtype,
|
||||
params: [
|
||||
...siblingPipelineAggHelper.params()
|
||||
|
|
|
@ -20,11 +20,18 @@
|
|||
import { MetricAggType } from './metric_agg_type';
|
||||
import { makeNestedLabel } from './lib/make_nested_label';
|
||||
import { siblingPipelineAggHelper } from './lib/sibling_pipeline_agg_helper';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
const overallMinLabel = i18n.translate('common.ui.aggTypes.metrics.overallMinLabel', {
|
||||
defaultMessage: 'overall min'
|
||||
});
|
||||
|
||||
export const bucketMinMetricAgg = new MetricAggType({
|
||||
name: 'min_bucket',
|
||||
title: 'Min Bucket',
|
||||
makeLabel: agg => makeNestedLabel(agg, 'overall min'),
|
||||
title: i18n.translate('common.ui.aggTypes.metrics.minBucketTitle', {
|
||||
defaultMessage: 'Min Bucket'
|
||||
}),
|
||||
makeLabel: agg => makeNestedLabel(agg, overallMinLabel),
|
||||
subtype: siblingPipelineAggHelper.subtype,
|
||||
params: [
|
||||
...siblingPipelineAggHelper.params()
|
||||
|
|
|
@ -20,11 +20,18 @@
|
|||
import { MetricAggType } from './metric_agg_type';
|
||||
import { makeNestedLabel } from './lib/make_nested_label';
|
||||
import { siblingPipelineAggHelper } from './lib/sibling_pipeline_agg_helper';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
const overallSumLabel = i18n.translate('common.ui.aggTypes.metrics.overallSumLabel', {
|
||||
defaultMessage: 'overall sum'
|
||||
});
|
||||
|
||||
export const bucketSumMetricAgg = new MetricAggType({
|
||||
name: 'sum_bucket',
|
||||
title: 'Sum Bucket',
|
||||
makeLabel: agg => makeNestedLabel(agg, 'overall sum'),
|
||||
title: i18n.translate('common.ui.aggTypes.metrics.sumBucketTitle', {
|
||||
defaultMessage: 'Sum Bucket'
|
||||
}),
|
||||
makeLabel: agg => makeNestedLabel(agg, overallSumLabel),
|
||||
subtype: siblingPipelineAggHelper.subtype,
|
||||
params: [
|
||||
...siblingPipelineAggHelper.params()
|
||||
|
|
|
@ -19,12 +19,18 @@
|
|||
|
||||
import { MetricAggType } from './metric_agg_type';
|
||||
import { fieldFormats } from '../../registry/field_formats';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
export const cardinalityMetricAgg = new MetricAggType({
|
||||
name: 'cardinality',
|
||||
title: 'Unique Count',
|
||||
title: i18n.translate('common.ui.aggTypes.metrics.uniqueCountTitle', {
|
||||
defaultMessage: 'Unique Count'
|
||||
}),
|
||||
makeLabel: function (aggConfig) {
|
||||
return 'Unique count of ' + aggConfig.getFieldDisplayName();
|
||||
return i18n.translate('common.ui.aggTypes.metrics.uniqueCountLabel', {
|
||||
defaultMessage: 'Unique count of {field}',
|
||||
values: { field: aggConfig.getFieldDisplayName() }
|
||||
});
|
||||
},
|
||||
getFormat: function () {
|
||||
return fieldFormats.getDefaultInstance('number');
|
||||
|
|
|
@ -19,13 +19,18 @@
|
|||
|
||||
import { MetricAggType } from './metric_agg_type';
|
||||
import { fieldFormats } from '../../registry/field_formats';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
export const countMetricAgg = new MetricAggType({
|
||||
name: 'count',
|
||||
title: 'Count',
|
||||
title: i18n.translate('common.ui.aggTypes.metrics.countTitle', {
|
||||
defaultMessage: 'Count'
|
||||
}),
|
||||
hasNoDsl: true,
|
||||
makeLabel: function () {
|
||||
return 'Count';
|
||||
return i18n.translate('common.ui.aggTypes.metrics.countLabel', {
|
||||
defaultMessage: 'Count'
|
||||
});
|
||||
},
|
||||
getFormat: function () {
|
||||
return fieldFormats.getDefaultInstance('number');
|
||||
|
|
|
@ -20,12 +20,19 @@
|
|||
import { MetricAggType } from './metric_agg_type';
|
||||
import { parentPipelineAggHelper } from './lib/parent_pipeline_agg_helper';
|
||||
import { makeNestedLabel } from './lib/make_nested_label';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
const cumulativeSumLabel = i18n.translate('common.ui.aggTypes.metrics.cumulativeSumLabel', {
|
||||
defaultMessage: 'cumulative sum'
|
||||
});
|
||||
|
||||
export const cumulativeSumMetricAgg = new MetricAggType({
|
||||
name: 'cumulative_sum',
|
||||
title: 'Cumulative Sum',
|
||||
title: i18n.translate('common.ui.aggTypes.metrics.cumulativeSumTitle', {
|
||||
defaultMessage: 'Cumulative Sum'
|
||||
}),
|
||||
subtype: parentPipelineAggHelper.subtype,
|
||||
makeLabel: agg => makeNestedLabel(agg, 'cumulative sum'),
|
||||
makeLabel: agg => makeNestedLabel(agg, cumulativeSumLabel),
|
||||
params: [
|
||||
...parentPipelineAggHelper.params()
|
||||
],
|
||||
|
|
|
@ -20,12 +20,19 @@
|
|||
import { MetricAggType } from './metric_agg_type';
|
||||
import { parentPipelineAggHelper } from './lib/parent_pipeline_agg_helper';
|
||||
import { makeNestedLabel } from './lib/make_nested_label';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
const derivativeLabel = i18n.translate('common.ui.aggTypes.metrics.derivativeLabel', {
|
||||
defaultMessage: 'derivative'
|
||||
});
|
||||
|
||||
export const derivativeMetricAgg = new MetricAggType({
|
||||
name: 'derivative',
|
||||
title: 'Derivative',
|
||||
title: i18n.translate('common.ui.aggTypes.metrics.derivativeTitle', {
|
||||
defaultMessage: 'Derivative'
|
||||
}),
|
||||
subtype: parentPipelineAggHelper.subtype,
|
||||
makeLabel: agg => makeNestedLabel(agg, 'derivative'),
|
||||
makeLabel: agg => makeNestedLabel(agg, derivativeLabel),
|
||||
params: [
|
||||
...parentPipelineAggHelper.params()
|
||||
],
|
||||
|
|
|
@ -18,12 +18,17 @@
|
|||
*/
|
||||
|
||||
import { MetricAggType } from './metric_agg_type';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
export const geoBoundsMetricAgg = new MetricAggType({
|
||||
name: 'geo_bounds',
|
||||
title: 'Geo Bounds',
|
||||
title: i18n.translate('common.ui.aggTypes.metrics.geoBoundsTitle', {
|
||||
defaultMessage: 'Geo Bounds'
|
||||
}),
|
||||
makeLabel: function () {
|
||||
return 'Geo Bounds';
|
||||
return i18n.translate('common.ui.aggTypes.metrics.geoBoundsLabel', {
|
||||
defaultMessage: 'Geo Bounds'
|
||||
});
|
||||
},
|
||||
params: [
|
||||
{
|
||||
|
|
|
@ -18,12 +18,17 @@
|
|||
*/
|
||||
|
||||
import { MetricAggType } from './metric_agg_type';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
export const geoCentroidMetricAgg = new MetricAggType({
|
||||
name: 'geo_centroid',
|
||||
title: 'Geo Centroid',
|
||||
title: i18n.translate('common.ui.aggTypes.metrics.geoCentroidTitle', {
|
||||
defaultMessage: 'Geo Centroid'
|
||||
}),
|
||||
makeLabel: function () {
|
||||
return 'Geo Centroid';
|
||||
return i18n.translate('common.ui.aggTypes.metrics.geoCentroidLabel', {
|
||||
defaultMessage: 'Geo Centroid'
|
||||
});
|
||||
},
|
||||
params: [
|
||||
{
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
import _ from 'lodash';
|
||||
import { safeMakeLabel } from './safe_make_label';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
const parentPipelineAggController = function ($scope) {
|
||||
|
||||
|
@ -59,8 +60,11 @@ const parentPipelineAggController = function ($scope) {
|
|||
} else {
|
||||
if (lastBucket) {
|
||||
const type = $scope.agg.type.title;
|
||||
lastBucket.error = `Last bucket aggregation must be "Date Histogram" or
|
||||
"Histogram" when using "${type}" metric aggregation!`;
|
||||
lastBucket.error = i18n.translate('common.ui.aggTypes.metrics.wrongLastBucketTypeErrorMessage', {
|
||||
defaultMessage: 'Last bucket aggregation must be "Date Histogram" or "Histogram" when using "{type}" metric aggregation!',
|
||||
values: { type },
|
||||
description: 'Date Histogram and Histogram should not be translated'
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ import { Schemas } from '../../../vis/editors/default/schemas';
|
|||
import { parentPipelineAggController } from './parent_pipeline_agg_controller';
|
||||
import { parentPipelineAggWriter } from './parent_pipeline_agg_writer';
|
||||
import { forwardModifyAggConfigOnSearchRequestStart } from './nested_agg_helpers';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
|
||||
const metricAggFilter = ['!top_hits', '!percentiles', '!percentile_ranks', '!median', '!std_dev'];
|
||||
|
@ -31,14 +32,18 @@ const metricAggSchema = (new Schemas([
|
|||
{
|
||||
group: 'none',
|
||||
name: 'metricAgg',
|
||||
title: 'Metric Agg',
|
||||
title: i18n.translate('common.ui.aggTypes.metrics.metricAggTitle', {
|
||||
defaultMessage: 'Metric Agg'
|
||||
}),
|
||||
hideCustomLabel: true,
|
||||
aggFilter: metricAggFilter
|
||||
}
|
||||
])).all[0];
|
||||
|
||||
const parentPipelineAggHelper = {
|
||||
subtype: 'Parent Pipeline Aggregations',
|
||||
subtype: i18n.translate('common.ui.aggTypes.metrics.parentPipelineAggregationsSubtypeTitle', {
|
||||
defaultMessage: 'Parent Pipeline Aggregations'
|
||||
}),
|
||||
params: function () {
|
||||
return [
|
||||
{
|
||||
|
|
|
@ -16,11 +16,14 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
export const safeMakeLabel = function (agg) {
|
||||
try {
|
||||
return agg.makeLabel();
|
||||
} catch (e) {
|
||||
return '- agg not valid -';
|
||||
return i18n.translate('common.ui.aggTypes.metrics.aggNotValidErrorMessage', {
|
||||
defaultMessage: '- agg not valid -'
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
|
@ -18,12 +18,19 @@
|
|||
*/
|
||||
|
||||
import { safeMakeLabel } from './safe_make_label';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
const siblingPipelineAggController = function (type) {
|
||||
return function ($scope) {
|
||||
const metricTitle = i18n.translate('common.ui.aggTypes.metrics.metricTitle', {
|
||||
defaultMessage: 'Metric'
|
||||
});
|
||||
const bucketTitle = i18n.translate('common.ui.aggTypes.metrics.bucketTitle', {
|
||||
defaultMessage: 'Bucket'
|
||||
});
|
||||
|
||||
$scope.aggType = type;
|
||||
$scope.aggTitle = type === 'customMetric' ? 'Metric' : 'Bucket';
|
||||
$scope.aggTitle = type === 'customMetric' ? metricTitle : bucketTitle;
|
||||
$scope.aggGroup = type === 'customMetric' ? 'metrics' : 'buckets';
|
||||
$scope.safeMakeLabel = safeMakeLabel;
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ import { siblingPipelineAggController } from './sibling_pipeline_agg_controller'
|
|||
import { siblingPipelineAggWriter } from './sibling_pipeline_agg_writer';
|
||||
import metricAggTemplate from '../../controls/sub_metric.html';
|
||||
import { forwardModifyAggConfigOnSearchRequestStart } from './nested_agg_helpers';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
const metricAggFilter = [
|
||||
'!top_hits', '!percentiles', '!percentile_ranks', '!median', '!std_dev',
|
||||
|
@ -36,7 +37,9 @@ const metricAggSchema = (new Schemas([
|
|||
{
|
||||
group: 'none',
|
||||
name: 'metricAgg',
|
||||
title: 'Metric Agg',
|
||||
title: i18n.translate('common.ui.aggTypes.metrics.metricAggTitle', {
|
||||
defaultMessage: 'Metric Agg'
|
||||
}),
|
||||
aggFilter: metricAggFilter
|
||||
}
|
||||
])).all[0];
|
||||
|
@ -45,14 +48,18 @@ const bucketAggFilter = [];
|
|||
const bucketAggSchema = (new Schemas([
|
||||
{
|
||||
group: 'none',
|
||||
title: 'Bucket Agg',
|
||||
title: i18n.translate('common.ui.aggTypes.metrics.bucketAggTitle', {
|
||||
defaultMessage: 'Bucket Agg'
|
||||
}),
|
||||
name: 'bucketAgg',
|
||||
aggFilter: bucketAggFilter
|
||||
}
|
||||
])).all[0];
|
||||
|
||||
const siblingPipelineAggHelper = {
|
||||
subtype: 'Sibling Pipeline Aggregations',
|
||||
subtype: i18n.translate('common.ui.aggTypes.metrics.siblingPipelineAggregationsSubtypeTitle', {
|
||||
defaultMessage: 'Sibling Pipeline Aggregations'
|
||||
}),
|
||||
params: function () {
|
||||
return [
|
||||
{
|
||||
|
|
|
@ -18,12 +18,18 @@
|
|||
*/
|
||||
|
||||
import { MetricAggType } from './metric_agg_type';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
export const maxMetricAgg = new MetricAggType({
|
||||
name: 'max',
|
||||
title: 'Max',
|
||||
title: i18n.translate('common.ui.aggTypes.metrics.maxTitle', {
|
||||
defaultMessage: 'Max'
|
||||
}),
|
||||
makeLabel: function (aggConfig) {
|
||||
return 'Max ' + aggConfig.getFieldDisplayName();
|
||||
return i18n.translate('common.ui.aggTypes.metrics.maxLabel', {
|
||||
defaultMessage: 'Max {field}',
|
||||
values: { field: aggConfig.getFieldDisplayName() }
|
||||
});
|
||||
},
|
||||
params: [
|
||||
{
|
||||
|
|
|
@ -19,13 +19,19 @@
|
|||
|
||||
import { MetricAggType } from './metric_agg_type';
|
||||
import { percentilesMetricAgg } from './percentiles';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
export const medianMetricAgg = new MetricAggType({
|
||||
name: 'median',
|
||||
dslName: 'percentiles',
|
||||
title: 'Median',
|
||||
title: i18n.translate('common.ui.aggTypes.metrics.medianTitle', {
|
||||
defaultMessage: 'Median'
|
||||
}),
|
||||
makeLabel: function (aggConfig) {
|
||||
return 'Median ' + aggConfig.getFieldDisplayName();
|
||||
return i18n.translate('common.ui.aggTypes.metrics.medianLabel', {
|
||||
defaultMessage: 'Median {field}',
|
||||
values: { field: aggConfig.getFieldDisplayName() }
|
||||
});
|
||||
},
|
||||
params: [
|
||||
{
|
||||
|
|
|
@ -21,6 +21,7 @@ import _ from 'lodash';
|
|||
import { AggType } from '../agg_type';
|
||||
import { fieldFormats } from '../../registry/field_formats';
|
||||
import { createLegacyClass } from '../../utils/legacy_class';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
createLegacyClass(MetricAggType).inherits(AggType);
|
||||
function MetricAggType(config) {
|
||||
|
@ -34,7 +35,9 @@ function MetricAggType(config) {
|
|||
}, this);
|
||||
}
|
||||
|
||||
MetricAggType.prototype.subtype = 'Metric Aggregations';
|
||||
MetricAggType.prototype.subtype = i18n.translate('common.ui.aggTypes.metrics.metricAggregationsSubtypeTitle', {
|
||||
defaultMessage: 'Metric Aggregations'
|
||||
});
|
||||
/**
|
||||
* Read the values for this metric from the
|
||||
* @param {[type]} bucket [description]
|
||||
|
|
|
@ -18,12 +18,18 @@
|
|||
*/
|
||||
|
||||
import { MetricAggType } from './metric_agg_type';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
export const minMetricAgg = new MetricAggType({
|
||||
name: 'min',
|
||||
title: 'Min',
|
||||
title: i18n.translate('common.ui.aggTypes.metrics.minTitle', {
|
||||
defaultMessage: 'Min'
|
||||
}),
|
||||
makeLabel: function (aggConfig) {
|
||||
return 'Min ' + aggConfig.getFieldDisplayName();
|
||||
return i18n.translate('common.ui.aggTypes.metrics.minLabel', {
|
||||
defaultMessage: 'Min {field}',
|
||||
values: { field: aggConfig.getFieldDisplayName() }
|
||||
});
|
||||
},
|
||||
params: [
|
||||
{
|
||||
|
|
|
@ -20,12 +20,19 @@
|
|||
import { MetricAggType } from './metric_agg_type';
|
||||
import { parentPipelineAggHelper } from './lib/parent_pipeline_agg_helper';
|
||||
import { makeNestedLabel } from './lib/make_nested_label';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
const movingAvgLabel = i18n.translate('common.ui.aggTypes.metrics.movingAvgLabel', {
|
||||
defaultMessage: 'moving avg'
|
||||
});
|
||||
|
||||
export const movingAvgMetricAgg = new MetricAggType({
|
||||
name: 'moving_avg',
|
||||
title: 'Moving Avg',
|
||||
title: i18n.translate('common.ui.aggTypes.metrics.movingAvgTitle', {
|
||||
defaultMessage: 'Moving Avg'
|
||||
}),
|
||||
subtype: parentPipelineAggHelper.subtype,
|
||||
makeLabel: agg => makeNestedLabel(agg, 'moving avg'),
|
||||
makeLabel: agg => makeNestedLabel(agg, movingAvgLabel),
|
||||
params: [
|
||||
...parentPipelineAggHelper.params()
|
||||
],
|
||||
|
|
|
@ -23,6 +23,7 @@ import { MetricAggType } from './metric_agg_type';
|
|||
import { getResponseAggConfigClass } from './get_response_agg_config_class';
|
||||
import { fieldFormats } from '../../registry/field_formats';
|
||||
import { getPercentileValue } from './percentiles_get_value';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
|
||||
// required by the values editor
|
||||
|
@ -33,15 +34,23 @@ const valueProps = {
|
|||
const format = (field && field.format) || fieldFormats.getDefaultInstance('number');
|
||||
const label = this.params.customLabel || this.getFieldDisplayName();
|
||||
|
||||
return 'Percentile rank ' + format.convert(this.key, 'text') + ' of "' + label + '"';
|
||||
return i18n.translate('common.ui.aggTypes.metrics.percentileRanks.valuePropsLabel', {
|
||||
defaultMessage: 'Percentile rank {format} of "{label}"',
|
||||
values: { format: format.convert(this.key, 'text'), label }
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
export const percentileRanksMetricAgg = new MetricAggType({
|
||||
name: 'percentile_ranks',
|
||||
title: 'Percentile Ranks',
|
||||
title: i18n.translate('common.ui.aggTypes.metrics.percentileRanksTitle', {
|
||||
defaultMessage: 'Percentile Ranks'
|
||||
}),
|
||||
makeLabel: function (agg) {
|
||||
return 'Percentile ranks of ' + agg.getFieldDisplayName();
|
||||
return i18n.translate('common.ui.aggTypes.metrics.percentileRanksLabel', {
|
||||
defaultMessage: 'Percentile ranks of {field}',
|
||||
values: { field: agg.getFieldDisplayName() }
|
||||
});
|
||||
},
|
||||
params: [
|
||||
{
|
||||
|
|
|
@ -23,19 +23,28 @@ import '../../number_list';
|
|||
import { MetricAggType } from './metric_agg_type';
|
||||
import { getResponseAggConfigClass } from './get_response_agg_config_class';
|
||||
import { getPercentileValue } from './percentiles_get_value';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
const valueProps = {
|
||||
makeLabel: function () {
|
||||
const label = this.params.customLabel || this.getFieldDisplayName();
|
||||
return ordinalSuffix(this.key) + ' percentile of ' + label;
|
||||
return i18n.translate('common.ui.aggTypes.metrics.percentiles.valuePropsLabel', {
|
||||
defaultMessage: '{percentile} percentile of {label}',
|
||||
values: { percentile: ordinalSuffix(this.key), label }
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
export const percentilesMetricAgg = new MetricAggType({
|
||||
name: 'percentiles',
|
||||
title: 'Percentiles',
|
||||
title: i18n.translate('common.ui.aggTypes.metrics.percentilesTitle', {
|
||||
defaultMessage: 'Percentiles'
|
||||
}),
|
||||
makeLabel: function (agg) {
|
||||
return 'Percentiles of ' + agg.getFieldDisplayName();
|
||||
return i18n.translate('common.ui.aggTypes.metrics.percentilesLabel', {
|
||||
defaultMessage: 'Percentiles of {field}',
|
||||
values: { field: agg.getFieldDisplayName() }
|
||||
});
|
||||
},
|
||||
params: [
|
||||
{
|
||||
|
|
|
@ -20,12 +20,19 @@
|
|||
import { MetricAggType } from './metric_agg_type';
|
||||
import { parentPipelineAggHelper } from './lib/parent_pipeline_agg_helper';
|
||||
import { makeNestedLabel } from './lib/make_nested_label';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
const serialDiffLabel = i18n.translate('common.ui.aggTypes.metrics.serialDiffLabel', {
|
||||
defaultMessage: 'serial diff'
|
||||
});
|
||||
|
||||
export const serialDiffMetricAgg = new MetricAggType({
|
||||
name: 'serial_diff',
|
||||
title: 'Serial Diff',
|
||||
title: i18n.translate('common.ui.aggTypes.metrics.serialDiffTitle', {
|
||||
defaultMessage: 'Serial Diff'
|
||||
}),
|
||||
subtype: parentPipelineAggHelper.subtype,
|
||||
makeLabel: agg => makeNestedLabel(agg, 'serial diff'),
|
||||
makeLabel: agg => makeNestedLabel(agg, serialDiffLabel),
|
||||
params: [
|
||||
...parentPipelineAggHelper.params()
|
||||
],
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
import _ from 'lodash';
|
||||
import { MetricAggType } from './metric_agg_type';
|
||||
import { getResponseAggConfigClass } from './get_response_agg_config_class';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
const responseAggConfigProps = {
|
||||
valProp: function () {
|
||||
|
@ -32,15 +33,24 @@ const responseAggConfigProps = {
|
|||
return _.get(details, [this.key, 'title']);
|
||||
},
|
||||
keyedDetails: function (customLabel, fieldDisplayName) {
|
||||
const label = customLabel ? customLabel : 'Standard Deviation of ' + fieldDisplayName;
|
||||
const label = customLabel ? customLabel : i18n.translate('common.ui.aggTypes.metrics.standardDeviation.keyDetailsLabel', {
|
||||
defaultMessage: 'Standard Deviation of {fieldDisplayName}',
|
||||
values: { fieldDisplayName }
|
||||
});
|
||||
return {
|
||||
std_lower: {
|
||||
valProp: ['std_deviation_bounds', 'lower'],
|
||||
title: 'Lower ' + label
|
||||
title: i18n.translate('common.ui.aggTypes.metrics.standardDeviation.lowerKeyDetailsTitle', {
|
||||
defaultMessage: 'Lower {label}',
|
||||
values: { label }
|
||||
})
|
||||
},
|
||||
std_upper: {
|
||||
valProp: ['std_deviation_bounds', 'upper'],
|
||||
title: 'Upper ' + label
|
||||
title: i18n.translate('common.ui.aggTypes.metrics.standardDeviation.upperKeyDetailsTitle', {
|
||||
defaultMessage: 'Upper {label}',
|
||||
values: { label }
|
||||
})
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -49,9 +59,14 @@ const responseAggConfigProps = {
|
|||
export const stdDeviationMetricAgg = new MetricAggType({
|
||||
name: 'std_dev',
|
||||
dslName: 'extended_stats',
|
||||
title: 'Standard Deviation',
|
||||
title: i18n.translate('common.ui.aggTypes.metrics.standardDeviationTitle', {
|
||||
defaultMessage: 'Standard Deviation'
|
||||
}),
|
||||
makeLabel: function (agg) {
|
||||
return 'Standard Deviation of ' + agg.getFieldDisplayName();
|
||||
return i18n.translate('common.ui.aggTypes.metrics.standardDeviationLabel', {
|
||||
defaultMessage: 'Standard Deviation of {field}',
|
||||
values: { field: agg.getFieldDisplayName() }
|
||||
});
|
||||
},
|
||||
params: [
|
||||
{
|
||||
|
|
|
@ -18,12 +18,18 @@
|
|||
*/
|
||||
|
||||
import { MetricAggType } from './metric_agg_type';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
export const sumMetricAgg = new MetricAggType({
|
||||
name: 'sum',
|
||||
title: 'Sum',
|
||||
title: i18n.translate('common.ui.aggTypes.metrics.sumTitle', {
|
||||
defaultMessage: 'Sum'
|
||||
}),
|
||||
makeLabel: function (aggConfig) {
|
||||
return 'Sum of ' + aggConfig.getFieldDisplayName();
|
||||
return i18n.translate('common.ui.aggTypes.metrics.sumLabel', {
|
||||
defaultMessage: 'Sum of {field}',
|
||||
values: { field: aggConfig.getFieldDisplayName() }
|
||||
});
|
||||
},
|
||||
params: [
|
||||
{
|
||||
|
|
|
@ -22,6 +22,7 @@ import { MetricAggType } from './metric_agg_type';
|
|||
import topSortEditor from '../controls/top_sort.html';
|
||||
import aggregateAndSizeEditor from '../controls/top_aggregate_and_size.html';
|
||||
import { aggTypeFieldFilters } from '../param_types/filter';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
const isNumber = function (type) {
|
||||
return type === 'number';
|
||||
|
@ -43,9 +44,17 @@ aggTypeFieldFilters.addFilter(
|
|||
|
||||
export const topHitMetricAgg = new MetricAggType({
|
||||
name: 'top_hits',
|
||||
title: 'Top Hit',
|
||||
title: i18n.translate('common.ui.aggTypes.metrics.topHitTitle', {
|
||||
defaultMessage: 'Top Hit'
|
||||
}),
|
||||
makeLabel: function (aggConfig) {
|
||||
let prefix = aggConfig.params.sortOrder.val === 'desc' ? 'Last' : 'First';
|
||||
const lastPrefixLabel = i18n.translate('common.ui.aggTypes.metrics.topHit.lastPrefixLabel', {
|
||||
defaultMessage: 'Last'
|
||||
});
|
||||
const firstPrefixLabel = i18n.translate('common.ui.aggTypes.metrics.topHit.firstPrefixLabel', {
|
||||
defaultMessage: 'First'
|
||||
});
|
||||
let prefix = aggConfig.params.sortOrder.val === 'desc' ? lastPrefixLabel : firstPrefixLabel;
|
||||
if (aggConfig.params.size !== 1) {
|
||||
prefix += ` ${aggConfig.params.size}`;
|
||||
}
|
||||
|
@ -85,35 +94,45 @@ export const topHitMetricAgg = new MetricAggType({
|
|||
editor: aggregateAndSizeEditor,
|
||||
options: [
|
||||
{
|
||||
display: 'Min',
|
||||
display: i18n.translate('common.ui.aggTypes.metrics.topHit.minLabel', {
|
||||
defaultMessage: 'Min'
|
||||
}),
|
||||
isCompatibleType: isNumber,
|
||||
isCompatibleVis: _.constant(true),
|
||||
disabled: true,
|
||||
val: 'min'
|
||||
},
|
||||
{
|
||||
display: 'Max',
|
||||
display: i18n.translate('common.ui.aggTypes.metrics.topHit.maxLabel', {
|
||||
defaultMessage: 'Max'
|
||||
}),
|
||||
isCompatibleType: isNumber,
|
||||
isCompatibleVis: _.constant(true),
|
||||
disabled: true,
|
||||
val: 'max'
|
||||
},
|
||||
{
|
||||
display: 'Sum',
|
||||
display: i18n.translate('common.ui.aggTypes.metrics.topHit.sumLabel', {
|
||||
defaultMessage: 'Sum'
|
||||
}),
|
||||
isCompatibleType: isNumber,
|
||||
isCompatibleVis: _.constant(true),
|
||||
disabled: true,
|
||||
val: 'sum'
|
||||
},
|
||||
{
|
||||
display: 'Average',
|
||||
display: i18n.translate('common.ui.aggTypes.metrics.topHit.averageLabel', {
|
||||
defaultMessage: 'Average'
|
||||
}),
|
||||
isCompatibleType: isNumber,
|
||||
isCompatibleVis: _.constant(true),
|
||||
disabled: true,
|
||||
val: 'average'
|
||||
},
|
||||
{
|
||||
display: 'Concatenate',
|
||||
display: i18n.translate('common.ui.aggTypes.metrics.topHit.concatenateLabel', {
|
||||
defaultMessage: 'Concatenate'
|
||||
}),
|
||||
isCompatibleType: _.constant(true),
|
||||
isCompatibleVis: function (name) {
|
||||
return name === 'metric' || name === 'table';
|
||||
|
@ -158,8 +177,18 @@ export const topHitMetricAgg = new MetricAggType({
|
|||
default: 'desc',
|
||||
editor: topSortEditor,
|
||||
options: [
|
||||
{ display: 'Descending', val: 'desc' },
|
||||
{ display: 'Ascending', val: 'asc' }
|
||||
{
|
||||
display: i18n.translate('common.ui.aggTypes.metrics.topHit.descendingLabel', {
|
||||
defaultMessage: 'Descending'
|
||||
}),
|
||||
val: 'desc'
|
||||
},
|
||||
{
|
||||
display: i18n.translate('common.ui.aggTypes.metrics.topHit.ascendingLabel', {
|
||||
defaultMessage: 'Ascending'
|
||||
}),
|
||||
val: 'asc'
|
||||
}
|
||||
],
|
||||
write(agg, output) {
|
||||
const sortField = agg.params.sortField;
|
||||
|
|
Loading…
Reference in a new issue