-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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] Add hiddenLayers option to embeddable map input #54355
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
@@ -244,5 +257,17 @@ export class MapEmbeddable extends Embeddable { | |||
openTOCDetails, | |||
}); | |||
} | |||
|
|||
const hiddenLayerIds = this._store |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for creating actions and selectors. Can you please remove the now unused action TOGGLE_LAYER_VISIBLE
?
@@ -150,6 +150,8 @@ export const getLayerList = createSelector( | |||
} | |||
); | |||
|
|||
export const getHiddenLayers = state => getLayerListRaw(state).filter(layer => !layer.visible); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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);
}
);
@@ -244,5 +248,15 @@ export class MapEmbeddable extends Embeddable { | |||
openTOCDetails, | |||
}); | |||
} | |||
|
|||
const hiddenLayerIds = getHiddenLayers(this._store.getState()) | |||
.map(layer => layer.id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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