Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Maps] Add support for geohex_grid aggregation #127170

Merged
merged 28 commits into from
Mar 23, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
f4428e3
[Maps] hex bin gridding
nreese Mar 8, 2022
f01e12a
remove console.log
nreese Mar 8, 2022
b3930b0
disable hexbins for license and geo_shape
nreese Mar 8, 2022
39baddc
fix jest tests
nreese Mar 8, 2022
567beb0
copy cleanup
nreese Mar 8, 2022
18bee27
label
nreese Mar 8, 2022
489cb79
Merge branch 'main' into hex
kibanamachine Mar 14, 2022
327b959
update clusters SVG with hexbins
nreese Mar 15, 2022
fca22a7
show as tooltip
nreese Mar 15, 2022
7273133
documenation updates
nreese Mar 15, 2022
b724767
Merge branch 'main' into hex
kibanamachine Mar 17, 2022
d90f6e0
copy updates
nreese Mar 17, 2022
aaf5741
add API test for hex
nreese Mar 17, 2022
67ba15d
test cleanup
nreese Mar 17, 2022
4285e36
eslint
nreese Mar 17, 2022
8d3addd
eslint and functional test fixes
nreese Mar 18, 2022
2da8b54
merge with main
nreese Mar 18, 2022
c1ee20e
eslint, copy updates, and more doc updates
nreese Mar 18, 2022
7247a53
Merge branch 'main' into hex
kibanamachine Mar 18, 2022
a4c9cee
fix i18n error
nreese Mar 18, 2022
73206d9
consolidate isMvt logic
nreese Mar 18, 2022
8fedffe
copy review feedback
nreese Mar 18, 2022
e1ea2b3
use 3 stop scale for hexs
nreese Mar 18, 2022
af35df2
jest snapshot updates
nreese Mar 18, 2022
01f2eeb
Merge branch 'main' into hex
kibanamachine Mar 21, 2022
45d97eb
Update x-pack/plugins/maps/public/classes/sources/es_geo_grid_source/…
nreese Mar 22, 2022
98c1330
Merge branch 'main' into hex
kibanamachine Mar 22, 2022
fdf1719
Merge branch 'main' into hex
kibanamachine Mar 22, 2022
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

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

export const CLUSTER_LABEL = i18n.translate('xpack.maps.source.esGeoGrid.pointsDropdownOption', {
defaultMessage: 'Clusters',
});

export const GRID_LABEL = i18n.translate('xpack.maps.source.esGeoGrid.gridRectangleDropdownOption', {
defaultMessage: 'Grids',
});

export const HEX_LABEL = i18n.translate('xpack.maps.source.esGeoGrid.hexDropdownOption', {
defaultMessage: 'Hexbins',
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

export { RenderAsSelect } from './render_as_select';
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
import React from 'react';
import { EuiFormRow, EuiButtonGroup } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { ES_GEO_FIELD_TYPE, RENDER_AS } from '../../../../common/constants';
import { getIsCloud } from '../../../kibana_services';
import { getIsGoldPlus } from '../../../licensed_features';
import { ES_GEO_FIELD_TYPE, RENDER_AS } from '../../../../../common/constants';
import { getIsCloud } from '../../../../kibana_services';
import { getIsGoldPlus } from '../../../../licensed_features';
import { CLUSTER_LABEL, GRID_LABEL, HEX_LABEL } from './i18n_constants';
import { ShowAsLabel } from './show_as_label';

interface Props {
geoFieldType?: ES_GEO_FIELD_TYPE;
Expand Down Expand Up @@ -41,23 +43,17 @@ export function RenderAsSelect(props: Props) {
const options = [
{
id: RENDER_AS.POINT,
label: i18n.translate('xpack.maps.source.esGeoGrid.pointsDropdownOption', {
defaultMessage: 'clusters',
}),
label: CLUSTER_LABEL,
value: RENDER_AS.POINT,
},
{
id: RENDER_AS.GRID,
label: i18n.translate('xpack.maps.source.esGeoGrid.gridRectangleDropdownOption', {
defaultMessage: 'grids',
}),
label: GRID_LABEL,
value: RENDER_AS.GRID,
},
{
id: RENDER_AS.HEX,
label: i18n.translate('xpack.maps.source.esGeoGrid.hexDropdownOption', {
defaultMessage: 'hexbins',
}),
label: HEX_LABEL,
value: RENDER_AS.HEX,
isDisabled: isHexDisabled,
},
Expand All @@ -72,12 +68,11 @@ export function RenderAsSelect(props: Props) {

const currentOption = options.find((option) => option.value === props.renderAs) || options[0];

const selectLabel = <ShowAsLabel isHexDisabled={isHexDisabled} hexDisabledReason={hexDisabledReason}/>;

return (
<EuiFormRow
label={i18n.translate('xpack.maps.source.esGeoGrid.showAsLabel', {
defaultMessage: 'Show as',
})}
helpText={hexDisabledReason}
label={selectLabel}
display={props.isColumnCompressed ? 'columnCompressed' : 'row'}
>
<EuiButtonGroup
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import React from 'react';
import { EuiIcon, EuiText, EuiToolTip } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n-react';
import { CLUSTER_LABEL, GRID_LABEL, HEX_LABEL } from './i18n_constants';

interface Props {
isHexDisabled: boolean;
hexDisabledReason: string;
}

export function ShowAsLabel(props: Props) {
return (
<EuiToolTip
content={
<EuiText>
<dl>
<dt>{CLUSTER_LABEL}</dt>
<dd>
<p>
<FormattedMessage
id="xpack.maps.source.esGeoGrid.clusterDescription"
defaultMessage="Uses geotile grid aggregation to group your documents into grids. The cluster location is the weighted centroid for all documents in the gridded cell."
nreese marked this conversation as resolved.
Show resolved Hide resolved
/>
</p>
</dd>

<dt>{GRID_LABEL}</dt>
<dd>
<p>
<FormattedMessage
id="xpack.maps.source.esGeoGrid.gridDescription"
defaultMessage="Uses geotile grid aggregation to group your documents into grids. Displays the bounding box polygon for each gridded cell."
nreese marked this conversation as resolved.
Show resolved Hide resolved
/>
</p>
</dd>

<dt>{HEX_LABEL}</dt>
<dd>
<p>
<FormattedMessage
id="xpack.maps.source.esGeoGrid.hexDescription"
defaultMessage="Uses geohex grid aggregation to group your documents into H3 hexagon grids. Displays the hexagon polygon for each gridded cell."
nreese marked this conversation as resolved.
Show resolved Hide resolved
/>
</p>
{props.isHexDisabled ? <em>{props.hexDisabledReason}</em> : null}
</dd>
</dl>
</EuiText>
}
>
<span>
<FormattedMessage
id="xpack.maps.source.esGeoGrid.showAsLabel"
defaultMessage="Show as"
/>
{' '}
<EuiIcon type="questionInCircle" color="subdued" />
</span>
</EuiToolTip>
);
}