[Maps] fix default buffer is too large (#103950)

* [Maps] fix default buffer is too large

* fix functional test

* update functional test expects for smaller extent area

* update expect

* expect updates for smaller buffer

* expect updates for smaller buffer

* expect update

* update expects

* update expects

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Nathan Reese 2021-07-01 15:20:00 -06:00 committed by GitHub
parent fb20e02192
commit a9dbf80012
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 19 additions and 21 deletions

View file

@ -77,8 +77,8 @@ describe('map_actions', () => {
minLon: 95,
},
buffer: {
maxLat: 21.94305,
maxLon: 112.5,
maxLat: 11.1784,
maxLon: 101.25,
minLat: 0,
minLon: 90,
},
@ -158,10 +158,10 @@ describe('map_actions', () => {
minLon: 85,
},
buffer: {
maxLat: 7.71099,
maxLon: 92.8125,
minLat: -2.81137,
minLon: 82.26563,
maxLat: 5.26601,
maxLon: 90.35156,
minLat: -0.35156,
minLon: 84.72656,
},
},
type: 'MAP_EXTENT_CHANGED',
@ -190,10 +190,10 @@ describe('map_actions', () => {
minLon: 96,
},
buffer: {
maxLat: 13.58192,
maxLon: 103.53516,
minLat: 3.33795,
minLon: 93.33984,
maxLat: 11.0059,
maxLon: 101.07422,
minLat: 5.96575,
minLon: 95.97656,
},
},
type: 'MAP_EXTENT_CHANGED',

View file

@ -60,7 +60,6 @@ import {
Timeslice,
} from '../../common/descriptor_types';
import { INITIAL_LOCATION } from '../../common/constants';
import { scaleBounds } from '../../common/elasticsearch_util';
import { cleanTooltipStateForLayer } from './tooltip_actions';
import { VectorLayer } from '../classes/layers/vector_layer';
import { SET_DRAW_MODE } from './ui_actions';
@ -167,9 +166,8 @@ export function mapExtentChanged(mapExtentState: MapExtentState) {
}
if (!doesBufferContainExtent || currentZoom !== newZoom) {
const expandedExtent = scaleBounds(extent, 0.5);
// snap to the smallest tile-bounds, to avoid jitter in the bounds
dataFilters.buffer = expandToTileBoundaries(expandedExtent, Math.ceil(newZoom));
dataFilters.buffer = expandToTileBoundaries(extent, Math.ceil(newZoom));
}
}

View file

@ -29,7 +29,7 @@ export default function ({ getPageObjects, getService }) {
it('should request documents when zoomed to smaller regions showing less data', async () => {
const { rawResponse: response } = await PageObjects.maps.getResponse();
// Allow a range of hits to account for variances in browser window size.
expect(response.hits.hits.length).to.be.within(35, 45);
expect(response.hits.hits.length).to.be.within(5, 12);
});
it('should request clusters when zoomed to larger regions showing lots of data', async () => {

View file

@ -53,7 +53,7 @@ export default function ({ getPageObjects, getService }) {
describe('inspector', () => {
it('should register elasticsearch request in inspector', async () => {
const hits = await PageObjects.maps.getHits();
expect(hits).to.equal('6');
expect(hits).to.equal('5');
});
});
@ -74,7 +74,7 @@ export default function ({ getPageObjects, getService }) {
const requestStats = await inspector.getTableData();
const hits = PageObjects.maps.getInspectorStatRowHit(requestStats, 'Hits');
await inspector.close();
expect(hits).to.equal('3');
expect(hits).to.equal('2');
});
it('should re-fetch query when "refresh" is clicked', async () => {

View file

@ -59,9 +59,9 @@ export default function ({ getPageObjects, getService }) {
});
it('should not rerequest when zoom changes do not cause geotile_grid precision to change', async () => {
await PageObjects.maps.setView(DATA_CENTER_LAT, DATA_CENTER_LON, 1.2);
await PageObjects.maps.setView(DATA_CENTER_LAT, DATA_CENTER_LON, 1.4);
const beforeSameZoom = await getRequestTimestamp();
await PageObjects.maps.setView(DATA_CENTER_LAT, DATA_CENTER_LON, 1.8);
await PageObjects.maps.setView(DATA_CENTER_LAT, DATA_CENTER_LON, 1.6);
const afterTimestamp = await getRequestTimestamp();
expect(afterTimestamp).to.equal(beforeSameZoom);
});

View file

@ -32,7 +32,7 @@ export default function ({ getPageObjects, getService }) {
it('should fetch layer data when layer is made visible', async () => {
await PageObjects.maps.toggleLayerVisibility('logstash');
const hits = await PageObjects.maps.getHits();
expect(hits).to.equal('6');
expect(hits).to.equal('5');
});
});
}

View file

@ -82,7 +82,7 @@ export default function ({ getPageObjects, getService }) {
const requestStats = await inspector.getTableData();
const hits = PageObjects.maps.getInspectorStatRowHit(requestStats, 'Hits');
await inspector.close();
expect(hits).to.equal('2');
expect(hits).to.equal('1');
});
it('should override query stored with map when query is provided in app state', async () => {
@ -130,7 +130,7 @@ export default function ({ getPageObjects, getService }) {
const requestStats = await inspector.getTableData();
const hits = PageObjects.maps.getInspectorStatRowHit(requestStats, 'Hits');
await inspector.close();
expect(hits).to.equal('2');
expect(hits).to.equal('1');
});
});
});