From 56c446bc33ba4338baec87638b25508035d1ed66 Mon Sep 17 00:00:00 2001 From: Rohit Gautam Date: Fri, 15 Nov 2024 17:51:20 +0545 Subject: [PATCH 1/2] fix: disable layer in identify if it"s group is invisible --- web/client/epics/__tests__/identify-test.js | 36 +++++++++++++++++++++ web/client/epics/identify.js | 12 +++++-- 2 files changed, 45 insertions(+), 3 deletions(-) diff --git a/web/client/epics/__tests__/identify-test.js b/web/client/epics/__tests__/identify-test.js index 7850e04d0f..4cfedef76a 100644 --- a/web/client/epics/__tests__/identify-test.js +++ b/web/client/epics/__tests__/identify-test.js @@ -146,6 +146,42 @@ describe('identify Epics', () => { }, state); }); + it('getFeatureInfoOnFeatureInfoClick, no queryable if layer is visible but it"s group is invisible', (done)=>{ + // remove previous hook + registerHook('RESOLUTION_HOOK', undefined); + const state = { + map: TEST_MAP_STATE, + mapInfo: { + clickPoint: { latlng: { lat: 36.95, lng: -79.84 } } + }, + layers: { + flat: [{ + id: "TEST", + name: "TEST", + "title": "TITLE", + type: "wfs", + visibility: true, + url: 'base/web/client/test-resources/featureInfo-response.json', + group: "TEST_GROUP" + }], + groups: [ + { + id: "TEST_GROUP", + title: "TEST_GROUP", + visibility: false + } + ] + } + }; + const sentActions = [featureInfoClick({ latlng: { lat: 36.95, lng: -79.84 } })]; + testEpic(getFeatureInfoOnFeatureInfoClick, 2, sentActions, ([a0, a1]) => { + expect(a0.type).toBe(PURGE_MAPINFO_RESULTS); + expect(a1.type).toBe(NO_QUERYABLE_LAYERS); + done(); + }, state); + + }); + it('getFeatureInfoOnFeatureInfoClick WMS', (done) => { // remove previous hook registerHook('RESOLUTION_HOOK', undefined); diff --git a/web/client/epics/identify.js b/web/client/epics/identify.js index 2ce441c643..75882b1424 100644 --- a/web/client/epics/identify.js +++ b/web/client/epics/identify.js @@ -41,7 +41,7 @@ import { itemIdSelector, overrideParamsSelector, filterNameListSelector, currentEditFeatureQuerySelector, mapTriggerSelector, enableInfoForSelectedLayersSelector } from '../selectors/mapInfo'; -import { centerToMarkerSelector, getSelectedLayers, layersSelector, queryableLayersSelector, queryableSelectedLayersSelector, selectedNodesSelector } from '../selectors/layers'; +import { centerToMarkerSelector, getSelectedLayers, layersSelector, queryableLayersSelector, queryableSelectedLayersSelector, rawGroupsSelector, selectedNodesSelector } from '../selectors/layers'; import { modeSelector, getAttributeFilters, isFeatureGridOpen } from '../selectors/featuregrid'; import { spatialFieldSelector } from '../selectors/queryform'; import { mapSelector, projectionDefsSelector, projectionSelector, isMouseMoveIdentifyActiveSelector } from '../selectors/map'; @@ -64,6 +64,7 @@ const stopFeatureInfo = state => stopGetFeatureInfoSelector(state) || isFeatureG import {getFeatureInfo} from '../api/identify'; import { VISUALIZATION_MODE_CHANGED } from '../actions/maptype'; import {updatePointWithGeometricFilter} from "../utils/IdentifyUtils"; +import { getDerivedLayersVisibility } from '../utils/LayersUtils'; /** * Epics for Identify and map info @@ -76,14 +77,19 @@ import {updatePointWithGeometricFilter} from "../utils/IdentifyUtils"; export const getFeatureInfoOnFeatureInfoClick = (action$, { getState = () => { } }) => action$.ofType(FEATURE_INFO_CLICK) .switchMap(({ point, filterNameList = [], overrideParams = {}, ignoreVisibilityLimits }) => { + const groups = rawGroupsSelector(getState()); + // ignoreVisibilityLimits is for ignore limits of layers visibility // Reverse - To query layer in same order as in TOC - let queryableLayers = ignoreVisibilityLimits ? reverse([...layersSelector(getState())].filter(l=>defaultQueryableFilter(l))) : reverse(queryableLayersSelector(getState())); - const queryableSelectedLayers = ignoreVisibilityLimits ? [...getSelectedLayers(getState())].filter(l => defaultQueryableFilter(l)) : queryableSelectedLayersSelector(getState()); + let queryableLayers = ignoreVisibilityLimits ? reverse(getDerivedLayersVisibility([...layersSelector(getState())], groups).filter(l=>defaultQueryableFilter(l))) : reverse(getDerivedLayersVisibility(queryableLayersSelector(getState()), groups)); + const queryableSelectedLayers = ignoreVisibilityLimits ? getDerivedLayersVisibility([...getSelectedLayers(getState())].filter(l => defaultQueryableFilter(l)), groups) : getDerivedLayersVisibility(queryableSelectedLayersSelector(getState()), groups); const enableInfoForSelectedLayers = enableInfoForSelectedLayersSelector(getState()); if (enableInfoForSelectedLayers && queryableSelectedLayers.length) { queryableLayers = queryableSelectedLayers; } + // remove invisible layers, visible layer with invisible group already converted to invisible layer using getDerivedLayersVisibility + queryableLayers = queryableLayers.filter(l=>l.visibility); + const selectedLayers = selectedNodesSelector(getState()); From ea711b833b96acdc9a2250efdb1fd3213f91b40b Mon Sep 17 00:00:00 2001 From: Rohit Gautam Date: Fri, 15 Nov 2024 17:52:41 +0545 Subject: [PATCH 2/2] fix: DS_Store in gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 3d297a0ee3..e123098707 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,4 @@ web/docs debug.log .vscode/settings.json site +.DS_Store