[Maps] Add hiddenLayers option to embeddable map input#54355
[Maps] Add hiddenLayers option to embeddable map input#54355crob611 merged 3 commits intoelastic:masterfrom
Conversation
nreese
left a comment
There was a problem hiding this comment.
Please update map embeddable input documentation for the new parameter at https://github.com/elastic/kibana/blob/master/x-pack/legacy/plugins/maps/public/embeddable/README.md
| }); | ||
| } | ||
|
|
||
| const hiddenLayerIds = this._store |
There was a problem hiding this comment.
Can you please move this logic to a selector in https://github.com/elastic/kibana/blob/master/x-pack/legacy/plugins/maps/public/selectors/map_selectors.js
|
@nreese updated with changes. Let me know specifically if you think I'm handling the |
nreese
left a comment
There was a problem hiding this comment.
Thanks for creating actions and selectors. Can you please remove the now unused action TOGGLE_LAYER_VISIBLE?
| } | ||
| ); | ||
|
|
||
| export const getHiddenLayers = state => getLayerListRaw(state).filter(layer => !layer.visible); |
There was a problem hiding this comment.
Can you use reselect for this selector definition since it needs to derive its state from getLayerListRaw?
export const getHiddenLayers = createSelector(
getLayerListRaw,
(layerDescriptorList) => {
return layerDescriptorList.filter(layer => !layer.visible);
}
);
| } | ||
|
|
||
| const hiddenLayerIds = getHiddenLayers(this._store.getState()) | ||
| .map(layer => layer.id) |
There was a problem hiding this comment.
Can you move .map and .sort to the selector? The selector should return the data in the format needed here.
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
nreese
left a comment
There was a problem hiding this comment.
Thanks for making all the changes
lgtm
code review
* Add hiddenLayers option to embeddable map input * Move hiddenLayers logic to actions and reducers. Adds Documentation * Address code review suggestions
* master: (69 commits) [Graph] Fix various a11y issues (elastic#54097) Add ApplicationService app status management (elastic#50223) logs in one time (elastic#54447) Deprecate using `elasticsearch.ssl.certificate` without `elasticsearch.ssl.key` and vice versa (elastic#54392) [Optimizer] Fix a stack overflow with watch_cache when it attempts to delete very large folders. (elastic#54457) Security - Role Mappings UI (elastic#53620) [SIEM] [Detection engine] Permission II (elastic#54292) Allow User to Cleanup Repository from UI (elastic#53047) [Detection engine] Some UX for rule creation (elastic#54471) share specific instances of some ui packages (elastic#54079) [ML] APM modules configs for RUM Javascript and NodeJS (elastic#53792) [APM] Delay rendering invalid license notification (elastic#53924) [Graph] Improve error message on graph requests (elastic#54230) [ILM] Kibana should allow a min_age setting of 0ms in ILM policy phases (elastic#53719) Unit Tests for common/lib (elastic#53736) [Graph] Only show explorable fields (elastic#54101) remove linting rule exception for markdown (elastic#54232) [Monitoring] Fetch shard data more efficiently (elastic#54028) [Maps] Add hiddenLayers option to embeddable map input (elastic#54355) Pass termOrder and hasTermsAgg properties to serializeThresholdWatch function (elastic#54391) ...
* master: (69 commits) [Graph] Fix various a11y issues (elastic#54097) Add ApplicationService app status management (elastic#50223) logs in one time (elastic#54447) Deprecate using `elasticsearch.ssl.certificate` without `elasticsearch.ssl.key` and vice versa (elastic#54392) [Optimizer] Fix a stack overflow with watch_cache when it attempts to delete very large folders. (elastic#54457) Security - Role Mappings UI (elastic#53620) [SIEM] [Detection engine] Permission II (elastic#54292) Allow User to Cleanup Repository from UI (elastic#53047) [Detection engine] Some UX for rule creation (elastic#54471) share specific instances of some ui packages (elastic#54079) [ML] APM modules configs for RUM Javascript and NodeJS (elastic#53792) [APM] Delay rendering invalid license notification (elastic#53924) [Graph] Improve error message on graph requests (elastic#54230) [ILM] Kibana should allow a min_age setting of 0ms in ILM policy phases (elastic#53719) Unit Tests for common/lib (elastic#53736) [Graph] Only show explorable fields (elastic#54101) remove linting rule exception for markdown (elastic#54232) [Monitoring] Fetch shard data more efficiently (elastic#54028) [Maps] Add hiddenLayers option to embeddable map input (elastic#54355) Pass termOrder and hasTermsAgg properties to serializeThresholdWatch function (elastic#54391) ...
* Add hiddenLayers option to embeddable map input * Move hiddenLayers logic to actions and reducers. Adds Documentation * Address code review suggestions Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Summary
This PR allows a MapEmbeddable to accept a new key on its input
hiddenLayers. This array of ids are used to set the initial visibility of all of the maps layers.The use case for this is in Canvas, when a map is embedded and layers are made visible or invisible, we want capture those state changes in the expression backing the embed, so that the map can be configured and remain consistent on reloading of the workpad.
This PR only includes the changes to map embeddable, but if you would like to see it in action, you can check out this branch which integrates this with canvas so that toggling layers will be represented in the expression https://github.com/crob611/kibana/tree/map-embeddable-hidden-layers