[Maps] fix point to point source regression (#60930)

* [Maps] fix pew pew regression

* add functional test for pew pew source
This commit is contained in:
Nathan Reese 2020-03-23 13:40:24 -06:00 committed by GitHub
parent 73deba16cc
commit d32c4c8390
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 46 additions and 3 deletions

View file

@ -149,11 +149,14 @@ export class ESSearchSource extends AbstractESSource {
}
renderSourceSettingsEditor({ onChange }) {
const getGeoField = () => {
return this._getGeoField();
};
return (
<UpdateSourceEditor
source={this}
indexPatternId={this.getIndexPatternId()}
getGeoField={this._getGeoField}
getGeoField={getGeoField}
onChange={onChange}
tooltipFields={this._tooltipFields}
sortField={this._descriptor.sortField}

View file

@ -231,7 +231,7 @@ export class AbstractESSource extends AbstractVectorSource {
}
}
_getGeoField = async () => {
async _getGeoField() {
const indexPattern = await this.getIndexPattern();
const geoField = indexPattern.fields.getByName(this._descriptor.geoField);
if (!geoField) {
@ -243,7 +243,7 @@ export class AbstractESSource extends AbstractVectorSource {
);
}
return geoField;
};
}
async getDisplayName() {
try {

View file

@ -0,0 +1,39 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import expect from '@kbn/expect';
export default function({ getPageObjects, getService }) {
const PageObjects = getPageObjects(['maps']);
const inspector = getService('inspector');
const VECTOR_SOURCE_ID = '67c1de2c-2fc5-4425-8983-094b589afe61';
describe('point to point source', () => {
before(async () => {
await PageObjects.maps.loadSavedMap('pew pew demo');
});
it('should request source clusters for destination locations', async () => {
await inspector.open();
await inspector.openInspectorRequestsView();
const requestStats = await inspector.getTableData();
const hits = PageObjects.maps.getInspectorStatRowHit(requestStats, 'Hits');
const totalHits = PageObjects.maps.getInspectorStatRowHit(requestStats, 'Hits (total)');
await inspector.close();
expect(hits).to.equal('0');
expect(totalHits).to.equal('4');
});
it('should render lines', async () => {
const mapboxStyle = await PageObjects.maps.getMapboxStyle();
const features = mapboxStyle.sources[VECTOR_SOURCE_ID].data.features;
expect(features.length).to.equal(2);
expect(features[0].geometry.type).to.equal('LineString');
});
});
}

View file

@ -41,6 +41,7 @@ export default function({ loadTestFile, getService }) {
describe('', function() {
this.tags('ciGroup10');
loadTestFile(require.resolve('./es_geo_grid_source'));
loadTestFile(require.resolve('./es_pew_pew_source'));
loadTestFile(require.resolve('./joins'));
loadTestFile(require.resolve('./add_layer_panel'));
loadTestFile(require.resolve('./import_geojson'));