mirror of
https://github.com/elastic/kibana.git
synced 2025-04-25 02:09:32 -04:00
[maps] fix layer error in map embeddable error makes map unusable (#155885)
Fixes https://github.com/elastic/kibana/issues/155773 https://github.com/elastic/kibana/pull/134243 surfaced layer errors as `output.error`. This was a mistake and caused map embeddable to render only the layer error instead of the map <img width="500" alt="Screen Shot 2023-04-26 at 7 27 00 AM" src="https://user-images.githubusercontent.com/373691/234602920-4d063a4b-bc02-4fac-9037-0774a790b471.png"> PR resolves issue by no longer surfacing layer errors as `output.error`. The map legend does a great job of surfacing individual layer errors and still keeps the map usable. <img width="500" alt="Screen Shot 2023-04-26 at 7 26 42 AM" src="https://user-images.githubusercontent.com/373691/234603008-8c24674f-21ca-4046-88ed-b1f7b5a06b5b.png"> To test * install web log sample data * Add runtime geo point field to data view * create and save map with runtime geo point field. * remove runtime field from data view * add map to dashboard. Verify map is displayed and error is surfaced in map legend --------- Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
0a119b63bd
commit
1b64cfa641
2 changed files with 6 additions and 17 deletions
|
@ -408,7 +408,7 @@ export class AbstractESSource extends AbstractVectorSource implements IESSource
|
|||
if (!geoField) {
|
||||
throw new Error(
|
||||
i18n.translate('xpack.maps.source.esSource.noGeoFieldErrorMessage', {
|
||||
defaultMessage: `Data view "{indexPatternLabel}"" no longer contains the geo field "{geoField}"`,
|
||||
defaultMessage: `Data view "{indexPatternLabel}" no longer contains the geo field "{geoField}"`,
|
||||
values: { indexPatternLabel: indexPattern.getName(), geoField: this.getGeoFieldName() },
|
||||
})
|
||||
);
|
||||
|
|
|
@ -794,7 +794,6 @@ export class MapEmbeddable
|
|||
}
|
||||
|
||||
const hiddenLayerIds = getHiddenLayerIds(this._savedMap.getStore().getState());
|
||||
|
||||
if (!_.isEqual(this.input.hiddenLayers, hiddenLayerIds)) {
|
||||
this.updateInput({
|
||||
hiddenLayers: hiddenLayerIds,
|
||||
|
@ -802,14 +801,7 @@ export class MapEmbeddable
|
|||
}
|
||||
|
||||
const isLoading = isMapLoading(this._savedMap.getStore().getState());
|
||||
const firstLayerWithError = getLayerList(this._savedMap.getStore().getState()).find((layer) => {
|
||||
return layer.hasErrors();
|
||||
});
|
||||
const output = this.getOutput();
|
||||
if (
|
||||
output.loading !== isLoading ||
|
||||
firstLayerWithError?.getErrors() !== output.error?.message
|
||||
) {
|
||||
if (this.getOutput().loading !== isLoading) {
|
||||
/**
|
||||
* Maps emit rendered when the data is loaded, as we don't have feedback from the maps rendering library atm.
|
||||
* This means that the DASHBOARD_LOADED_EVENT event might be fired while a map is still rendering in some cases.
|
||||
|
@ -817,13 +809,10 @@ export class MapEmbeddable
|
|||
*/
|
||||
this.updateOutput({
|
||||
loading: isLoading,
|
||||
rendered: !isLoading && firstLayerWithError === undefined,
|
||||
error: firstLayerWithError
|
||||
? {
|
||||
name: 'EmbeddableError',
|
||||
message: firstLayerWithError.getErrors(),
|
||||
}
|
||||
: undefined,
|
||||
rendered: !isLoading,
|
||||
// do not surface layer errors as output.error
|
||||
// output.error blocks entire embeddable display and prevents map from displaying
|
||||
// layer errors are better surfaced in legend while still keeping the map usable
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue