-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Region map visualization #10937
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
Region map visualization #10937
Changes from 48 commits
1107f0c
5e9e79a
4544daa
b6de16e
9b1a943
f6f966d
a0c88fb
b392eb4
58ba775
8c56bbc
457cfcc
3bbcf46
966b641
b9572a5
7524634
0446b84
34801b8
9659efc
d010705
45737ba
c7b4e91
d897daf
c527dec
4b97689
3569b39
424a507
f7b54c3
94c2e54
edda3d6
92b674e
3cac581
1885256
b36f895
7915fc6
ecbee2b
9010b42
2cfabf5
ae4bcc2
fbddb91
333c2a7
7cd8065
dd91337
6bdf4d5
c3045b1
4efb34f
16c3bf2
a45b6b7
91e2ffb
c739884
5c75704
91c5ac2
f462397
a4c3a5c
ab4fe96
fa93788
5122ce1
59cf9df
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| [1mdiff --git a/src/core_plugins/region_map/public/region_map_controller.js b/src/core_plugins/region_map/public/region_map_controller.js[m | ||
| [1mindex 90e0e74..0245f51 100644[m | ||
| [1m--- a/src/core_plugins/region_map/public/region_map_controller.js[m | ||
| [1m+++ b/src/core_plugins/region_map/public/region_map_controller.js[m | ||
| [36m@@ -28,23 +28,6 @@[m [mmodule.controller('KbnRegionMapController', function ($scope, $element, Private,[m | ||
| let choroplethLayer = null;[m | ||
| const kibanaMapReady = makeKibanaMap();[m | ||
| [m | ||
| [31m- serviceSettings.getFileLayers()[m | ||
| [31m- .then(function (layersFromService) {[m | ||
| [31m- const newVectorLayers = $scope.vis.type.params.vectorLayers.slice();[m | ||
| [31m- for (let i = 0; i < layersFromService.length; i += 1) {[m | ||
| [31m- const layerFromService = layersFromService[i];[m | ||
| [31m- const alreadyAdded = newVectorLayers.some((layer) =>_.eq(layerFromService, layer));[m | ||
| [31m- if (!alreadyAdded) {[m | ||
| [31m- newVectorLayers.push(layerFromService);[m | ||
| [31m- }[m | ||
| [31m- }[m | ||
| [31m- $scope.vis.type.params.vectorLayers = newVectorLayers;[m | ||
| [31m- $scope.$apply();[m | ||
| [31m- })[m | ||
| [31m- .catch(function (error) {[m | ||
| [31m- notify.warning(error.message);[m | ||
| [31m- });[m | ||
| [31m-[m | ||
| $scope.$watch('esResponse', async function (response) {[m | ||
| kibanaMapReady.then(() => {[m | ||
| const metricsAgg = _.first($scope.vis.aggs.bySchemaName.metric);[m | ||
| [1mdiff --git a/src/core_plugins/region_map/public/region_map_vis_params.js b/src/core_plugins/region_map/public/region_map_vis_params.js[m | ||
| [1mindex 821c8a7..8d961be 100644[m | ||
| [1m--- a/src/core_plugins/region_map/public/region_map_vis_params.js[m | ||
| [1m+++ b/src/core_plugins/region_map/public/region_map_vis_params.js[m | ||
| [36m@@ -1,19 +1,54 @@[m | ||
| import { uiModules } from 'ui/modules';[m | ||
| import regionMapVisParamsTemplate from './region_map_vis_params.html';[m | ||
| [32m+[m[32mimport _ from 'lodash';[m | ||
| [m | ||
| uiModules.get('kibana/region_map')[m | ||
| [31m- .directive('regionMapVisParams', function () {[m | ||
| [32m+[m[32m .directive('regionMapVisParams', function (serviceSettings, Notifier) {[m | ||
| [32m+[m | ||
| [32m+[m | ||
| [32m+[m[32m const notify = new Notifier({ location: 'Region map' });[m | ||
| [32m+[m | ||
| return {[m | ||
| restrict: 'E',[m | ||
| template: regionMapVisParamsTemplate,[m | ||
| link: function ($scope) {[m | ||
| [32m+[m | ||
| [32m+[m | ||
| [32m+[m[32m console.log('calling the linker function...');[m | ||
| [32m+[m | ||
| $scope.onLayerChange = onLayerChange;[m | ||
| [31m- $scope.$watch('vis.type.params.vectorLayers', () => {[m | ||
| [31m- if ($scope.vis.type.params.vectorLayers[0] && !$scope.vis.params.selectedLayer) {[m | ||
| [31m- $scope.vis.params.selectedLayer = $scope.vis.type.params.vectorLayers[0];[m | ||
| [31m- onLayerChange();[m | ||
| [31m- }[m | ||
| [31m- });[m | ||
| [32m+[m | ||
| [32m+[m | ||
| [32m+[m[32m serviceSettings.getFileLayers()[m | ||
| [32m+[m[32m .then(function (layersFromService) {[m | ||
| [32m+[m | ||
| [32m+[m[32m const newVectorLayers = $scope.vis.type.params.vectorLayers.slice();[m | ||
| [32m+[m[32m for (let i = 0; i < layersFromService.length; i += 1) {[m | ||
| [32m+[m[32m const layerFromService = layersFromService[i];[m | ||
| [32m+[m[32m const alreadyAdded = newVectorLayers.some((layer) =>_.eq(layerFromService, layer));[m | ||
| [32m+[m[32m if (!alreadyAdded) {[m | ||
| [32m+[m[32m newVectorLayers.push(layerFromService);[m | ||
| [32m+[m[32m }[m | ||
| [32m+[m[32m }[m | ||
| [32m+[m | ||
| [32m+[m[32m $scope.vis.type.params.vectorLayers = newVectorLayers;[m | ||
| [32m+[m | ||
| [32m+[m[32m if ($scope.vis.type.params.vectorLayers[0] && !$scope.vis.params.selectedLayer) {[m | ||
| [32m+[m[32m $scope.vis.params.selectedLayer = $scope.vis.type.params.vectorLayers[0];[m | ||
| [32m+[m[32m onLayerChange();[m | ||
| [32m+[m[32m }[m | ||
| [32m+[m | ||
| [32m+[m | ||
| [32m+[m[32m //the dirty flag is set to true because the change in vector layers config causes an update of the scope.params[m | ||
| [32m+[m[32m //temp work-around. addressing this issue with the visualize refactor for 6.0[m | ||
| [32m+[m[32m setTimeout(function () {[m | ||
| [32m+[m[32m $scope.dirty = false;[m | ||
| [32m+[m[32m }, 0);[m | ||
| [32m+[m | ||
| [32m+[m[32m })[m | ||
| [32m+[m[32m .catch(function (error) {[m | ||
| [32m+[m[32m notify.warning(error.message);[m | ||
| [32m+[m[32m });[m | ||
| [m | ||
| function onLayerChange() {[m | ||
| $scope.vis.params.selectedJoinField = $scope.vis.params.selectedLayer.fields[0];[m | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| import _ from 'lodash'; | ||
|
|
||
| export function injectVars(server) { | ||
| const serverConfig = server.config(); | ||
|
|
||
|
|
@@ -6,13 +8,20 @@ export function injectVars(server) { | |
| //keeping this logic for backward compatibilty. | ||
| const configuredUrl = server.config().get('tilemap.url'); | ||
| const isOverridden = typeof configuredUrl === 'string' && configuredUrl !== ''; | ||
| const tilemapConfig = serverConfig.get('tilemap'); | ||
| const tilemapConfig = _.cloneDeep(serverConfig.get('tilemap')); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's your reasoning for cloning these settings? It's my understanding that these |
||
| const vectormapsConfig = _.cloneDeep(serverConfig.get('regionmap')); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A remnant of the vectormaps naming, should be regionmapsConfig. |
||
| const mapConfig = _.cloneDeep(serverConfig.get('map')); | ||
|
|
||
|
|
||
| vectormapsConfig.layers = (vectormapsConfig.layers) ? vectormapsConfig.layers : []; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Generally, I've seen us using the The |
||
|
|
||
| return { | ||
| kbnDefaultAppId: serverConfig.get('kibana.defaultAppId'), | ||
| vectormapsConfig: vectormapsConfig, | ||
| mapConfig: mapConfig, | ||
| tilemapsConfig: { | ||
| deprecated: { | ||
| isOverridden, | ||
| isOverridden: isOverridden, | ||
| config: tilemapConfig, | ||
| }, | ||
| manifestServiceUrl: serverConfig.get('tilemap.manifestServiceUrl') | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| export default function (kibana) { | ||
|
|
||
| return new kibana.Plugin({ | ||
| uiExports: { | ||
| visTypes: ['plugins/region_map/region_map_vis'] | ||
| } | ||
| }); | ||
|
|
||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "name": "region_map", | ||
| "version": "kibana" | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty sure this file was accidentally checked in.