Skip to content

Commit

Permalink
various fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MV88 committed Oct 18, 2023
1 parent 12c791c commit e63eb85
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 104 deletions.
6 changes: 4 additions & 2 deletions web/client/actions/__tests__/geoProcessing-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,16 @@ describe('Test Geo Processing Tools related actions', () => {
const source = "";
const data = {};
const nextPage = 2;
const geometryProperty = {};

const action = setFeatures(layerId, source, data, nextPage);
const action = setFeatures(layerId, source, data, nextPage, geometryProperty);
expect(action).toEqual({
type: SET_FEATURES,
layerId,
source,
data,
nextPage
nextPage,
geometryProperty
});
});
it('setFeatureSourceLoading', () => {
Expand Down
5 changes: 3 additions & 2 deletions web/client/actions/geoProcessing.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,13 @@ export const setBufferCapStyle = (capStyle) => ({
* @param {string} source can be "source" or "intersection"
* @param {object[]|object} data list of features or error
*/
export const setFeatures = (layerId, source, data, nextPage) => ({
export const setFeatures = (layerId, source, data, nextPage, geometryProperty) => ({
type: SET_FEATURES,
layerId,
source,
data,
nextPage
nextPage,
geometryProperty
});
/**
* action for the loading flag of the features
Expand Down
15 changes: 8 additions & 7 deletions web/client/epics/geoProcessing.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ import {buildIdentifyRequest} from "../utils/MapInfoUtils";
import {logError} from "../utils/DebugUtils";
import {getFeatureInfo} from "../api/identify";
import {getFeatureSimple} from '../api/WFS';
import {findNonGeometryProperty} from '../utils/ogc/WFS/base';
import {findNonGeometryProperty, findGeometryProperty} from '../utils/ogc/WFS/base';
import toWKT from '../utils/ogc/WKT/toWKT';

const OFFSET = 550;
Expand Down Expand Up @@ -261,6 +261,7 @@ export const getFeaturesGPTEpic = (action$, store) => action$
startIndex: page * maxFeatures,
maxFeatures
};
const geometryProperty = findGeometryProperty(layer.describeFeatureType);
return Rx.Observable.merge(
getLayerJSONFeature({
...layer,
Expand All @@ -270,11 +271,11 @@ export const getFeaturesGPTEpic = (action$, store) => action$
url: layer.url
}
}, filterObj, options)
.map(data => setFeatures(layerId, source, data, page))
.map(data => setFeatures(layerId, source, data, page, geometryProperty))
.catch(e => {
logError(e);
return Rx.Observable.of(
setFeatures(layerId, source, e, page),
setFeatures(layerId, source, e, page, geometryProperty),
showErrorNotification({
title: "errorTitleDefault",
message: "GeoProcessing.notifications.errorGettingFeaturesList",
Expand Down Expand Up @@ -631,9 +632,9 @@ export const runIntersectProcessGPTEpic = (action$, store) => action$
}
return Rx.Observable.forkJoin(sourceFC$, intersectionFC$)
.switchMap(([firstGeom, secondGeom]) => {
if (firstGeom.error) {
if (firstGeom?.error || secondGeom?.error) {
const errorActions = [];
if (firstGeom.error.message.includes("Failed to retrieve value for input features")) {
if (firstGeom?.error?.message?.includes("Failed to retrieve value for input features")) {
logError(firstGeom.error);
errorActions.push(showErrorNotification({
title: "errorTitleDefault",
Expand All @@ -643,7 +644,7 @@ export const runIntersectProcessGPTEpic = (action$, store) => action$
values: {layerName: firstGeom.layerName + " - " + firstGeom.layerTitle}
}));
}
if (secondGeom.error.message.includes("Failed to retrieve value for input features")) {
if (secondGeom?.error?.message?.includes("Failed to retrieve value for input features")) {
logError(secondGeom.error);
errorActions.push(showErrorNotification({
title: "errorTitleDefault",
Expand All @@ -655,7 +656,7 @@ export const runIntersectProcessGPTEpic = (action$, store) => action$
}
errorActions.push(showErrorNotification({
title: "errorTitleDefault",
message: "GeoProcessing.notifications.errorBuffer",
message: "GeoProcessing.notifications.errorIntersectGFI",
autoDismiss: 6,
position: "tc"
}));
Expand Down
7 changes: 4 additions & 3 deletions web/client/plugins/GeoProcessing/processes.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,11 @@ export const processes = [
{props.runningProcess ? <Loader size={14} style={{margin: '0 auto'}}/> : null}
</Button>
<InfoPopover
bsStyle={props.isIntersectionLayerInvalid || props.isSourceLayerInvalid ? "danger" : "info"}
bsStyle={!props.isIntersectionEnabled || props.isIntersectionLayerInvalid || props.isSourceLayerInvalid ? "danger" : "info"}
text={
props.isIntersectionLayerInvalid || props.isSourceLayerInvalid ?
getMessageById(props.messages, "GeoProcessing.tooltip.invalidLayers") : getMessageById(props.messages, "GeoProcessing.tooltip.fillRequiredDataIntersection")
!props.isIntersectionEnabled ? getMessageById(props.messages, "GeoProcessing.tooltip.pointAndPolygon") :
props.isIntersectionLayerInvalid || props.isSourceLayerInvalid ?
getMessageById(props.messages, "GeoProcessing.tooltip.invalidLayers") : getMessageById(props.messages, "GeoProcessing.tooltip.fillRequiredDataIntersection")
}
/>
</div>);
Expand Down
1 change: 0 additions & 1 deletion web/client/reducers/__tests__/geoProcessing-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,6 @@ describe('Test Geo Processing Tools reducer', () => {
}, action);
expect(state.source.feature).toEqual(feature);
expect(state.source.features).toEqual([feature]);
expect(state.flags.isIntersectionEnabled).toEqual(true);
});
it('SET_INTERSECTION_LAYER_ID', () => {
const layerId = "id";
Expand Down
13 changes: 4 additions & 9 deletions web/client/reducers/geoProcessing.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ import {
RESET_CONTROLS
} from '../actions/controls';
import { LOCATION_CHANGE } from 'connected-react-router';
import { checkIfIntersectionIsPossible } from '../utils/GeoProcessingUtils';

/**
* reducer for GeoProcessing
Expand Down Expand Up @@ -208,6 +207,10 @@ function geoProcessing( state = {
features: (state[action.source].features || []).concat(action.data.features || []),
totalCount: action.data.totalFeatures,
currentPage: action.nextPage
},
flags: {
...state.flags,
isIntersectionEnabled: action.source === "source" ? !action.geometryProperty?.type?.includes("Point") : state.flags.isIntersectionEnabled
}
} : {
...state,
Expand Down Expand Up @@ -308,10 +311,6 @@ function geoProcessing( state = {
...state.source,
feature: action.feature,
features: find(state.source.features, ft => ft.id === action.feature.id) ? state.source.features : [action.feature]
},
flags: {
...state.flags,
isIntersectionEnabled: checkIfIntersectionIsPossible(action?.feature, state?.intersection?.feature)
}
};
}
Expand Down Expand Up @@ -350,10 +349,6 @@ function geoProcessing( state = {
...state.intersection,
feature: action.feature,
features: find(state.intersection.features, ft => ft.id === action.feature.id) ? state.intersection.features : [action.feature]
},
flags: {
...state.flags,
isIntersectionEnabled: checkIfIntersectionIsPossible(state?.source?.feature, action?.feature)
}
};
}
Expand Down
1 change: 1 addition & 0 deletions web/client/translations/data.de-DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -3991,6 +3991,7 @@
"invalidLayers": "Eine der von Ihnen ausgewählten Ebenen kann in diesem Prozess nicht verwendet werden",
"fillRequiredDataIntersection": "Bitte wählen Sie mindestens den Quell-Layer und den Schnittpunkt-Layer aus",
"fillRequiredDataBuffer": "Bitte wählen Sie mindestens die Quellebene aus",
"pointAndPolygon": "Sie können einen Punkt nur als Schnittpunkt-Feature auswählen, während der Quell-Layer ein Polygon-Layer ist",
"siderBarBtn": "Geoverarbeitung",
"selectFeature": "Bitte wählen Sie eine Funktion aus",
"validFeature": "Diese Funktion ist gültig",
Expand Down
1 change: 1 addition & 0 deletions web/client/translations/data.en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -3965,6 +3965,7 @@
"invalidLayers": "One of the layers you have selected cannot be used within this process",
"fillRequiredDataIntersection": "Please select at least the source layer and the intersection layer",
"fillRequiredDataBuffer": "Please select at least the source layer",
"pointAndPolygon": "You can select a point only as an intersection feature, while the source layer must be a polygon layer",
"siderBarBtn": "GeoProcessing",
"selectFeature": "Please select a feature",
"validFeature": "This feature is valid",
Expand Down
1 change: 1 addition & 0 deletions web/client/translations/data.es-ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -3954,6 +3954,7 @@
"invalidLayers": "Una de las capas que ha seleccionado no se puede utilizar dentro de este proceso",
"fillRequiredDataIntersection": "Seleccione al menos la capa de origen y la capa de intersección",
"fillRequiredDataBuffer": "Seleccione al menos la capa de origen",
"pointAndPolygon": "Puede seleccionar un punto solo como una entidad de intersección, mientras que la capa de origen es una capa de polígono.",
"siderBarBtn": "Geoprocesamiento",
"selectFeature": "Seleccione una función",
"validFeature": "Esta función es válida",
Expand Down
1 change: 1 addition & 0 deletions web/client/translations/data.fr-FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -3954,6 +3954,7 @@
"invalidLayers": "L'un des calques que vous avez sélectionnés ne peut pas être utilisé dans ce processus",
"fillRequiredDataIntersection": "Veuillez sélectionner au moins la couche source et la couche d'intersection",
"fillRequiredDataBuffer": "Veuillez sélectionner au moins la couche source",
"pointAndPolygon": "Vous pouvez sélectionner un point uniquement en tant qu'entité d'intersection, tandis que la couche source est une couche de polygones.",
"siderBarBtn": "Géotraitement",
"selectFeature": "Veuillez sélectionner une fonctionnalité",
"validFeature": "Cette fonctionnalité est valide",
Expand Down
1 change: 1 addition & 0 deletions web/client/translations/data.it-IT.json
Original file line number Diff line number Diff line change
Expand Up @@ -3954,6 +3954,7 @@
"invalidLayers": "Uno dei livelli che hai selezionato non può essere utilizzato all'interno di questo processo",
"fillRequiredDataIntersection": "Seleziona almeno il livello di origine e il livello di intersezione",
"fillRequiredDataBuffer": "Seleziona almeno il livello di origine",
"pointAndPolygon": "Puoi selezionare un punto solo come feature di intersezion, mentre il livello sorgente è un livello poligonale",
"siderBarBtn": "Strumenti di geoelaborazione",
"selectFeature": "Seleziona una funzione",
"validFeature": "Questa feature è valida",
Expand Down
25 changes: 0 additions & 25 deletions web/client/utils/GeoProcessingUtils.js

This file was deleted.

55 changes: 0 additions & 55 deletions web/client/utils/__tests__/GeoProcessingUtils-test.js

This file was deleted.

0 comments on commit e63eb85

Please sign in to comment.