Skip to content

Commit

Permalink
do not store constant defaults in params
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasneirynck committed Jul 27, 2017
1 parent e068fd3 commit a98ea85
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
11 changes: 7 additions & 4 deletions src/core_plugins/region_map/public/region_map_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,21 @@ import { KibanaMap } from '../../tile_map/public/kibana_map';
import ChoroplethLayer from './choropleth_layer';
import { truncatedColorMaps } from 'ui/vislib/components/color/truncated_colormaps';
import AggResponsePointSeriesTooltipFormatterProvider from './tooltip_formatter';
// import '../../tile_map/public/lib/service_settings';
import 'ui/vis/map/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 notify = new Notifier({ location: 'Region map' });


let kibanaMap = null;
let choroplethLayer = null;
const kibanaMapReady = makeKibanaMap();
Expand Down Expand Up @@ -95,8 +98,8 @@ module.controller('KbnRegionMapController', function ($scope, $element, Private,
const uiState = $scope.vis.getUiState();
const zoomFromUiState = parseInt(uiState.get('mapZoom'));
const centerFromUIState = uiState.get('mapCenter');
options.zoom = !isNaN(zoomFromUiState) ? zoomFromUiState : $scope.vis.type.visConfig.defaults.mapZoom;
options.center = centerFromUIState ? centerFromUIState : $scope.vis.type.visConfig.defaults.mapCenter;
options.zoom = !isNaN(zoomFromUiState) ? zoomFromUiState : DEFAULT_ZOOM_SETTINGS.zoom;
options.center = centerFromUIState ? centerFromUIState : DEFAULT_ZOOM_SETTINGS.mapCenter;
kibanaMap = new KibanaMap($element[0], options);


Expand Down
4 changes: 1 addition & 3 deletions src/core_plugins/region_map/public/region_map_vis.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ VisTypesRegistryProvider.register(function RegionMapProvider(Private, regionmaps
addTooltip: true,
colorSchema: 'Yellow to Red',
selectedLayer: selectedLayer,
selectedJoinField: selectedJoinField,
mapZoom: 2,
mapCenter: [0, 0]
selectedJoinField: selectedJoinField
},
template: regionTemplate,
},
Expand Down

0 comments on commit a98ea85

Please sign in to comment.