[maps] only show vector tile inspector panel when map uses elasticsearch vector tile API (#170043)

Closes https://github.com/elastic/kibana/issues/170042

PR disables vector tile adapter when map does not contain vector tile
layers

### Test
1) create new map
2) add documents layer
3) set scaling to "limit to 10000"
4) open inspector. Notice inspector only displays request adapter
5) change scaling to "vector tiles"
6) open inspector. Notice inspector displays vector tile adapter and
request adapter

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Nathan Reese 2023-10-30 12:06:23 -06:00 committed by GitHub
parent 4493efa9a9
commit dbc64e526e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View file

@ -22,6 +22,10 @@ export class VectorTileAdapter extends EventEmitter {
this._onChange();
}
hasLayers() {
return Object.keys(this._layers).length > 0;
}
setTiles(tiles: Array<{ x: number; y: number; z: number }>) {
this._tiles = tiles;
this._onChange();

View file

@ -23,7 +23,7 @@ export const VectorTileInspectorView = {
defaultMessage: 'View the vector tile search requests used to collect the data',
}),
shouldShow(adapters: Adapters) {
return Boolean(adapters.vectorTiles);
return Boolean(adapters.vectorTiles?.hasLayers());
},
component: (props: { adapters: Adapters }) => {
return <LazyWrapper getLazyComponent={getLazyComponent} lazyComponentProps={props} />;