Skip to content

Commit 389ab09

Browse files
authored
Merge branch 'next' into geostyler-wms
2 parents 355573f + fe2868a commit 389ab09

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

src/bootstrap.tsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ import {
9797
import { setFeatureInfoActiveCopyTools } from './store/featureInfo';
9898
import {
9999
setLayerTreeActiveUploadTools,
100-
setLayerTreeShowLegends
100+
setLayerTreeShowLegends,
101+
setMetadataVisible
101102
} from './store/layerTree';
102103
import {
103104
setLegal
@@ -281,6 +282,9 @@ const setApplicationToStore = async (application?: Application) => {
281282
if (tool.name === 'tree' && tool.config.showLegends) {
282283
store.dispatch(setLayerTreeShowLegends(tool.config.showLegends));
283284
}
285+
if (tool.name === 'tree' && typeof tool.config.metadataVisible !== 'undefined') {
286+
store.dispatch(setMetadataVisible(tool.config.metadataVisible));
287+
}
284288
});
285289
store.dispatch(setAvailableTools(availableTools));
286290
}

src/components/ToolMenu/LayerTree/LayerTreeContextMenu/index.tsx

+8
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ export const LayerTreeContextMenu: React.FC<LayerTreeContextMenuProps> = ({
108108
const allowedEditMode = useAppSelector(
109109
state => state.editFeature.userEditMode
110110
);
111+
const metadataVisible = useAppSelector(state => state.layerTree.metadataVisible);
111112

112113
useEffect(() => {
113114
if (layer) {
@@ -327,6 +328,13 @@ export const LayerTreeContextMenu: React.FC<LayerTreeContextMenuProps> = ({
327328
key: 'layerDetails'
328329
});
329330

331+
if (metadataVisible) {
332+
dropdownMenuItems.push({
333+
label: t('LayerTreeContextMenu.layerDetails'),
334+
key: 'layerDetails'
335+
});
336+
}
337+
330338
return (
331339
<div
332340
aria-label='layer-context'

src/store/layerTree/index.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export type LayerTreeConfig = {
77
enabled?: boolean;
88
activeUploadTools?: UploadTools[];
99
showLegends?: boolean;
10+
metadataVisible?: boolean;
1011
};
1112

1213
export enum UploadTools {
@@ -17,7 +18,8 @@ export enum UploadTools {
1718
const initialState: LayerTreeConfig = {
1819
enabled: false,
1920
activeUploadTools: [UploadTools.addWMS, UploadTools.dataUpload],
20-
showLegends: false
21+
showLegends: false,
22+
metadataVisible: true
2123
};
2224

2325
export const slice = createSlice({
@@ -35,14 +37,18 @@ export const slice = createSlice({
3537
},
3638
setLayerTreeShowLegends(state, action: PayloadAction<boolean>) {
3739
state.showLegends = action.payload;
40+
},
41+
setMetadataVisible(state, action: PayloadAction<boolean>) {
42+
state.metadataVisible = action.payload;
3843
}
3944
}
4045
});
4146

4247
export const {
4348
setLayerTreeEnabled,
4449
setLayerTreeActiveUploadTools,
45-
setLayerTreeShowLegends
50+
setLayerTreeShowLegends,
51+
setMetadataVisible
4652
} = slice.actions;
4753

4854
export default slice.reducer;

0 commit comments

Comments
 (0)