Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
bd4f39b
mvt init
thomasneirynck Aug 14, 2020
4da768c
cleanup
thomasneirynck Aug 14, 2020
aae411f
typing
thomasneirynck Aug 14, 2020
a3fbf97
update snapshot
thomasneirynck Aug 14, 2020
828ce8a
Enable mvt only for geo_shape
thomasneirynck Aug 14, 2020
02e7688
fix ts
thomasneirynck Aug 17, 2020
058c116
Fix snapshot
thomasneirynck Aug 17, 2020
43efc7c
update functional tests
thomasneirynck Aug 17, 2020
4c238c7
Merge branch 'master' of github.com:elastic/kibana into maps/es_mvt
thomasneirynck Aug 17, 2020
76bdfcc
feedback
thomasneirynck Aug 17, 2020
2371e7b
fix snapshot
thomasneirynck Aug 18, 2020
9769159
disable client-side metadata retrieval
thomasneirynck Aug 18, 2020
3a5a642
fix typos
thomasneirynck Aug 18, 2020
aa3e6e1
take into account url-state
thomasneirynck Aug 18, 2020
318e2e8
Merge branch 'master' of github.com:elastic/kibana into maps/es_mvt
thomasneirynck Aug 18, 2020
d011799
add unit test
thomasneirynck Aug 18, 2020
4839327
add test stub
thomasneirynck Aug 18, 2020
d1cb30d
add functional test
thomasneirynck Aug 18, 2020
f611360
add getTile unit test boilerplate
thomasneirynck Aug 18, 2020
abe3188
fix import
thomasneirynck Aug 19, 2020
c73faef
exclude bbox-features from tooltips
thomasneirynck Aug 19, 2020
919024a
only include required fields
thomasneirynck Aug 19, 2020
0010eae
Merge branch 'master' of github.com:elastic/kibana into maps/es_mvt
thomasneirynck Aug 20, 2020
6e2455f
simplify test
thomasneirynck Aug 20, 2020
38e3a54
import
thomasneirynck Aug 20, 2020
4df20b4
wording feedback
thomasneirynck Aug 20, 2020
20ba148
[Console] Update extract string literal logic (#72628)
jloleysens Aug 20, 2020
989c87b
Retry network errors on registry requests (#74507)
Aug 20, 2020
6791c13
[Ingest Manager] Don't retain POST /setup results. fixes #74587 (#75372)
Aug 20, 2020
539d84b
Fixing functional test user roles (#75547)
flash1293 Aug 20, 2020
0a8862d
[Ingest pipelines] Test pipeline enhancements (#74964)
alisonelizabeth Aug 20, 2020
31b566c
Fixes viewer overflow bug (#75489)
dplumlee Aug 20, 2020
28bacb2
[expressions] Remove legacy APIs. (#75517)
lukeelmers Aug 20, 2020
d84d972
adding additional tests for the awesome new nav by core ui team and c…
bhavyarm Aug 20, 2020
865f171
[Enterprise Search][bug/tech debt] Fix route navigation (#75369)
constancecchen Aug 20, 2020
2c10325
[Dashboard First] Use App Title for Display Instead of App Id (#75457)
ThomThomson Aug 20, 2020
d6ee7fa
[Ingest Pipelines] Processor forms for processors E-J (#75054)
jloleysens Aug 20, 2020
d7256e1
[Metrics UI] Support percentage format in threshold alerts (#72701)
Zacqary Aug 20, 2020
d37ec02
[Metrics UI] Get custom metrics working in inventory alerts with limi…
Zacqary Aug 20, 2020
9d7469b
[Task Manager] Monitors the Task Manager Poller and automatically rec…
gmmorris Aug 20, 2020
31f1a83
[Ingest Manager] Add namespace validation (#75381)
jen-huang Aug 20, 2020
4ac998f
[ML] Update broken job config callout error (#75481)
qn895 Aug 20, 2020
d47337b
[kbn/plugin-generator] remove sao, modernize (#75465)
Aug 21, 2020
258591e
[TSVB] Disable enableHistogramMode prop when user selects non-stacked…
stratoula Aug 21, 2020
0f456f1
[ML] Transforms: Unset doc title when app unmounts (#75539)
peteharverson Aug 21, 2020
6e162ff
adding markdown vis renderer (#75532)
ppisljar Aug 21, 2020
42c2f8e
Embeddable input (#73033)
streamich Aug 21, 2020
aeb6573
[Lens] Use index pattern service instead saved object client (#74654)
mbondyra Aug 21, 2020
e91528e
[Uptime] Add delay in telemetry test (#75162)
shahzad31 Aug 21, 2020
040b4e2
[Console] Get ES Config from core (#75406)
jloleysens Aug 21, 2020
f67ac7f
Migrate CSP usage collector to `kibana_usage_collection` plugin (#75536)
pgayvallet Aug 21, 2020
80ce878
[Data Telemetry] Add index pattern to identify "meow" attacks (#75163)
afharo Aug 21, 2020
2f1a03e
[Security Solution] modify circular deps checker to output images of …
Aug 21, 2020
b7504b3
update snap
thomasneirynck Aug 21, 2020
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
2 changes: 2 additions & 0 deletions x-pack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@
"font-awesome": "4.7.0",
"formsy-react": "^1.1.5",
"fp-ts": "^2.3.1",
"geojson-vt": "^3.2.1",
"get-port": "^4.2.0",
"getos": "^3.1.0",
"git-url-parse": "11.1.2",
Expand Down Expand Up @@ -382,6 +383,7 @@
"uuid": "3.3.2",
"venn.js": "0.2.20",
"vscode-languageserver": "^5.2.1",
"vt-pbf": "^3.1.1",
"webpack": "^4.41.5",
"wellknown": "^0.5.0",
"xml2js": "^0.4.22",
Expand Down
7 changes: 7 additions & 0 deletions x-pack/plugins/maps/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ export const MAP_PATH = 'map';
export const GIS_API_PATH = `api/${APP_ID}`;
export const INDEX_SETTINGS_API_PATH = `${GIS_API_PATH}/indexSettings`;
export const FONTS_API_PATH = `${GIS_API_PATH}/fonts`;
export const API_ROOT_PATH = `/${GIS_API_PATH}`;

export const MVT_GETTILE_API_PATH = 'mvt/getTile';
export const MVT_SOURCE_LAYER_NAME = 'geojsonLayer';
export const KBN_TOO_MANY_FEATURES_PROPERTY = '__kbn_too_many_features__';
export const KBN_TOO_MANY_FEATURES_IMAGE_ID = '__kbn_too_many_features_image_id__';

const MAP_BASE_URL = `/${MAPS_APP_PATH}/${MAP_PATH}`;
export function getNewMapPath() {
Expand Down Expand Up @@ -219,6 +225,7 @@ export enum SCALING_TYPES {
LIMIT = 'LIMIT',
CLUSTERS = 'CLUSTERS',
TOP_HITS = 'TOP_HITS',
MVT = 'MVT',
}

export const RGBA_0000 = 'rgba(0,0,0,0)';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export class TiledVectorLayer extends VectorLayer {

startLoading(SOURCE_DATA_REQUEST_ID, requestToken, searchFilters);
try {
const templateWithMeta = await this._source.getUrlTemplateWithMeta();
const templateWithMeta = await this._source.getUrlTemplateWithMeta(dataFilters);
stopLoading(SOURCE_DATA_REQUEST_ID, requestToken, templateWithMeta, {});
} catch (error) {
onLoadError(SOURCE_DATA_REQUEST_ID, requestToken, error.message);
Expand Down Expand Up @@ -160,6 +160,11 @@ export class TiledVectorLayer extends VectorLayer {
return false;
}

if (!mbTileSource.tiles) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is because the layer-type and the underlying representation in mb changes when toggling between scaling-types. It needs to check it the mb-source is compatible with the layer-type.

// Expected source is not compatible, so remove.
return true;
}

const isSourceDifferent =
mbTileSource.tiles[0] !== tiledSourceMeta.urlTemplate ||
mbTileSource.minzoom !== tiledSourceMeta.minSourceZoom ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ import {
SOURCE_BOUNDS_DATA_REQUEST_ID,
FEATURE_VISIBLE_PROPERTY_NAME,
EMPTY_FEATURE_COLLECTION,
KBN_TOO_MANY_FEATURES_PROPERTY,
LAYER_TYPE,
FIELD_ORIGIN,
LAYER_STYLE_TYPE,
KBN_TOO_MANY_FEATURES_IMAGE_ID,
} from '../../../../common/constants';
import _ from 'lodash';
import { JoinTooltipProperty } from '../../tooltips/join_tooltip_property';
Expand Down Expand Up @@ -777,6 +779,8 @@ export class VectorLayer extends AbstractLayer {
const sourceId = this.getId();
const fillLayerId = this._getMbPolygonLayerId();
const lineLayerId = this._getMbLineLayerId();
const tooManyFeaturesLayerId = this._getMbTooManyFeaturesLayerId();

const hasJoins = this.hasJoins();
if (!mbMap.getLayer(fillLayerId)) {
const mbLayer = {
Expand All @@ -802,6 +806,30 @@ export class VectorLayer extends AbstractLayer {
}
mbMap.addLayer(mbLayer);
}
if (!mbMap.getLayer(tooManyFeaturesLayerId)) {
const mbLayer = {
id: tooManyFeaturesLayerId,
type: 'fill',
source: sourceId,
paint: {},
};
if (mvtSourceLayer) {
mbLayer['source-layer'] = mvtSourceLayer;
}
mbMap.addLayer(mbLayer);
mbMap.setFilter(tooManyFeaturesLayerId, [
'==',
['get', KBN_TOO_MANY_FEATURES_PROPERTY],
true,
]);
mbMap.setPaintProperty(
tooManyFeaturesLayerId,
'fill-pattern',
KBN_TOO_MANY_FEATURES_IMAGE_ID
);
mbMap.setPaintProperty(tooManyFeaturesLayerId, 'fill-opacity', this.getAlpha());
}

this.getCurrentStyle().setMBPaintProperties({
alpha: this.getAlpha(),
mbMap,
Expand All @@ -822,6 +850,9 @@ export class VectorLayer extends AbstractLayer {
if (lineFilterExpr !== mbMap.getFilter(lineLayerId)) {
mbMap.setFilter(lineLayerId, lineFilterExpr);
}

this.syncVisibilityWithMb(mbMap, tooManyFeaturesLayerId);
mbMap.setLayerZoomRange(tooManyFeaturesLayerId, this.getMinZoom(), this.getMaxZoom());
}

_syncStylePropertiesWithMb(mbMap) {
Expand All @@ -836,6 +867,18 @@ export class VectorLayer extends AbstractLayer {
type: 'geojson',
data: EMPTY_FEATURE_COLLECTION,
});
} else if (mbSource.type !== 'geojson') {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to remove incompatible source-types and layers

this.getMbLayerIds().forEach((mbLayerId) => {
if (mbMap.getLayer(mbLayerId)) {
mbMap.removeLayer(mbLayerId);
}
});

mbMap.removeSource(this._getMbSourceId());
mbMap.addSource(this._getMbSourceId(), {
type: 'geojson',
data: EMPTY_FEATURE_COLLECTION,
});
}
}

Expand Down Expand Up @@ -865,13 +908,18 @@ export class VectorLayer extends AbstractLayer {
return this.makeMbLayerId('fill');
}

_getMbTooManyFeaturesLayerId() {
return this.makeMbLayerId('toomanyfeatures');
}

getMbLayerIds() {
return [
this._getMbPointLayerId(),
this._getMbTextLayerId(),
this._getMbSymbolLayerId(),
this._getMbLineLayerId(),
this._getMbPolygonLayerId(),
this._getMbTooManyFeaturesLayerId(),
];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,18 @@ import { ESSearchSource, sourceTitle } from './es_search_source';
import { BlendedVectorLayer } from '../../layers/blended_vector_layer/blended_vector_layer';
import { VectorLayer } from '../../layers/vector_layer/vector_layer';
import { LAYER_WIZARD_CATEGORY, SCALING_TYPES } from '../../../../common/constants';
import { TiledVectorLayer } from '../../layers/tiled_vector_layer/tiled_vector_layer';

export function createDefaultLayerDescriptor(sourceConfig: unknown, mapColors: string[]) {
const sourceDescriptor = ESSearchSource.createDescriptor(sourceConfig);

return sourceDescriptor.scalingType === SCALING_TYPES.CLUSTERS
? BlendedVectorLayer.createDescriptor({ sourceDescriptor }, mapColors)
: VectorLayer.createDescriptor({ sourceDescriptor }, mapColors);
if (sourceDescriptor.scalingType === SCALING_TYPES.CLUSTERS) {
return BlendedVectorLayer.createDescriptor({ sourceDescriptor }, mapColors);
} else if (sourceDescriptor.scalingType === SCALING_TYPES.MVT) {
return TiledVectorLayer.createDescriptor({ sourceDescriptor }, mapColors);
} else {
return VectorLayer.createDescriptor({ sourceDescriptor }, mapColors);
}
}

export const esDocumentsLayerWizardConfig: LayerWizard = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@

import { AbstractESSource } from '../es_source';
import { ESSearchSourceDescriptor } from '../../../../common/descriptor_types';
import { ITiledSingleLayerVectorSource } from '../vector_source';

export class ESSearchSource extends AbstractESSource {
export class ESSearchSource extends AbstractESSource implements ITiledSingleLayerVectorSource {
static createDescriptor(sourceConfig: unknown): ESSearchSourceDescriptor;

constructor(sourceDescriptor: Partial<ESSearchSourceDescriptor>, inspectorAdapters: unknown);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@

import _ from 'lodash';
import React from 'react';
import rison from 'rison-node';

import { AbstractESSource } from '../es_source';
import { getSearchService } from '../../../kibana_services';
import { getSearchService, getHttp } from '../../../kibana_services';
import { hitsToGeoJson } from '../../../elasticsearch_geo_utils';
import { UpdateSourceEditor } from './update_source_editor';
import {
Expand All @@ -18,6 +19,11 @@ import {
SORT_ORDER,
SCALING_TYPES,
VECTOR_SHAPE_TYPE,
MVT_SOURCE_LAYER_NAME,
GIS_API_PATH,
MVT_GETTILE_API_PATH,
MIN_ZOOM,
MAX_ZOOM,
} from '../../../../common/constants';
import { i18n } from '@kbn/i18n';
import { getDataSourceLabel } from '../../../../common/i18n_getters';
Expand Down Expand Up @@ -448,9 +454,13 @@ export class ESSearchSource extends AbstractESSource {
}

isFilterByMapBounds() {
return this._descriptor.scalingType === SCALING_TYPES.CLUSTER
? true
: this._descriptor.filterByMapBounds;
if (this._descriptor.scalingType === SCALING_TYPES.CLUSTER) {
return true;
} else if (this._descriptor.scalingType === SCALING_TYPES.MVT) {
return false;
} else {
return this._descriptor.filterByMapBounds;
}
}

async getLeftJoinFields() {
Expand Down Expand Up @@ -553,11 +563,66 @@ export class ESSearchSource extends AbstractESSource {
}

getJoinsDisabledReason() {
return this._descriptor.scalingType === SCALING_TYPES.CLUSTERS
? i18n.translate('xpack.maps.source.esSearch.joinsDisabledReason', {
defaultMessage: 'Joins are not supported when scaling by clusters',
})
: null;
let reason;
if (this._descriptor.scalingType === SCALING_TYPES.CLUSTERS) {
reason = i18n.translate('xpack.maps.source.esSearch.joinsDisabledReason', {
defaultMessage: 'Joins are not supported when scaling by clusters',
});
} else if (this._descriptor.scalingType === SCALING_TYPES.MVT) {
reason = i18n.translate('xpack.maps.source.esSearch.joinsDisabledReasonMvt', {
defaultMessage: 'Joins are not supported when scaling by mvt vector tiles',
});
} else {
reason = null;
}
return reason;
}

// MVT methods. Do we really need different source-type?????
getLayerName() {
return 'water';
}

async getUrlTemplateWithMeta(searchFilters) {
const indexPattern = await this.getIndexPattern();
const indexSettings = await loadIndexSettings(indexPattern.title);

//assuming only geo_shape fields for now
const initialSearchContext = {
// docvalue_fields: await this._getDateDocvalueFields(searchFilters.fieldNames),
};
// const geoField = await this._getGeoField();
// const docValueFields = await this._excludeDateFields(searchFilters.fieldNames);
// const withoutGeoField = docValueFields.filter((field) => field !== geoField.name);
// initialSearchContext.docvalue_fields.push(...withoutGeoField);

const searchSource = await this.makeSearchSource(
searchFilters,
indexSettings.maxResultWindow,
initialSearchContext
);
searchSource.setField('fields', searchFilters.fieldNames);

const ipTitle = indexPattern.title;
const geometryFieldName = this._descriptor.geoField;
const fields = ['_id']; //todo needs to include correct fields
const fieldsParam = fields.join(',');

const dsl = await searchSource.getSearchRequestBody();

const risonDsl = rison.encode(dsl);

const mvtUrlServicePath = getHttp().basePath.prepend(
`/${GIS_API_PATH}/${MVT_GETTILE_API_PATH}`
);

const urlTemplate = `${mvtUrlServicePath}?x={x}&y={y}&z={z}&geometryFieldName=${geometryFieldName}&indexPattern=${ipTitle}&fields=${fieldsParam}&requestBody=${risonDsl}`;
return {
layerName: MVT_SOURCE_LAYER_NAME,
minSourceZoom: MIN_ZOOM,
maxSourceZoom: MAX_ZOOM,
urlTemplate: urlTemplate,
};
}
}

Expand Down
Loading