-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[Maps] Add hiddenLayers option to embeddable map input #54355
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,11 +32,12 @@ import { | |
| hideToolbarOverlay, | ||
| hideLayerControl, | ||
| hideViewControl, | ||
| setHiddenLayers, | ||
| } from '../actions/map_actions'; | ||
| import { setReadOnly, setIsLayerTOCOpen, setOpenTOCDetails } from '../actions/ui_actions'; | ||
| import { getIsLayerTOCOpen, getOpenTOCDetails } from '../selectors/ui_selectors'; | ||
| import { getInspectorAdapters, setEventHandlers } from '../reducers/non_serializable_instances'; | ||
| import { getMapCenter, getMapZoom } from '../selectors/map_selectors'; | ||
| import { getMapCenter, getMapZoom, getHiddenLayers } from '../selectors/map_selectors'; | ||
| import { MAP_SAVED_OBJECT_TYPE } from '../../common/constants'; | ||
|
|
||
| export class MapEmbeddable extends Embeddable { | ||
|
|
@@ -153,6 +154,9 @@ export class MapEmbeddable extends Embeddable { | |
| } | ||
|
|
||
| this._store.dispatch(replaceLayerList(this._layerList)); | ||
| if (this.input.hiddenLayers) { | ||
| this._store.dispatch(setHiddenLayers(this.input.hiddenLayers)); | ||
| } | ||
| this._dispatchSetQuery(this.input); | ||
| this._dispatchSetRefreshConfig(this.input); | ||
|
|
||
|
|
@@ -244,5 +248,15 @@ export class MapEmbeddable extends Embeddable { | |
| openTOCDetails, | ||
| }); | ||
| } | ||
|
|
||
| const hiddenLayerIds = getHiddenLayers(this._store.getState()) | ||
| .map(layer => layer.id) | ||
|
||
| .sort(); | ||
|
|
||
| if (!_.isEqual(this.input.hiddenLayers, hiddenLayerIds)) { | ||
| this.updateInput({ | ||
| hiddenLayers: hiddenLayerIds, | ||
| }); | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -150,6 +150,8 @@ export const getLayerList = createSelector( | |
| } | ||
| ); | ||
|
|
||
| export const getHiddenLayers = state => getLayerListRaw(state).filter(layer => !layer.visible); | ||
|
||
|
|
||
| export const getSelectedLayer = createSelector( | ||
| getSelectedLayerId, | ||
| getLayerList, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.