Skip to content

Commit

Permalink
[Lens] Combined histogram/range aggregation for numbers (#76121)
Browse files Browse the repository at this point in the history
Co-authored-by: Caroline Horn <[email protected]>
Co-authored-by: Wylie Conlon <[email protected]>
Co-authored-by: Elastic Machine <[email protected]>
Co-authored-by: Marta Bondyra <[email protected]>
Co-authored-by: cchaos <[email protected]>
  • Loading branch information
6 people authored Sep 23, 2020
1 parent 0d09cea commit 0f8043c
Show file tree
Hide file tree
Showing 17 changed files with 1,368 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ export function BucketNestingEditor({
defaultMessage: 'Top values for each {field}',
values: { field: fieldName },
}),
range: i18n.translate('xpack.lens.indexPattern.groupingOverallRanges', {
defaultMessage: 'Top values for each {field}',
values: { field: fieldName },
}),
};

const bottomLevelCopy: Record<string, string> = {
Expand All @@ -90,6 +94,10 @@ export function BucketNestingEditor({
defaultMessage: 'Overall top {target}',
values: { target: target.fieldName },
}),
range: i18n.translate('xpack.lens.indexPattern.groupingSecondRanges', {
defaultMessage: 'Overall top {target}',
values: { target: target.fieldName },
}),
};

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,6 @@ export function DimensionEditor(props: DimensionEditorProps) {

{!incompatibleSelectedOperationType && ParamEditor && (
<>
<EuiSpacer size="s" />
<ParamEditor
state={state}
setState={setState}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';

import {
EuiForm,
EuiFormRow,
EuiSwitch,
EuiSwitchEvent,
Expand Down Expand Up @@ -42,7 +41,7 @@ export const dateHistogramOperation: OperationDefinition<DateHistogramIndexPatte
displayName: i18n.translate('xpack.lens.indexPattern.dateHistogram', {
defaultMessage: 'Date histogram',
}),
priority: 3, // Higher than any metric
priority: 5, // Highest priority level used
getPossibleOperationForField: ({ aggregationRestrictions, aggregatable, type }) => {
if (
type === 'date' &&
Expand Down Expand Up @@ -180,7 +179,7 @@ export const dateHistogramOperation: OperationDefinition<DateHistogramIndexPatte
};

return (
<EuiForm>
<>
{!intervalIsRestricted && (
<EuiFormRow display="rowCompressed" hasChildLabel={false}>
<EuiSwitch
Expand Down Expand Up @@ -314,7 +313,7 @@ export const dateHistogramOperation: OperationDefinition<DateHistogramIndexPatte
)}
</EuiFormRow>
)}
</EuiForm>
</>
);
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ export const FilterList = ({
removeTitle={i18n.translate('xpack.lens.indexPattern.filters.removeFilter', {
defaultMessage: 'Remove a filter',
})}
isNotRemovable={localFilters.length === 1}
>
<FilterPopover
data-test-subj="indexPattern-filters-existingFilterContainer"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { BaseIndexPatternColumn } from './column_types';
import { IndexPatternPrivateState, IndexPattern, IndexPatternField } from '../../types';
import { DateRange } from '../../../../common';
import { DataPublicPluginStart } from '../../../../../../../src/plugins/data/public';
import { RangeIndexPatternColumn, rangeOperation } from './ranges';

// List of all operation definitions registered to this data source.
// If you want to implement a new operation, add the definition to this array and
Expand All @@ -40,6 +41,7 @@ const internalOperationDefinitions = [
cardinalityOperation,
sumOperation,
countOperation,
rangeOperation,
];

/**
Expand All @@ -49,6 +51,7 @@ const internalOperationDefinitions = [
*/
export type IndexPatternColumn =
| FiltersIndexPatternColumn
| RangeIndexPatternColumn
| TermsIndexPatternColumn
| DateHistogramIndexPatternColumn
| MinIndexPatternColumn
Expand All @@ -59,6 +62,7 @@ export type IndexPatternColumn =
| CountIndexPatternColumn;

export { termsOperation } from './terms';
export { rangeOperation } from './ranges';
export { filtersOperation } from './filters';
export { dateHistogramOperation } from './date_histogram';
export { minOperation, averageOperation, sumOperation, maxOperation } from './metrics';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.lnsRangesOperation__popoverButton {
@include euiTextBreakWord;
@include euiFontSizeS;
min-height: $euiSizeXL;
width: 100%;
}
Loading

0 comments on commit 0f8043c

Please sign in to comment.