Skip to content
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

[Backport 2024.01.xx] #10264: Layer visibility limits may prevent the Info panel of search results from opening (#10302, #10325) #10345

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions web/client/actions/__tests__/mapInfo-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,24 @@ describe('Test correctness of the map actions', () => {
expect(action.overrideParams).toBe(overrideParams);
expect(action.itemId).toBe(itemId);
});
it('test featureInfoClick with filterNameList, overrideParams and ignoreVisibilityLimits flag [search service case]', () => {
const point = {latlng: {lat: 1, lng: 3}};
const layer = {id: "layer.1"};
const filterNameList = [];
const itemId = "itemId";
const overrideParams = {cql_filter: "ID_ORIG=1234"};
const ignoreVisibilityLimits = true;

const action = featureInfoClick(point, layer, filterNameList, overrideParams, itemId, ignoreVisibilityLimits);
expect(action).toExist();
expect(action.type).toBe(FEATURE_INFO_CLICK);
expect(action.point).toBe(point);
expect(action.layer).toBe(layer);
expect(action.filterNameList).toBe(filterNameList);
expect(action.overrideParams).toBe(overrideParams);
expect(action.itemId).toBe(itemId);
expect(action.ignoreVisibilityLimits).toBe(ignoreVisibilityLimits);
});
it('reset reverse geocode data', () => {
const e = hideMapinfoRevGeocode();
expect(e).toExist();
Expand Down
6 changes: 4 additions & 2 deletions web/client/actions/mapInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,15 +194,17 @@ export function updateCenterToMarker(status) {
* @param {object[]} [filterNameList=[]] list of layers to perform the GFI request
* @param {object} [overrideParams={}] a map based on name as key and objec as value for overriding request params
* @param {string} [itemId=null] id of the item needed for filtering results
* @param {string} [ignoreVisibilityLimits=false] a boolean flag for ignoring layer visibility limits restrictions to apply GFI
*/
export function featureInfoClick(point, layer, filterNameList = [], overrideParams = {}, itemId = null) {
export function featureInfoClick(point, layer, filterNameList = [], overrideParams = {}, itemId = null, ignoreVisibilityLimits = false) {
return {
type: FEATURE_INFO_CLICK,
point,
layer,
filterNameList,
overrideParams,
itemId
itemId,
ignoreVisibilityLimits
};
}

Expand Down
221 changes: 221 additions & 0 deletions web/client/epics/__tests__/identify-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,227 @@ describe('identify Epics', () => {
}
}, state);
});
it('getFeatureInfoOnFeatureInfoClick WMS ignoring the layer that has visibility limits', (done) => {
// remove previous hook
registerHook('RESOLUTION_HOOK', undefined);
const state = {
map: {present: {...TEST_MAP_STATE.present, resolution: 100000}},
mapInfo: {
clickPoint: { latlng: { lat: 36.95, lng: -79.84 } }
},
layers: {
flat: [{
id: "TEST1",
name: "TEST",
"title": "TITLE",
type: "wms",
visibility: true,
url: 'base/web/client/test-resources/featureInfo-response.json',
minResolution: 500,
maxResolution: 50000
},
{
id: "TEST_NEW",
name: "TEST",
"title": "TITLE New",
type: "wms",
visibility: true,
url: 'base/web/client/test-resources/featureInfo-response.json'
},
{
id: "TEST2",
name: "TEST2",
"title": "TITLE2",
type: "wms",
visibility: true,
url: 'base/web/client/test-resources/featureInfo-response.json'
}]
}
};
const sentActions = [featureInfoClick({ latlng: { lat: 36.95, lng: -79.84 } }, "TEST", ["TEST"], {"TEST": {cql_filter: "id>1"}}, "province_view.5")];
testEpic(getFeatureInfoOnFeatureInfoClick, 3, sentActions, ([a0, a1, a2]) => {
try {
expect(a0).toExist();
expect(a0.type).toBe(PURGE_MAPINFO_RESULTS);
expect(a1).toExist();
expect(a1.type).toBe(NEW_MAPINFO_REQUEST);
expect(a1.reqId).toExist();
expect(a1.request).toExist();
expect(a1.request.cql_filter).toExist();
expect(a1.request.cql_filter).toBe("id>1");
expect(a2).toExist();
expect(a2.type).toBe(LOAD_FEATURE_INFO);
expect(a2.data).toExist();
expect(a2.requestParams).toExist();
expect(a2.reqId).toExist();
expect(a2.layerMetadata.title).toBe(state.layers.flat[1].title); // layer that has no visibility limits
done();
} catch (ex) {
done(ex);
}
}, {...state, mapInfo: {
...state.mapInfo,
itemId: "province_view.5"
}});
});
it('getFeatureInfoOnFeatureInfoClick WMS with ignoreVisibilityLimits flag with true and layers includes visibility limits [search service case]', (done) => {
// remove previous hook
registerHook('RESOLUTION_HOOK', undefined);
const state = {
map: {present: {...TEST_MAP_STATE.present, resolution: 100000}},
mapInfo: {
clickPoint: { latlng: { lat: 36.95, lng: -79.84 } }
},
layers: {
flat: [{
id: "TEST1",
name: "TEST",
"title": "TITLE",
type: "wms",
visibility: true,
url: 'base/web/client/test-resources/featureInfo-response.json',
minResolution: 500,
maxResolution: 50000
},
{
id: "TEST NEW 2",
name: "TEST",
"title": "TITLE NEW 2",
type: "wms",
visibility: true,
url: 'base/web/client/test-resources/featureInfo-response.json',
minResolution: 500,
maxResolution: 50000
},
{
id: "TEST_NEW",
name: "TEST",
"title": "TITLE New",
type: "wms",
visibility: true,
url: 'base/web/client/test-resources/featureInfo-response.json'
},
{
id: "TEST2",
name: "TEST2",
"title": "TITLE2",
type: "wms",
visibility: true,
url: 'base/web/client/test-resources/featureInfo-response.json'
}]
}
};
const ignoreVisibilityLimits = true;
const sentActions = [featureInfoClick({ latlng: { lat: 36.95, lng: -79.84 } }, "TEST", ["TEST"], {"TEST": {cql_filter: "id>1"}}, "province_view.5", ignoreVisibilityLimits)];
testEpic(getFeatureInfoOnFeatureInfoClick, 5, sentActions, ([a0, a1, a2, a3]) => {
try {
expect(a0).toExist();
expect(a0.type).toBe(PURGE_MAPINFO_RESULTS);
expect(a1).toExist();
expect(a1.type).toBe(NEW_MAPINFO_REQUEST);
expect(a1.reqId).toExist();
expect(a1.request).toExist();
expect(a1.request.id).toEqual(state.layers.flat[2].id);
expect(a1.request.cql_filter).toExist();
expect(a1.request.cql_filter).toBe("id>1");
expect(a2).toExist();
expect(a2.type).toBe(NEW_MAPINFO_REQUEST);
expect(a2.reqId).toExist();
expect(a2.request).toExist();
expect(a2.request.id).toEqual(state.layers.flat[1].id);
expect(a2.request.cql_filter).toExist();
expect(a2.request.cql_filter).toBe("id>1");
expect(a3).toExist();
expect(a3.type).toBe(NEW_MAPINFO_REQUEST);
expect(a3.reqId).toExist();
expect(a3.request).toExist();
expect(a3.request.id).toEqual(state.layers.flat[0].id);
expect(a3.request.cql_filter).toExist();
expect(a3.request.cql_filter).toBe("id>1");
done();
} catch (ex) {
done(ex);
}
}, {...state, mapInfo: {
...state.mapInfo,
itemId: "province_view.5"
}});
});
it('getFeatureInfoOnFeatureInfoClick WMS with ignoreVisibilityLimits flag with true and selected layers [search service case]', (done) => {
// remove previous hook
registerHook('RESOLUTION_HOOK', undefined);
const state = {
map: {present: {...TEST_MAP_STATE.present, resolution: 100000}},
mapInfo: {
clickPoint: { latlng: { lat: 36.95, lng: -79.84 } }
},
layers: {
flat: [{
id: "TEST1",
name: "TEST",
"title": "TITLE",
type: "wms",
visibility: true,
url: 'base/web/client/test-resources/featureInfo-response.json',
minResolution: 500,
maxResolution: 50000
},
{
id: "TEST NEW 2",
name: "TEST",
"title": "TITLE NEW 2",
type: "wms",
visibility: true,
url: 'base/web/client/test-resources/featureInfo-response.json',
minResolution: 500,
maxResolution: 50000
},
{
id: "TEST_NEW",
name: "TEST",
"title": "TITLE New",
type: "wms",
visibility: true,
url: 'base/web/client/test-resources/featureInfo-response.json'
},
{
id: "TEST2",
name: "TEST2",
"title": "TITLE2",
type: "wms",
visibility: true,
url: 'base/web/client/test-resources/featureInfo-response.json'
}],
selected: ['TEST1']
}
};
const ignoreVisibilityLimits = true;
const sentActions = [featureInfoClick({ latlng: { lat: 36.95, lng: -79.84 } }, "TEST", ["TEST"], {"TEST": {cql_filter: "id>1"}}, "province_view.5", ignoreVisibilityLimits)];
testEpic(getFeatureInfoOnFeatureInfoClick, 3, sentActions, ([a0, a1, a2]) => {
try {
expect(a0).toExist();
expect(a0.type).toBe(PURGE_MAPINFO_RESULTS);
expect(a1).toExist();
expect(a1.type).toBe(NEW_MAPINFO_REQUEST);
expect(a1.reqId).toExist();
expect(a1.request).toExist();
expect(a1.request.id).toEqual(state.layers.flat[0].id);
expect(a1.request.cql_filter).toExist();
expect(a1.request.cql_filter).toBe("id>1");
expect(a2.type).toBe(LOAD_FEATURE_INFO);
expect(a2.data).toExist();
expect(a2.requestParams).toExist();
expect(a2.reqId).toExist();
expect(a2.layerMetadata.title).toBe(state.layers.flat[0].title);
done();
} catch (ex) {
done(ex);
}
}, {...state, mapInfo: {
...state.mapInfo,
itemId: "province_view.5"
}});
});
it('handleMapInfoMarker show', done => {
testEpic(handleMapInfoMarker, 1, featureInfoClick({}), ([ a ]) => {
expect(a.type).toBe(SHOW_MAPINFO_MARKER);
Expand Down
Loading
Loading