mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
parent
38cc629ad4
commit
50b73f5e34
2 changed files with 32 additions and 24 deletions
|
@ -80,32 +80,36 @@ export function getPivotDropdownOptions(indexPattern: IndexPattern) {
|
|||
fields.forEach(field => {
|
||||
// Group by
|
||||
const availableGroupByAggs = pivotGroupByFieldSupport[field.type];
|
||||
availableGroupByAggs.forEach(groupByAgg => {
|
||||
// Aggregation name for the group-by is the plain field name. Illegal characters will be removed.
|
||||
const aggName = field.name.replace(illegalEsAggNameChars, '').trim();
|
||||
// Option name in the dropdown for the group-by is in the form of `sum(fieldname)`.
|
||||
const dropDownName = `${groupByAgg}(${field.name})`;
|
||||
const groupByOption: DropDownLabel = { label: dropDownName };
|
||||
groupByOptions.push(groupByOption);
|
||||
groupByOptionsData[dropDownName] = getDefaultGroupByConfig(
|
||||
aggName,
|
||||
dropDownName,
|
||||
field.name,
|
||||
groupByAgg
|
||||
);
|
||||
});
|
||||
if (availableGroupByAggs !== undefined) {
|
||||
availableGroupByAggs.forEach(groupByAgg => {
|
||||
// Aggregation name for the group-by is the plain field name. Illegal characters will be removed.
|
||||
const aggName = field.name.replace(illegalEsAggNameChars, '').trim();
|
||||
// Option name in the dropdown for the group-by is in the form of `sum(fieldname)`.
|
||||
const dropDownName = `${groupByAgg}(${field.name})`;
|
||||
const groupByOption: DropDownLabel = { label: dropDownName };
|
||||
groupByOptions.push(groupByOption);
|
||||
groupByOptionsData[dropDownName] = getDefaultGroupByConfig(
|
||||
aggName,
|
||||
dropDownName,
|
||||
field.name,
|
||||
groupByAgg
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
// Aggregations
|
||||
const aggOption: DropDownOption = { label: field.name, options: [] };
|
||||
const availableAggs = pivotAggsFieldSupport[field.type];
|
||||
availableAggs.forEach(agg => {
|
||||
// Aggregation name is formatted like `fieldname.sum`. Illegal characters will be removed.
|
||||
const aggName = `${field.name.replace(illegalEsAggNameChars, '').trim()}.${agg}`;
|
||||
// Option name in the dropdown for the aggregation is in the form of `sum(fieldname)`.
|
||||
const dropDownName = `${agg}(${field.name})`;
|
||||
aggOption.options.push({ label: dropDownName });
|
||||
aggOptionsData[dropDownName] = { agg, field: field.name, aggName, dropDownName };
|
||||
});
|
||||
if (availableAggs !== undefined) {
|
||||
availableAggs.forEach(agg => {
|
||||
// Aggregation name is formatted like `fieldname.sum`. Illegal characters will be removed.
|
||||
const aggName = `${field.name.replace(illegalEsAggNameChars, '').trim()}.${agg}`;
|
||||
// Option name in the dropdown for the aggregation is in the form of `sum(fieldname)`.
|
||||
const dropDownName = `${agg}(${field.name})`;
|
||||
aggOption.options.push({ label: dropDownName });
|
||||
aggOptionsData[dropDownName] = { agg, field: field.name, aggName, dropDownName };
|
||||
});
|
||||
}
|
||||
aggOptions.push(aggOption);
|
||||
});
|
||||
|
||||
|
|
|
@ -16,7 +16,11 @@ import { checkLicenseExpired, checkBasicLicense } from 'plugins/ml/license/check
|
|||
import { getCreateJobBreadcrumbs, getDataVisualizerIndexOrSearchBreadcrumbs } from 'plugins/ml/jobs/breadcrumbs';
|
||||
import { getDataFrameIndexOrSearchBreadcrumbs } from 'plugins/ml/data_frame/breadcrumbs';
|
||||
import { preConfiguredJobRedirect } from 'plugins/ml/jobs/new_job/wizard/preconfigured_job_redirect';
|
||||
import { checkCreateJobsPrivilege, checkFindFileStructurePrivilege } from 'plugins/ml/privilege/check_privilege';
|
||||
import {
|
||||
checkCreateJobsPrivilege,
|
||||
checkFindFileStructurePrivilege,
|
||||
checkCreateDataFrameJobsPrivilege
|
||||
} from 'plugins/ml/privilege/check_privilege';
|
||||
import { loadIndexPatterns, getIndexPatterns } from 'plugins/ml/util/index_utils';
|
||||
import { checkMlNodesAvailable } from 'plugins/ml/ml_nodes_check/check_ml_nodes';
|
||||
import template from './index_or_search.html';
|
||||
|
@ -66,7 +70,7 @@ uiRoutes
|
|||
k7Breadcrumbs: getDataFrameIndexOrSearchBreadcrumbs,
|
||||
resolve: {
|
||||
CheckLicense: checkBasicLicense,
|
||||
privileges: checkFindFileStructurePrivilege,
|
||||
privileges: checkCreateDataFrameJobsPrivilege,
|
||||
indexPatterns: loadIndexPatterns,
|
||||
nextStepPath: () => '#data_frames/new_job/step/pivot',
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue