mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[5.x] Backport. save center and zoom in region map. (#13171)
This commit is contained in:
parent
b71f541f78
commit
17086c83bb
2 changed files with 20 additions and 6 deletions
|
@ -9,11 +9,15 @@ import AggResponsePointSeriesTooltipFormatterProvider from './tooltip_formatter'
|
|||
import { ResizeCheckerProvider } from 'ui/resize_checker';
|
||||
import 'ui/vis_maps/lib/service_settings';
|
||||
|
||||
|
||||
const module = uiModules.get('kibana/region_map', ['kibana']);
|
||||
module.controller('KbnRegionMapController', function ($scope, $element, Private, Notifier, getAppState,
|
||||
serviceSettings, config) {
|
||||
|
||||
const DEFAULT_ZOOM_SETTINGS = {
|
||||
zoom: 2,
|
||||
mapCenter: [0, 0]
|
||||
};
|
||||
|
||||
const tooltipFormatter = Private(AggResponsePointSeriesTooltipFormatterProvider);
|
||||
const ResizeChecker = Private(ResizeCheckerProvider);
|
||||
const notify = new Notifier({ location: 'Region map' });
|
||||
|
@ -90,10 +94,19 @@ module.controller('KbnRegionMapController', function ($scope, $element, Private,
|
|||
async function makeKibanaMap() {
|
||||
const tmsSettings = await serviceSettings.getTMSService();
|
||||
const minMaxZoom = tmsSettings.getMinMaxZoom(false);
|
||||
kibanaMap = new KibanaMap($element[0], minMaxZoom);
|
||||
const url = tmsSettings.getUrl();
|
||||
const options = tmsSettings.getTMSOptions();
|
||||
kibanaMap.setBaseLayer({ baseLayerType: 'tms', options: { url, ...options } });
|
||||
|
||||
const options = { ...minMaxZoom };
|
||||
const uiState = $scope.vis.getUiState();
|
||||
const zoomFromUiState = parseInt(uiState.get('mapZoom'));
|
||||
const centerFromUIState = uiState.get('mapCenter');
|
||||
options.zoom = !isNaN(zoomFromUiState) ? zoomFromUiState : DEFAULT_ZOOM_SETTINGS.zoom;
|
||||
options.center = centerFromUIState ? centerFromUIState : DEFAULT_ZOOM_SETTINGS.mapCenter;
|
||||
kibanaMap = new KibanaMap($element[0], options);
|
||||
|
||||
|
||||
const tmsUrl = tmsSettings.getUrl();
|
||||
const tmsOptions = tmsSettings.getTMSOptions();
|
||||
kibanaMap.setBaseLayer({ baseLayerType: 'tms', options: { tmsUrl, ...tmsOptions } });
|
||||
kibanaMap.addLegendControl();
|
||||
kibanaMap.addFitControl();
|
||||
kibanaMap.persistUiStateForVisualization($scope.vis);
|
||||
|
|
|
@ -4,10 +4,11 @@ module.exports = function (grunt) {
|
|||
const resolve = require('path').resolve;
|
||||
const directory = resolve(__dirname, '../../esvm');
|
||||
const dataDir = resolve(directory, 'data_dir');
|
||||
const pkgBranch = grunt.config.get('pkg.branch');
|
||||
|
||||
return {
|
||||
options: {
|
||||
branch: '5.x',
|
||||
branch: pkgBranch,
|
||||
fresh: !grunt.option('esvm-no-fresh'),
|
||||
config: {
|
||||
http: {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue