Skip to content
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
82 changes: 81 additions & 1 deletion web/client/actions/__tests__/mapInfo-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ import {
checkIdentifyIsMounted,
IDENTIFY_IS_MOUNTED,
onInitPlugin,
INIT_PLUGIN
INIT_PLUGIN,
loadFeatureInfo,
LOAD_FEATURE_INFO
} from '../mapInfo';

describe('Test correctness of the map actions', () => {
Expand Down Expand Up @@ -126,6 +128,84 @@ describe('Test correctness of the map actions', () => {
expect(action.itemId).toBe(itemId);
expect(action.ignoreVisibilityLimits).toBe(ignoreVisibilityLimits);
});
it('test featureInfoClick with filterNameList, overrideParams, ignoreVisibilityLimits flag [search service case] and bbox of feature', () => {
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, [1, 2, 3, 4]);
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);
expect(action.bbox).toEqual([1, 2, 3, 4]);
});
it('test featureInfoClick with filterNameList, overrideParams, ignoreVisibilityLimits flag [search service case], bbox of feature and queryParamZoomOption', () => {
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 queryParamZoomOption = {
overrideZoomLvl: 5,
isCoordsProvided: false
};
const action = featureInfoClick(point, layer, filterNameList, overrideParams, itemId, ignoreVisibilityLimits, [1, 2, 3, 4], queryParamZoomOption);
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);
expect(action.bbox).toEqual([1, 2, 3, 4]);
expect(action.queryParamZoomOption).toEqual(queryParamZoomOption);
});
it('test loadFeatureInfo default', () => {
const reqId = "123";
const data = {id: "layer.1"};
const rParams = {cql_filter: "ID_ORIG=1234"};
const lMetaData = {features: [], featuresCrs: "EPSG:4326"};
const layer = {name: "layer01"};
const action = loadFeatureInfo(reqId, data, rParams, lMetaData, layer);
expect(action).toExist();
expect(action.type).toEqual(LOAD_FEATURE_INFO);
expect(action.data).toEqual(data);
expect(action.reqId).toEqual(reqId);
expect(action.requestParams).toEqual(rParams);
expect(action.layerMetadata).toEqual(lMetaData);
expect(action.layer).toEqual(layer);
expect(action.queryParamZoomOption).toEqual(null);
});
it('test loadFeatureInfo with queryParamZoomOption', () => {
const reqId = "123";
const data = {id: "layer.1"};
const rParams = {cql_filter: "ID_ORIG=1234"};
const lMetaData = {features: [], featuresCrs: "EPSG:4326"};
const layer = {name: "layer01"};
const queryParamZoomOption = {
overrideZoomLvl: 5,
isCoordsProvided: false
};
const action = loadFeatureInfo(reqId, data, rParams, lMetaData, layer, queryParamZoomOption);
expect(action).toExist();
expect(action.type).toEqual(LOAD_FEATURE_INFO);
expect(action.data).toEqual(data);
expect(action.reqId).toEqual(reqId);
expect(action.requestParams).toEqual(rParams);
expect(action.layerMetadata).toEqual(lMetaData);
expect(action.layer).toEqual(layer);
expect(action.queryParamZoomOption).toEqual(queryParamZoomOption);
});
it('reset reverse geocode data', () => {
const e = hideMapinfoRevGeocode();
expect(e).toExist();
Expand Down
12 changes: 12 additions & 0 deletions web/client/actions/__tests__/search-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,4 +149,16 @@ describe('Test correctness of the search actions', () => {
expect(retval.layer).toBe('layer1');
expect(retval.cql_filter).toBe("mm='nn'");
});
it('scheduleSearchLayerWithFilter with queryParamZoomOption', () => {
const queryParamZoomOption = {
overrideZoomLvl: 5,
isCoordsProvided: false
};
const retval = scheduleSearchLayerWithFilter({ layer: 'layer1', cql_filter: "mm='nn'", queryParamZoomOption});
expect(retval).toExist();
expect(retval.type).toEqual(SCHEDULE_SEARCH_LAYER_WITH_FILTER);
expect(retval.layer).toEqual('layer1');
expect(retval.cql_filter).toEqual("mm='nn'");
expect(retval.queryParamZoomOption).toEqual(queryParamZoomOption);
});
});
15 changes: 11 additions & 4 deletions web/client/actions/mapInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,15 @@ export const toggleEmptyMessageGFI = () => ({type: TOGGLE_EMPTY_MESSAGE_GFI});
* Private
* @return a LOAD_FEATURE_INFO action with the response data to a wms GetFeatureInfo
*/
export function loadFeatureInfo(reqId, data, rParams, lMetaData, layer) {
export function loadFeatureInfo(reqId, data, rParams, lMetaData, layer, queryParamZoomOption = null) {
return {
type: LOAD_FEATURE_INFO,
data: data,
reqId: reqId,
requestParams: rParams,
layerMetadata: lMetaData,
layer
layer,
queryParamZoomOption
};
}

Expand Down Expand Up @@ -195,16 +196,22 @@ export function updateCenterToMarker(status) {
* @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
* @param {number[]} [bbox=[]] bbox of the identified fearure in the form of [minx, miny, maxx, maxy]
* @param {object} queryParamZoomOption the override zoom option
* @param {number} queryParamZoomOption.overrideZoomLvl the override zoom level value if exist to make map zoom within this value
* @param {boolean} queryParamZoomOption.isCoordsProvided a flag to skip zooming to identified feature to use map zoom level if center/marker or bbox provided
*/
export function featureInfoClick(point, layer, filterNameList = [], overrideParams = {}, itemId = null, ignoreVisibilityLimits = false) {
export function featureInfoClick(point, layer, filterNameList = [], overrideParams = {}, itemId = null, ignoreVisibilityLimits = false, bbox = null, queryParamZoomOption = null) {
return {
type: FEATURE_INFO_CLICK,
point,
layer,
filterNameList,
overrideParams,
itemId,
ignoreVisibilityLimits
ignoreVisibilityLimits,
bbox,
queryParamZoomOption
};
}

Expand Down
16 changes: 12 additions & 4 deletions web/client/actions/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,17 @@ export function changeFormat(format) {
* @prop {object} options {layer, cql_filter}
* @prop {string} options.cql_filter optional filter to apply for both requests
* @prop {string} options.layer name of the layer with workspace
* @param {object} queryParamZoomOption the override zoom option
* @param {number} queryParamZoomOption.overrideZoomLvl the override zoom level value if exist to make map zoom within this value
* @param {boolean} queryParamZoomOption.isCoordsProvided a flag to skip zooming to identified feature to use map zoom level if center/marker or bbox provided
*/
// eslint-disable-next-line camelcase
export function searchLayerWithFilter({layer, cql_filter} = {}) {
export function searchLayerWithFilter({layer, cql_filter, queryParamZoomOption = null} = {}) {
return {
type: SEARCH_LAYER_WITH_FILTER,
layer,
cql_filter: cql_filter
cql_filter: cql_filter,
queryParamZoomOption
};
}

Expand All @@ -63,13 +67,17 @@ export function searchLayerWithFilter({layer, cql_filter} = {}) {
* @prop {object} options {layer, cql_filter}
* @prop {string} options.cql_filter optional filter to apply for both requests
* @prop {string} options.layer name of the layer with workspace
* @param {object} queryParamZoomOption the override zoom option
* @param {number} queryParamZoomOption.overrideZoomLvl the override zoom level value if exist to make map zoom within this value
* @param {boolean} queryParamZoomOption.isCoordsProvided a flag to skip zooming to identified feature to use map zoom level if center/marker or bbox provided
*/
// eslint-disable-next-line camelcase
export function scheduleSearchLayerWithFilter({layer, cql_filter} = {}) {
export function scheduleSearchLayerWithFilter({layer, cql_filter, queryParamZoomOption = null} = {}) {
return {
type: SCHEDULE_SEARCH_LAYER_WITH_FILTER,
layer,
cql_filter: cql_filter
cql_filter: cql_filter,
queryParamZoomOption
};
}

Expand Down
Loading