Skip to content

Commit

Permalink
trying to get maps in order .... wip
Browse files Browse the repository at this point in the history
  • Loading branch information
ppisljar committed Jun 29, 2017
1 parent cd213d3 commit abf0a6d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 18 deletions.
34 changes: 16 additions & 18 deletions src/core_plugins/tile_map/public/maps_visualization.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,13 @@ export function MapsVisualizationProvider(Private, serviceSettings, Notifier, co
this.vis = vis;
this.$el = $(element);
this._$container = this.$el;


this._geohashLayer = null;
this._kibanaMap = null;
this._kibanaMapReady = this._makeKibanaMap();
this._baseLayerDirty = true;
this._dataDirty = true;
this._paramsDirty = true;
this._currentParams = null;
this._updateParams();
}

destroy() {
Expand All @@ -41,21 +38,22 @@ export function MapsVisualizationProvider(Private, serviceSettings, Notifier, co
async render(esResponse) {

return new Promise((resolve) => {
if (esResponse && typeof esResponse.geohashGridAgg === 'undefined') {
this._updateParams();
return resolve();
}
this._updateParams().then(() => {
if (esResponse && typeof esResponse.geohashGridAgg === 'undefined') {
return resolve();
}

//todo: do render complete!
this._dataDirty = true;
this._kibanaMapReady.then(() => {
this._chartData = esResponse;
this._geohashGeoJson = this._chartData.geoJson;
this._recreateGeohashLayer();
this._kibanaMap.useUiStateFromVisualization(this.vis);
this._kibanaMap.resize();
this._dataDirty = false;
this._doRenderComplete(resolve);
this._dataDirty = true;

this._kibanaMapReady.then(() => {
this._chartData = esResponse;
this._geohashGeoJson = this._chartData.geoJson;
this._recreateGeohashLayer();
this._kibanaMap.useUiStateFromVisualization(this.vis);
this._kibanaMap.resize();
this._dataDirty = false;
this._doRenderComplete(resolve);
});
});
});
}
Expand Down Expand Up @@ -169,7 +167,7 @@ export function MapsVisualizationProvider(Private, serviceSettings, Notifier, co
return;
}

this._currentParams = mapParams;
this._currentParams = _.cloneDeep(mapParams);
const { minZoom, maxZoom } = this._getMinMaxZoom();

if (mapParams.wms.enabled) {
Expand Down
6 changes: 6 additions & 0 deletions src/ui/public/visualize/visualization.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@ uiModules
visualization.destroy();
});

if (!$scope.vis.visualizeScope) {
$scope.$watch('visData', () => {
$scope.$emit('render');
});
}

resizeChecker.on('resize', resizeFunction);

function jQueryGetter(selector) {
Expand Down

0 comments on commit abf0a6d

Please sign in to comment.