[Maps] fix Maps should display better error message instead of EsError when there is no data for tracks data source (#88847)
This commit is contained in:
parent
edb338a8ad
commit
f0f192c654
|
@ -9,7 +9,12 @@ import React from 'react';
|
||||||
|
|
||||||
import { GeoJsonProperties } from 'geojson';
|
import { GeoJsonProperties } from 'geojson';
|
||||||
import { i18n } from '@kbn/i18n';
|
import { i18n } from '@kbn/i18n';
|
||||||
import { FIELD_ORIGIN, SOURCE_TYPES, VECTOR_SHAPE_TYPE } from '../../../../common/constants';
|
import {
|
||||||
|
EMPTY_FEATURE_COLLECTION,
|
||||||
|
FIELD_ORIGIN,
|
||||||
|
SOURCE_TYPES,
|
||||||
|
VECTOR_SHAPE_TYPE,
|
||||||
|
} from '../../../../common/constants';
|
||||||
import { getField, addFieldToDSL } from '../../../../common/elasticsearch_util';
|
import { getField, addFieldToDSL } from '../../../../common/elasticsearch_util';
|
||||||
import {
|
import {
|
||||||
ESGeoLineSourceDescriptor,
|
ESGeoLineSourceDescriptor,
|
||||||
|
@ -216,6 +221,18 @@ export class ESGeoLineSource extends AbstractESAggSource {
|
||||||
);
|
);
|
||||||
const totalEntities = _.get(entityResp, 'aggregations.totalEntities.value', 0);
|
const totalEntities = _.get(entityResp, 'aggregations.totalEntities.value', 0);
|
||||||
const areEntitiesTrimmed = entityBuckets.length >= MAX_TRACKS;
|
const areEntitiesTrimmed = entityBuckets.length >= MAX_TRACKS;
|
||||||
|
if (totalEntities === 0) {
|
||||||
|
return {
|
||||||
|
data: EMPTY_FEATURE_COLLECTION,
|
||||||
|
meta: {
|
||||||
|
areResultsTrimmed: false,
|
||||||
|
areEntitiesTrimmed: false,
|
||||||
|
entityCount: 0,
|
||||||
|
numTrimmedTracks: 0,
|
||||||
|
totalEntities: 0,
|
||||||
|
} as ESGeoLineSourceResponseMeta,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Fetch tracks
|
// Fetch tracks
|
||||||
|
|
Loading…
Reference in a new issue