diff --git a/src/bootstrap.tsx b/src/bootstrap.tsx index d5a7afb0a..83c5dd462 100644 --- a/src/bootstrap.tsx +++ b/src/bootstrap.tsx @@ -97,7 +97,8 @@ import { import { setFeatureInfoActiveCopyTools } from './store/featureInfo'; import { setLayerTreeActiveUploadTools, - setLayerTreeShowLegends + setLayerTreeShowLegends, + setMetadataVisible } from './store/layerTree'; import { setLegal @@ -281,6 +282,9 @@ const setApplicationToStore = async (application?: Application) => { if (tool.name === 'tree' && tool.config.showLegends) { store.dispatch(setLayerTreeShowLegends(tool.config.showLegends)); } + if (tool.name === 'tree' && typeof tool.config.metadataVisible !== 'undefined') { + store.dispatch(setMetadataVisible(tool.config.metadataVisible)); + } }); store.dispatch(setAvailableTools(availableTools)); } diff --git a/src/components/ToolMenu/LayerTree/LayerTreeContextMenu/index.tsx b/src/components/ToolMenu/LayerTree/LayerTreeContextMenu/index.tsx index 89f318099..2ac93d78b 100644 --- a/src/components/ToolMenu/LayerTree/LayerTreeContextMenu/index.tsx +++ b/src/components/ToolMenu/LayerTree/LayerTreeContextMenu/index.tsx @@ -108,6 +108,7 @@ export const LayerTreeContextMenu: React.FC = ({ const allowedEditMode = useAppSelector( state => state.editFeature.userEditMode ); + const metadataVisible = useAppSelector(state => state.layerTree.metadataVisible); useEffect(() => { if (layer) { @@ -327,6 +328,13 @@ export const LayerTreeContextMenu: React.FC = ({ key: 'layerDetails' }); + if (metadataVisible) { + dropdownMenuItems.push({ + label: t('LayerTreeContextMenu.layerDetails'), + key: 'layerDetails' + }); + } + return (
) { state.showLegends = action.payload; + }, + setMetadataVisible(state, action: PayloadAction) { + state.metadataVisible = action.payload; } } }); @@ -42,7 +47,8 @@ export const slice = createSlice({ export const { setLayerTreeEnabled, setLayerTreeActiveUploadTools, - setLayerTreeShowLegends + setLayerTreeShowLegends, + setMetadataVisible } = slice.actions; export default slice.reducer;