mirror of
https://github.com/elastic/kibana.git
synced 2025-04-25 02:09:32 -04:00
disable concatenate aggregation type for visualizations other than table and metric
This commit is contained in:
parent
3d5fa029cd
commit
2a2fa67d2a
1 changed files with 12 additions and 5 deletions
|
@ -65,40 +65,47 @@ export default function AggTypeMetricTopProvider(Private) {
|
||||||
{
|
{
|
||||||
display: 'Min',
|
display: 'Min',
|
||||||
isCompatibleType: isNumber,
|
isCompatibleType: isNumber,
|
||||||
|
isCompatibleVis: _.constant(true),
|
||||||
disabled: true,
|
disabled: true,
|
||||||
val: 'min'
|
val: 'min'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
display: 'Max',
|
display: 'Max',
|
||||||
isCompatibleType: isNumber,
|
isCompatibleType: isNumber,
|
||||||
|
isCompatibleVis: _.constant(true),
|
||||||
disabled: true,
|
disabled: true,
|
||||||
val: 'max'
|
val: 'max'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
display: 'Sum',
|
display: 'Sum',
|
||||||
isCompatibleType: isNumber,
|
isCompatibleType: isNumber,
|
||||||
|
isCompatibleVis: _.constant(true),
|
||||||
disabled: true,
|
disabled: true,
|
||||||
val: 'sum'
|
val: 'sum'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
display: 'Average',
|
display: 'Average',
|
||||||
isCompatibleType: isNumber,
|
isCompatibleType: isNumber,
|
||||||
|
isCompatibleVis: _.constant(true),
|
||||||
disabled: true,
|
disabled: true,
|
||||||
val: 'average'
|
val: 'average'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
display: 'Concatenate',
|
display: 'Concatenate',
|
||||||
isCompatibleType: _.constant(true),
|
isCompatibleType: _.constant(true),
|
||||||
|
isCompatibleVis: function (name) {
|
||||||
|
return name === 'metric' || name === 'table';
|
||||||
|
},
|
||||||
disabled: true,
|
disabled: true,
|
||||||
val: 'concat'
|
val: 'concat'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
controller: function ($scope) {
|
controller: function ($scope) {
|
||||||
$scope.options = _.cloneDeep($scope.aggParam.options);
|
$scope.options = _.cloneDeep($scope.aggParam.options);
|
||||||
$scope.$watch('agg.params.field.type', function (type) {
|
$scope.$watchGroup([ 'agg.vis.type.name', 'agg.params.field.type' ], function ([ visName, fieldType ]) {
|
||||||
if (type) {
|
if (fieldType && visName) {
|
||||||
_.each($scope.options, option => {
|
_.each($scope.options, option => {
|
||||||
option.disabled = !option.isCompatibleType(type);
|
option.disabled = !option.isCompatibleVis(visName) || !option.isCompatibleType(fieldType);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -167,7 +174,7 @@ export default function AggTypeMetricTopProvider(Private) {
|
||||||
let values = [];
|
let values = [];
|
||||||
|
|
||||||
for (const hit of hits) {
|
for (const hit of hits) {
|
||||||
const hitValues = path === '_source' ? hit._source : agg.vis.indexPattern.flattenHit(hit, true)[path];;
|
const hitValues = path === '_source' ? hit._source : agg.vis.indexPattern.flattenHit(hit, true)[path];
|
||||||
if (_.isArray(hitValues)) {
|
if (_.isArray(hitValues)) {
|
||||||
values.push(...hitValues);
|
values.push(...hitValues);
|
||||||
} else {
|
} else {
|
||||||
|
@ -193,4 +200,4 @@ export default function AggTypeMetricTopProvider(Private) {
|
||||||
return values;
|
return values;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue