Skip to content

Commit

Permalink
Merge branch 'next' into geostyler-wms
Browse files Browse the repository at this point in the history
  • Loading branch information
FritzHoing authored Nov 22, 2024
2 parents 355573f + fe2868a commit 389ab09
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/bootstrap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ import {
import { setFeatureInfoActiveCopyTools } from './store/featureInfo';
import {
setLayerTreeActiveUploadTools,
setLayerTreeShowLegends
setLayerTreeShowLegends,
setMetadataVisible
} from './store/layerTree';
import {
setLegal
Expand Down Expand Up @@ -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));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export const LayerTreeContextMenu: React.FC<LayerTreeContextMenuProps> = ({
const allowedEditMode = useAppSelector(
state => state.editFeature.userEditMode
);
const metadataVisible = useAppSelector(state => state.layerTree.metadataVisible);

useEffect(() => {
if (layer) {
Expand Down Expand Up @@ -327,6 +328,13 @@ export const LayerTreeContextMenu: React.FC<LayerTreeContextMenuProps> = ({
key: 'layerDetails'
});

if (metadataVisible) {
dropdownMenuItems.push({
label: t('LayerTreeContextMenu.layerDetails'),
key: 'layerDetails'
});
}

return (
<div
aria-label='layer-context'
Expand Down
10 changes: 8 additions & 2 deletions src/store/layerTree/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export type LayerTreeConfig = {
enabled?: boolean;
activeUploadTools?: UploadTools[];
showLegends?: boolean;
metadataVisible?: boolean;
};

export enum UploadTools {
Expand All @@ -17,7 +18,8 @@ export enum UploadTools {
const initialState: LayerTreeConfig = {
enabled: false,
activeUploadTools: [UploadTools.addWMS, UploadTools.dataUpload],
showLegends: false
showLegends: false,
metadataVisible: true
};

export const slice = createSlice({
Expand All @@ -35,14 +37,18 @@ export const slice = createSlice({
},
setLayerTreeShowLegends(state, action: PayloadAction<boolean>) {
state.showLegends = action.payload;
},
setMetadataVisible(state, action: PayloadAction<boolean>) {
state.metadataVisible = action.payload;
}
}
});

export const {
setLayerTreeEnabled,
setLayerTreeActiveUploadTools,
setLayerTreeShowLegends
setLayerTreeShowLegends,
setMetadataVisible
} = slice.actions;

export default slice.reducer;

0 comments on commit 389ab09

Please sign in to comment.