Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Maps] [Embeddables] Provide ability to retrieve number of features for a given layer #49236

Closed
spong opened this issue Oct 24, 2019 · 1 comment · Fixed by #49373
Closed
Labels
[Deprecated-Use Team:Presentation]Team:Geo Former Team Label for Geo Team. Now use Team:Presentation discuss Feature:Embedding Embedding content via iFrame

Comments

@spong
Copy link
Member

spong commented Oct 24, 2019

Feature request

This feature request is for providing the ability to retrieve the number of features for a given layer from a Map Embeddable. Similar to #43695, which requests the ability to know when a layer is loading, this would allow those working with Map Embeddables additional flexibility in providing user-facing features around layer state.

Use case

The impetus for this came from #47706, which aims to add targeted documentation for how to configure line data on the SIEM Pewpew Map. Knowing whether or not the line layers had any features would allow us to programmatically display an additional documentation/configuration UI element instead of having to show it at all times.

Implementation

Similar to the custom tooltip implementation (#46150), an onLayerStateChange callback could be provided to the MapEmbeddableFactory. E.g.

interface LayerState {
  name: string;
  id: string;
  isLoading: boolean;
  isHidden: boolean;
  resultCount: number;
  fitToData(): void;
  hideLayer(): void;
}

const onLayerStateChange = ({ layerStates }: LayerState[]) => {};

const mapEmbeddable = await mapEmbeddableFactory.createFromState({
  state,
  input,
  parent: undefined,
  renderTooltipContent,
  onLayerStateChange,
});

Note: I included the fitToData/hideLayer actions as well, but perhaps these are better fit to be called via the Embeddables Action API?

cc @nreese @stacey-gammon

@spong spong added discuss Feature:Embedding Embedding content via iFrame [Deprecated-Use Team:Presentation]Team:Geo Former Team Label for Geo Team. Now use Team:Presentation labels Oct 24, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-gis (Team:Geo)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Deprecated-Use Team:Presentation]Team:Geo Former Team Label for Geo Team. Now use Team:Presentation discuss Feature:Embedding Embedding content via iFrame
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants