-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Visualize] fix tile_map visualization (#154392)
Fixes #154375 ### background #105326 replaced tile_map visualization implementation with a new implementation that is a wrapper around MapEmbeddable. #152952 removed geohash_grid aggregation. This causes a regression where existing tile_map visualizations no longer work. Even though geohash_grid aggregation is no longer used, the AggType is still needed so that new tile_map visualization wrapper can access aggregation configuration state. This PR adds back geohash_grid AggType in `legacyAggs` for this purpose. PR also adds a functional test to better prevent regressions with tile_map ### Test * install web logs sample data * install legacy tile_map saved objects from ``` {"attributes":{"fieldFormatMap":"{\"hour_of_day\":{}}","runtimeFieldMap":"{\"hour_of_day\":{\"type\":\"long\",\"script\":{\"source\":\"emit(doc['timestamp'].value.getHour());\"}}}","timeFieldName":"timestamp","title":"kibana_sample_data_logs"},"coreMigrationVersion":"7.17.5","id":"90943e30-9a47-11e8-b64d-95841ca0b247","migrationVersion":{"index-pattern":"7.11.0"},"references":[],"type":"index-pattern","updated_at":"2022-08-17T20:25:52.585Z","version":"WzEzMDQsMV0="} {"attributes":{"description":"","kibanaSavedObjectMeta":{"searchSourceJSON":"{\"query\":{\"language\":\"kuery\",\"query\":\"\"},\"filter\":[],\"indexRefName\":\"kibanaSavedObjectMeta.searchSourceJSON.index\"}"},"title":"region_map","uiStateJSON":"{}","version":1,"visState":"{\"aggs\":[{\"enabled\":true,\"id\":\"1\",\"params\":{},\"schema\":\"metric\",\"type\":\"count\"},{\"enabled\":true,\"id\":\"2\",\"params\":{\"field\":\"geo.dest\",\"missingBucket\":false,\"missingBucketLabel\":\"Missing\",\"order\":\"desc\",\"orderBy\":\"1\",\"otherBucket\":false,\"otherBucketLabel\":\"Other\",\"size\":5},\"schema\":\"segment\",\"type\":\"terms\"}],\"params\":{\"addTooltip\":true,\"colorSchema\":\"Yellow to Red\",\"emsHotLink\":\"https://maps.elastic.co/v7.16?locale=en#file/world_countries\",\"isDisplayWarning\":true,\"legendPosition\":\"bottomright\",\"mapCenter\":[0,0],\"mapZoom\":2,\"outlineWeight\":1,\"selectedJoinField\":{\"description\":\"ISO 3166-1 alpha-2 code\",\"name\":\"iso2\",\"type\":\"id\"},\"selectedLayer\":{\"attribution\":\"<a rel=\\\"noreferrer noopener\\\" href=\\\"http://www.naturalearthdata.com/about/terms-of-use\\\">Made with NaturalEarth</a> | <a rel=\\\"noreferrer noopener\\\" href=\\\"https://www.openstreetmap.org/copyright\\\">OpenStreetMap contributors</a> | <a rel=\\\"noreferrer noopener\\\" href=\\\"https://www.elastic.co/elastic-maps-service\\\">Elastic Maps Service</a>\",\"created_at\":\"2020-10-28T16:16:08.720286\",\"fields\":[{\"description\":\"ISO 3166-1 alpha-2 code\",\"name\":\"iso2\",\"type\":\"id\"},{\"description\":\"ISO 3166-1 alpha-3 code\",\"name\":\"iso3\",\"type\":\"id\"},{\"description\":\"ISO 3166-1 numeric code\",\"name\":\"iso_numeric\",\"type\":\"id\"},{\"description\":\"name\",\"name\":\"name\",\"type\":\"property\"}],\"format\":\"topojson\",\"id\":\"world_countries\",\"isEMS\":true,\"layerId\":\"elastic_maps_service.World Countries\",\"meta\":{\"feature_collection_path\":\"data\"},\"name\":\"World Countries\",\"origin\":\"elastic_maps_service\"},\"showAllShapes\":true,\"wms\":{\"enabled\":false,\"options\":{\"attribution\":\"\",\"format\":\"image/png\",\"layers\":\"\",\"styles\":\"\",\"transparent\":true,\"version\":\"\"},\"selectedTmsLayer\":{\"attribution\":\"<a rel=\\\"noreferrer noopener\\\" href=\\\"https://www.openstreetmap.org/copyright\\\">OpenStreetMap contributors</a> | <a rel=\\\"noreferrer noopener\\\" href=\\\"https://openmaptiles.org\\\">OpenMapTiles</a> | <a rel=\\\"noreferrer noopener\\\" href=\\\"https://www.elastic.co/elastic-maps-service\\\">Elastic Maps Service</a>\",\"id\":\"road_map\",\"maxZoom\":20,\"minZoom\":0,\"origin\":\"elastic_maps_service\"},\"url\":\"\"}},\"title\":\"region_map\",\"type\":\"region_map\"}"},"coreMigrationVersion":"7.17.5","id":"64a5b9f0-1e6b-11ed-833b-a105e9534fa9","migrationVersion":{"visualization":"7.17.0"},"references":[{"id":"90943e30-9a47-11e8-b64d-95841ca0b247","name":"kibanaSavedObjectMeta.searchSourceJSON.index","type":"index-pattern"}],"type":"visualization","updated_at":"2022-08-17T20:30:50.288Z","version":"WzE0MDIsMV0="} {"attributes":{"description":"","kibanaSavedObjectMeta":{"searchSourceJSON":"{\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filter\":[],\"indexRefName\":\"kibanaSavedObjectMeta.searchSourceJSON.index\"}"},"title":"tile_map","uiStateJSON":"{\"mapZoom\":2,\"mapCenter\":[13.64385981167601,-135.97675761558068]}","version":1,"visState":"{\"title\":\"tile_map\",\"type\":\"tile_map\",\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"count\",\"params\":{},\"schema\":\"metric\"},{\"id\":\"2\",\"enabled\":true,\"type\":\"geohash_grid\",\"params\":{\"field\":\"geo.coordinates\",\"autoPrecision\":true,\"precision\":2,\"useGeocentroid\":true,\"isFilteredByCollar\":true},\"schema\":\"segment\"}],\"params\":{\"colorSchema\":\"Yellow to Red\",\"mapType\":\"Scaled Circle Markers\",\"isDesaturated\":true,\"addTooltip\":true,\"heatClusterSize\":1.5,\"legendPosition\":\"bottomright\",\"mapZoom\":2,\"mapCenter\":[0,0],\"wms\":{\"enabled\":false,\"url\":\"\",\"options\":{\"version\":\"\",\"layers\":\"\",\"format\":\"image/png\",\"transparent\":true,\"attribution\":\"\",\"styles\":\"\"},\"selectedTmsLayer\":{\"origin\":\"elastic_maps_service\",\"id\":\"road_map\",\"minZoom\":0,\"maxZoom\":20,\"attribution\":\"<a rel=\\\"noreferrer noopener\\\" href=\\\"https://www.openstreetmap.org/copyright\\\">OpenStreetMap contributors</a> | <a rel=\\\"noreferrer noopener\\\" href=\\\"https://openmaptiles.org\\\">OpenMapTiles</a> | <a rel=\\\"noreferrer noopener\\\" href=\\\"https://www.elastic.co/elastic-maps-service\\\">Elastic Maps Service</a>\"}}}}"},"coreMigrationVersion":"7.17.5","id":"4b073190-1e6b-11ed-833b-a105e9534fa9","migrationVersion":{"visualization":"7.17.0"},"references":[{"id":"90943e30-9a47-11e8-b64d-95841ca0b247","name":"kibanaSavedObjectMeta.searchSourceJSON.index","type":"index-pattern"}],"type":"visualization","updated_at":"2022-08-17T20:29:28.769Z","version":"WzEzNDksMV0="} {"attributes":{"description":"","hits":0,"kibanaSavedObjectMeta":{"searchSourceJSON":"{\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filter\":[]}"},"optionsJSON":"{\"useMargins\":true,\"syncColors\":false,\"hidePanelTitles\":false}","panelsJSON":"[{\"version\":\"7.17.5\",\"type\":\"visualization\",\"gridData\":{\"x\":24,\"y\":0,\"w\":24,\"h\":15,\"i\":\"ad02c99b-8bae-42e0-8a43-d27762f1e607\"},\"panelIndex\":\"ad02c99b-8bae-42e0-8a43-d27762f1e607\",\"embeddableConfig\":{\"enhancements\":{}},\"panelRefName\":\"panel_ad02c99b-8bae-42e0-8a43-d27762f1e607\"},{\"version\":\"7.17.5\",\"type\":\"visualization\",\"gridData\":{\"x\":0,\"y\":0,\"w\":24,\"h\":15,\"i\":\"8412ffc8-b94c-4bbd-aa55-fa670f3fb4ee\"},\"panelIndex\":\"8412ffc8-b94c-4bbd-aa55-fa670f3fb4ee\",\"embeddableConfig\":{\"enhancements\":{}},\"panelRefName\":\"panel_8412ffc8-b94c-4bbd-aa55-fa670f3fb4ee\"}]","timeRestore":false,"title":"dash with legacy map visualizations","version":1},"coreMigrationVersion":"7.17.5","id":"97437d70-1e6b-11ed-833b-a105e9534fa9","migrationVersion":{"dashboard":"7.17.3"},"references":[{"id":"64a5b9f0-1e6b-11ed-833b-a105e9534fa9","name":"ad02c99b-8bae-42e0-8a43-d27762f1e607:panel_ad02c99b-8bae-42e0-8a43-d27762f1e607","type":"visualization"},{"id":"4b073190-1e6b-11ed-833b-a105e9534fa9","name":"8412ffc8-b94c-4bbd-aa55-fa670f3fb4ee:panel_8412ffc8-b94c-4bbd-aa55-fa670f3fb4ee","type":"visualization"}],"type":"dashboard","updated_at":"2022-08-17T20:31:36.656Z","version":"WzE0MzEsMV0="} {"excludedObjects":[],"excludedObjectsCount":0,"exportedCount":4,"missingRefCount":0,"missingReferences":[]} ``` * Open dashboard and verify tile_map renders --------- Co-authored-by: kibanamachine <[email protected]>
- Loading branch information
1 parent
979cb73
commit 4d31e30
Showing
20 changed files
with
145 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
x-pack/plugins/maps/public/legacy_visualizations/tile_map/geo_hash.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* 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 { KBN_FIELD_TYPES } from '@kbn/field-types'; | ||
import { BucketAggType, type IBucketAggConfig } from '@kbn/data-plugin/common'; | ||
|
||
export const GEOHASH_GRID = 'geohash_grid'; | ||
|
||
export const getGeoHashBucketAgg = () => | ||
new BucketAggType<IBucketAggConfig>({ | ||
name: GEOHASH_GRID, | ||
expressionName: '', | ||
title: GEOHASH_GRID, | ||
makeLabel: () => GEOHASH_GRID, | ||
params: [ | ||
{ | ||
name: 'field', | ||
type: 'field', | ||
filterFieldTypes: KBN_FIELD_TYPES.GEO_POINT, | ||
}, | ||
], | ||
getRequestAggs(agg) { | ||
return []; | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* 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 expect from '@kbn/expect'; | ||
import { FtrProviderContext } from '../../../ftr_provider_context'; | ||
|
||
export default function ({ getPageObjects }: FtrProviderContext) { | ||
const PageObjects = getPageObjects(['common', 'visualize', 'lens', 'maps', 'timePicker']); | ||
|
||
describe('tile_map visualization', () => { | ||
before(async () => { | ||
await PageObjects.common.navigateToApp('visualize'); | ||
await PageObjects.visualize.loadSavedVisualization('Visualization TileMap', { | ||
navigateToVisualize: false, | ||
}); | ||
await PageObjects.timePicker.setAbsoluteRange( | ||
PageObjects.timePicker.defaultStartTime, | ||
PageObjects.timePicker.defaultEndTime | ||
); | ||
await PageObjects.maps.waitForLayersToLoad(); | ||
}); | ||
|
||
it('should render tile_map with map embeddable', async () => { | ||
await PageObjects.maps.openLegend(); | ||
await PageObjects.maps.waitForLayersToLoad(); | ||
|
||
expect(await PageObjects.maps.getNumberOfLayers()).to.eql(2); | ||
expect(await PageObjects.maps.doesLayerExist('Visualization TileMap')).to.be(true); | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters