From 2074f118613890f402054ff780a10e1293cb4a91 Mon Sep 17 00:00:00 2001 From: Marko Haarni Date: Thu, 3 Aug 2023 12:35:42 +0300 Subject: [PATCH 1/2] HAI-1767 Do not allow user to draw work areas that have surface area of 0 (#348) User is not able to finish drawing work area if its surface area is below 1, preventing work areas with invalid surface area. Also updated OpenLayers to latest version. --- package.json | 3 +- src/common/components/map/Map.tsx | 8 +- .../map/controls/OverviewMapControl.tsx | 5 +- .../map/interactions/FeatureClick.tsx | 36 +++--- .../map/modules/draw/DrawInteraction.tsx | 22 +++- src/common/components/map/utils.ts | 4 +- src/domain/johtoselvitys/BasicInfo.tsx | 5 +- src/domain/johtoselvitys/Geometries.tsx | 4 +- .../components/HankeDrawer/HankeDrawer.tsx | 6 +- .../map/components/Layers/Kantakartta.tsx | 3 +- .../map/components/Layers/Ortokartta.tsx | 4 +- .../interations/CenterProjectOnMap.tsx | 19 +-- .../interations/HighlightFeatureOnMap.tsx | 16 +-- src/setupTests.ts | 2 + yarn.lock | 110 ++++++++++++++---- 15 files changed, 165 insertions(+), 82 deletions(-) diff --git a/package.json b/package.json index 64b8ba1db..db136c7b1 100644 --- a/package.json +++ b/package.json @@ -76,7 +76,7 @@ "lodash": "^4.17.21", "msw": "^0.49.0", "oidc-client": "^1.10.1", - "ol": "^6.5.0", + "ol": "^7.4.0", "proj4": "^2.6.3", "react": "^16.13.1", "react-dom": "^16.13.1", @@ -114,6 +114,7 @@ "lint-staged": "^10.3.0", "prettier": "^2.2.1", "prettier-eslint": "^12.0.0", + "resize-observer-polyfill": "^1.5.1", "start-server-and-test": "^1.12.0", "stylelint": "^13.7.2", "stylelint-config-standard": "^20.0.0", diff --git a/src/common/components/map/Map.tsx b/src/common/components/map/Map.tsx index 112674e2f..fa24d6e37 100644 --- a/src/common/components/map/Map.tsx +++ b/src/common/components/map/Map.tsx @@ -33,20 +33,20 @@ const Map: React.FC = ({ const [map, setMap] = useState(null); const [layers] = useState({}); - const controls = showAttribution ? [attribution] : []; - useEffect(() => { if (mapRef.current == null) { return; } + const controls = showAttribution ? [attribution] : []; + const options = { view: new ol.View({ center, zoom, minZoom: 5, maxZoom: 13, - projection, + projection: projection || undefined, }), layers: [], controls: defaultControls({ @@ -63,7 +63,7 @@ const Map: React.FC = ({ // eslint-disable-next-line return () => mapObject.setTarget(undefined); - }, [center, zoom]); + }, [center, zoom, showAttribution]); useEffect(() => { if (!map) return; diff --git a/src/common/components/map/controls/OverviewMapControl.tsx b/src/common/components/map/controls/OverviewMapControl.tsx index ff8614713..beb160ad2 100644 --- a/src/common/components/map/controls/OverviewMapControl.tsx +++ b/src/common/components/map/controls/OverviewMapControl.tsx @@ -36,9 +36,8 @@ const OverviewMapControl: React.FC = ({ className }) => { VERSION: '1.1.1', TRANSPARENT: 'false', }, - projection, + projection: projection || undefined, cacheSize: 1000, - imageSmoothing: false, hidpi: false, serverType: 'geoserver', transition: 0, @@ -55,7 +54,7 @@ const OverviewMapControl: React.FC = ({ className }) => { zoom: 3, minZoom: 2, maxZoom: 6, - projection, + projection: projection || undefined, }), }); diff --git a/src/common/components/map/interactions/FeatureClick.tsx b/src/common/components/map/interactions/FeatureClick.tsx index 70b516236..f83ca0780 100644 --- a/src/common/components/map/interactions/FeatureClick.tsx +++ b/src/common/components/map/interactions/FeatureClick.tsx @@ -10,30 +10,30 @@ const HankeClick: React.FC = () => { const navigate = useNavigate(); - const selectHanke = (mapInstance: MapInstance, evt: MapBrowserEvent) => { - mapInstance?.getLayers().forEach((BaseLayer) => { - if (BaseLayer instanceof OLVectorLayer) { - BaseLayer.getFeatures(evt.pixel).then((features) => { - if (features.length > 0) { - features.some((feature) => { - const hankeTunnus = feature.get('hankeTunnus'); - navigate({ - search: `?hanke=${hankeTunnus}`, + useEffect(() => { + const selectHanke = (mapInstance: MapInstance, evt: MapBrowserEvent) => { + mapInstance?.getLayers().forEach((BaseLayer) => { + if (BaseLayer instanceof OLVectorLayer) { + BaseLayer.getFeatures(evt.pixel).then((features) => { + if (features.length > 0) { + features.some((feature) => { + const hankeTunnus = feature.get('hankeTunnus'); + navigate({ + search: `?hanke=${hankeTunnus}`, + }); + return true; }); - return true; - }); - } - }); - } - }); - }; + } + }); + } + }); + }; - useEffect(() => { if (map) map.on('click', (evt) => { selectHanke(map, evt); }); - }, [map]); + }, [map, navigate]); return null; }; diff --git a/src/common/components/map/modules/draw/DrawInteraction.tsx b/src/common/components/map/modules/draw/DrawInteraction.tsx index 8c0d1773a..d23dbb758 100644 --- a/src/common/components/map/modules/draw/DrawInteraction.tsx +++ b/src/common/components/map/modules/draw/DrawInteraction.tsx @@ -10,7 +10,7 @@ import Polygon from 'ol/geom/Polygon'; import { DRAWTOOLTYPE } from './types'; import MapContext from '../../MapContext'; import useDrawContext from './useDrawContext'; -import { isPolygonSelfIntersecting } from '../../utils'; +import { getSurfaceArea, isPolygonSelfIntersecting } from '../../utils'; type Props = { features?: Collection; @@ -25,6 +25,8 @@ const DrawInteraction: React.FC = ({ onSelfIntersectingPolygon }) => { const { state, actions, source } = useDrawContext(); const [instances, setInstances] = useState([]); + const drawnFeature = useRef(null); + const clearSelection = useCallback(() => { if (selection.current) selection.current.getFeatures().clear(); actions.setSelectedFeature(null); @@ -60,6 +62,24 @@ const DrawInteraction: React.FC = ({ onSelfIntersectingPolygon }) => { source, type: geometryType, geometryFunction, + finishCondition() { + const geometry = drawnFeature.current?.getGeometry(); + if (geometry) { + const surfaceArea = getSurfaceArea(geometry); + // Don't allow drawing to be finished if its + // surface area is below 1 + if (surfaceArea < 1) { + return false; + } + } + return true; + }, + }); + + drawInstance.on('drawstart', (event) => { + event.feature.on('change', (changeEvent) => { + drawnFeature.current = changeEvent.target; + }); }); drawInstance.on('drawend', (event) => { diff --git a/src/common/components/map/utils.ts b/src/common/components/map/utils.ts index 1b23d17c7..1c1fd9531 100644 --- a/src/common/components/map/utils.ts +++ b/src/common/components/map/utils.ts @@ -15,10 +15,10 @@ proj4.defs( register(proj4); export const projection = getProjection('EPSG:3879'); -projection.setExtent([25440000, 6630000, 25571072, 6761072]); +projection?.setExtent([25440000, 6630000, 25571072, 6761072]); export function getSurfaceArea(geometry: Geometry) { - return getArea(geometry, { projection }); + return getArea(geometry, { projection: projection || undefined }); } /** diff --git a/src/domain/johtoselvitys/BasicInfo.tsx b/src/domain/johtoselvitys/BasicInfo.tsx index c738aff3c..74123fccc 100644 --- a/src/domain/johtoselvitys/BasicInfo.tsx +++ b/src/domain/johtoselvitys/BasicInfo.tsx @@ -164,7 +164,10 @@ export const BasicHankeInfo: React.FC = () => { // Remove moved contact from previous selected role contacts setValue( `applicationData.${selectedRole}.contacts`, - previousRoleContacts.length > 1 ? previousRoleContacts.slice(1) : [emptyContact] + previousRoleContacts.length > 1 ? previousRoleContacts.slice(1) : [emptyContact], + { + shouldValidate: true, + } ); if (!getValues(`applicationData.${role.value}.customer`)) { diff --git a/src/domain/johtoselvitys/Geometries.tsx b/src/domain/johtoselvitys/Geometries.tsx index e367e5cf3..17ef21345 100644 --- a/src/domain/johtoselvitys/Geometries.tsx +++ b/src/domain/johtoselvitys/Geometries.tsx @@ -87,7 +87,9 @@ export const Geometries: React.FC = () => { useEffect(() => { function handleAddFeature(e: VectorSourceEvent) { - append(getEmptyArea(e.feature)); + if (e.feature) { + append(getEmptyArea(e.feature)); + } } const handleChangeFeature = debounce(() => { diff --git a/src/domain/map/components/HankeDrawer/HankeDrawer.tsx b/src/domain/map/components/HankeDrawer/HankeDrawer.tsx index 7578996ca..083901204 100644 --- a/src/domain/map/components/HankeDrawer/HankeDrawer.tsx +++ b/src/domain/map/components/HankeDrawer/HankeDrawer.tsx @@ -67,21 +67,21 @@ const HankeDrawer: React.FC = ({ }; function handleAddFeature(e: VectorSourceEvent) { - if (onAddFeature) { + if (onAddFeature && e.feature) { onAddFeature(e.feature); } updateState(); } const handleChangeFeature = debounce((e: VectorSourceEvent) => { - if (onChangeFeature) { + if (onChangeFeature && e.feature) { onChangeFeature(e.feature); } updateState(); }, 100); function handleRemoveFeature(e: VectorSourceEvent) { - if (onRemoveFeature) { + if (onRemoveFeature && e.feature) { onRemoveFeature(e.feature); } updateState(); diff --git a/src/domain/map/components/Layers/Kantakartta.tsx b/src/domain/map/components/Layers/Kantakartta.tsx index 855809da4..49f9a1ea5 100644 --- a/src/domain/map/components/Layers/Kantakartta.tsx +++ b/src/domain/map/components/Layers/Kantakartta.tsx @@ -9,11 +9,10 @@ const Kantakartta = () => { const sourceOptions = { url: 'https://kartta.hel.fi/ws/geoserver/avoindata/wms', - projection, + projection: projection || undefined, cacheSize: 1000, imageSmoothing: false, hidpi: false, - serverType: 'geoserver', transition: 0, attributions: [t('map:attribution')], }; diff --git a/src/domain/map/components/Layers/Ortokartta.tsx b/src/domain/map/components/Layers/Ortokartta.tsx index b9c317c94..74bef387c 100644 --- a/src/domain/map/components/Layers/Ortokartta.tsx +++ b/src/domain/map/components/Layers/Ortokartta.tsx @@ -17,10 +17,8 @@ const Ortokartta = () => ( VERSION: '1.1.1', TRANSPARENT: 'false', }, - projection, - imageSmoothing: false, + projection: projection || undefined, hidpi: false, - serverType: 'geoserver', transition: 0, attributions: ['Aineistot © Helsingin kaupunki'], }) diff --git a/src/domain/map/components/interations/CenterProjectOnMap.tsx b/src/domain/map/components/interations/CenterProjectOnMap.tsx index c2b15aaa0..efbf06644 100644 --- a/src/domain/map/components/interations/CenterProjectOnMap.tsx +++ b/src/domain/map/components/interations/CenterProjectOnMap.tsx @@ -1,4 +1,4 @@ -import React, { useContext, useEffect } from 'react'; +import React, { useCallback, useContext, useEffect } from 'react'; import { Vector as VectorSource } from 'ol/source'; import { useLocation } from 'react-router-dom'; import MapContext from '../../../../common/components/map/MapContext'; @@ -12,7 +12,7 @@ const CenterProjectOnMap: React.FC = ({ source }) => { const { map } = useContext(MapContext); const hankeTunnus = new URLSearchParams(location.search).get('hanke'); - const centralizeHankeOnMap = () => { + const centralizeHankeOnMap = useCallback(() => { source.getFeatures().some((feature) => { if (feature.get('hankeTunnus') === hankeTunnus) { const extent = feature.getGeometry()?.getExtent(); @@ -21,17 +21,20 @@ const CenterProjectOnMap: React.FC = ({ source }) => { } return false; }); - }; + }, [hankeTunnus, map, source]); useEffect(() => { - source.on('featuresAdded', () => { - centralizeHankeOnMap(); - }); - }, [map, hankeTunnus]); + map?.once('postrender', centralizeHankeOnMap); + source.on('addfeature', centralizeHankeOnMap); + + return function cleanup() { + source.un('addfeature', centralizeHankeOnMap); + }; + }, [map, source, centralizeHankeOnMap]); useEffect(() => { centralizeHankeOnMap(); - }, [hankeTunnus]); + }, [hankeTunnus, centralizeHankeOnMap]); return null; }; diff --git a/src/domain/map/components/interations/HighlightFeatureOnMap.tsx b/src/domain/map/components/interations/HighlightFeatureOnMap.tsx index 341c73946..afcc5199e 100644 --- a/src/domain/map/components/interations/HighlightFeatureOnMap.tsx +++ b/src/domain/map/components/interations/HighlightFeatureOnMap.tsx @@ -1,4 +1,4 @@ -import React, { useContext, useEffect } from 'react'; +import React, { useCallback, useContext, useEffect } from 'react'; import { Vector as VectorSource } from 'ol/source'; import { useLocation } from 'react-router-dom'; import MapContext from '../../../../common/components/map/MapContext'; @@ -15,7 +15,7 @@ const HighlightFeatureOnMap: React.FC = ({ source }) => { const { hoveredHankeTunnukset } = useContext(HoverContext); const hankeTunnus = new URLSearchParams(location.search).get('hanke'); - const highlightFeature = () => { + const highlightFeature = useCallback(() => { source.getFeatures().some((feature) => { if ( hoveredHankeTunnukset.includes(feature.get('hankeTunnus')) || @@ -27,21 +27,17 @@ const HighlightFeatureOnMap: React.FC = ({ source }) => { } return false; }); - }; + }, [hankeTunnus, hoveredHankeTunnukset, source]); useEffect(() => { - source.on('featuresAdded', () => { + source.on('addfeature', () => { highlightFeature(); }); - }, [map]); + }, [map, source, highlightFeature]); useEffect(() => { highlightFeature(); - }, [hankeTunnus]); - - useEffect(() => { - highlightFeature(); - }, [hoveredHankeTunnukset]); + }, [hankeTunnus, hoveredHankeTunnukset, highlightFeature]); return null; }; diff --git a/src/setupTests.ts b/src/setupTests.ts index e2a56df88..ebf1cb49f 100644 --- a/src/setupTests.ts +++ b/src/setupTests.ts @@ -15,6 +15,8 @@ customGlobal.fetch = require('jest-fetch-mock'); customGlobal.fetchMock = customGlobal.fetch; +global.ResizeObserver = require('resize-observer-polyfill'); + beforeAll(() => server.listen({ onUnhandledRequest: 'error' })); afterAll(() => server.close()); afterEach(() => server.resetHandlers()); diff --git a/yarn.lock b/yarn.lock index 2d34b24b4..0b53849d8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2847,17 +2847,17 @@ resolved "https://registry.yarnpkg.com/@mapbox/jsonlint-lines-primitives/-/jsonlint-lines-primitives-2.0.2.tgz#ce56e539f83552b58d10d672ea4d6fc9adc7b234" integrity sha1-zlblOfg1UrWNENZy6k1vya3HsjQ= -"@mapbox/mapbox-gl-style-spec@^13.14.0": - version "13.17.0" - resolved "https://registry.yarnpkg.com/@mapbox/mapbox-gl-style-spec/-/mapbox-gl-style-spec-13.17.0.tgz#4b9f16e4cc94ce13a254d61a139b28c716925de4" - integrity sha512-ZxOdHiuUmDcvQNc1uTnBLVJZxiQVYvoNZaQVxWwl+6Id6tjGQFtieZxXiv/RXIOpQQT35JuioatTKdsjpMsULA== +"@mapbox/mapbox-gl-style-spec@^13.23.1": + version "13.28.0" + resolved "https://registry.yarnpkg.com/@mapbox/mapbox-gl-style-spec/-/mapbox-gl-style-spec-13.28.0.tgz#2ec226320a0f77856046e000df9b419303a56458" + integrity sha512-B8xM7Fp1nh5kejfIl4SWeY0gtIeewbuRencqO3cJDrCHZpaPg7uY+V8abuR+esMeuOjRl5cLhVTP40v+1ywxbg== dependencies: "@mapbox/jsonlint-lines-primitives" "~2.0.2" "@mapbox/point-geometry" "^0.1.0" "@mapbox/unitbezier" "^0.0.0" csscolorparser "~1.0.2" json-stringify-pretty-compact "^2.0.0" - minimist "^1.2.5" + minimist "^1.2.6" rw "^1.3.3" sort-object "^0.3.2" @@ -2926,6 +2926,11 @@ resolved "https://registry.yarnpkg.com/@open-draft/until/-/until-1.0.3.tgz#db9cc719191a62e7d9200f6e7bab21c5b848adca" integrity sha512-Aq58f5HiWdyDlFffbbSjAlv596h/cOnt2DO1w3DOC7OJ5EHs0hd/nycJfiu9RJbT6Yk6F1knnRRXNSpxoIVZ9Q== +"@petamoriken/float16@^3.4.7": + version "3.8.2" + resolved "https://registry.yarnpkg.com/@petamoriken/float16/-/float16-3.8.2.tgz#12812f75b7def79ed76cbe40237c983b1c54cf51" + integrity sha512-TrVOB6T9kIrmGCp+mUIej7VJgQbB5MRWEj1ZksfR7hPSyc338xHxLO50spgpGBlbmk8D3kWOGnCHDfnaPV+Sng== + "@pmmmwh/react-refresh-webpack-plugin@0.4.3": version "0.4.3" resolved "https://registry.yarnpkg.com/@pmmmwh/react-refresh-webpack-plugin/-/react-refresh-webpack-plugin-0.4.3.tgz#1eec460596d200c0236bf195b078a5d1df89b766" @@ -7343,6 +7348,11 @@ duplexify@^3.4.2, duplexify@^3.6.0: readable-stream "^2.0.0" stream-shift "^1.0.0" +earcut@^2.2.3: + version "2.2.4" + resolved "https://registry.yarnpkg.com/earcut/-/earcut-2.2.4.tgz#6d02fd4d68160c114825d06890a92ecaae60343a" + integrity sha512-/pjZsA1b4RPHbeWZQn66SWS8nZZWLQQ23oE3Eam7aroEFGEvwKAsJfZ9ytiEMycfzXWpca4FA9QIOehf7PocBQ== + ecc-jsbn@~0.1.1: version "0.1.2" resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9" @@ -8749,6 +8759,19 @@ geojson@^0.5.0: resolved "https://registry.yarnpkg.com/geojson/-/geojson-0.5.0.tgz#3cd6c96399be65b56ee55596116fe9191ce701c0" integrity sha1-PNbJY5m+ZbVu5VWWEW/pGRznAcA= +geotiff@^2.0.7: + version "2.0.7" + resolved "https://registry.yarnpkg.com/geotiff/-/geotiff-2.0.7.tgz#358e578233af70bfb0b4dee62d599ad78fc5cfca" + integrity sha512-FKvFTNowMU5K6lHYY2f83d4lS2rsCNdpUC28AX61x9ZzzqPNaWFElWv93xj0eJFaNyOYA63ic5OzJ88dHpoA5Q== + dependencies: + "@petamoriken/float16" "^3.4.7" + lerc "^3.0.0" + pako "^2.0.4" + parse-headers "^2.0.2" + quick-lru "^6.1.1" + web-worker "^1.2.0" + xml-utils "^1.0.2" + get-caller-file@^2.0.1, get-caller-file@^2.0.5: version "2.0.5" resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" @@ -11131,6 +11154,11 @@ lazy-ass@1.6.0, lazy-ass@^1.6.0: resolved "https://registry.yarnpkg.com/lazy-ass/-/lazy-ass-1.6.0.tgz#7999655e8646c17f089fdd187d150d3324d54513" integrity sha1-eZllXoZGwX8In90YfRUNMyTVRRM= +lerc@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/lerc/-/lerc-3.0.0.tgz#36f36fbd4ba46f0abf4833799fff2e7d6865f5cb" + integrity sha512-Rm4J/WaHhRa93nCN2mwWDZFoRVF18G1f47C+kvQWyHGEZxFpTUi73p7lMVSAndyxGt6lJ2/CFbOcf9ra5p8aww== + leven@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2" @@ -11760,10 +11788,10 @@ map-visit@^1.0.0: dependencies: object-visit "^1.0.0" -mapbox-to-css-font@^2.4.0: - version "2.4.0" - resolved "https://registry.yarnpkg.com/mapbox-to-css-font/-/mapbox-to-css-font-2.4.0.tgz#a23b51664a1ee839beaefade013f2655bee9a390" - integrity sha512-v674D0WtpxCXlA6E+sBlG1QJWdUkz/s9qAD91bJSXBGuBL5lL4tJXpoJEftecphCh2SVQCjWMS2vhylc3AIQTg== +mapbox-to-css-font@^2.4.1: + version "2.4.2" + resolved "https://registry.yarnpkg.com/mapbox-to-css-font/-/mapbox-to-css-font-2.4.2.tgz#a9e31b363ad8ca881cd339ca99f2d2a6b02ea5dd" + integrity sha512-f+NBjJJY4T3dHtlEz1wCG7YFlkODEjFIYlxDdLIDMNpkSksqTt+l/d4rjuwItxuzkuMFvPyrjzV2lxRM4ePcIA== markdown-escapes@^1.0.0: version "1.0.4" @@ -12020,6 +12048,11 @@ minimist@^1.1.1, minimist@^1.2.0, minimist@^1.2.5: resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602" integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw== +minimist@^1.2.6: + version "1.2.8" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c" + integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== + minipass-collect@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/minipass-collect/-/minipass-collect-1.0.2.tgz#22b813bf745dc6edba2576b940022ad6edc8c617" @@ -12570,21 +12603,23 @@ oidc-client@^1.10.1: crypto-js "^4.0.0" serialize-javascript "^4.0.0" -ol-mapbox-style@^6.1.1: - version "6.1.4" - resolved "https://registry.yarnpkg.com/ol-mapbox-style/-/ol-mapbox-style-6.1.4.tgz#5caec1e26e45371091cb68488541b0f9d56d531f" - integrity sha512-XyOk6oGTGtFnj6gRvMwdKZft9s1QeSh9toQRGT7vFr8fS9yV8fSVJnrdmicGTYDYkUVmL+B3Sebi2jc1oEdouQ== +ol-mapbox-style@^10.1.0: + version "10.6.0" + resolved "https://registry.yarnpkg.com/ol-mapbox-style/-/ol-mapbox-style-10.6.0.tgz#89ac864160a374d936a59f7d1c969d4dc1d0a46b" + integrity sha512-s86QhCoyyKVRsYkvPzzdWd///bhYh3onWrBq4lNXnCd9G/hS6AoK023kn4zlDESVlTBDTWLz8vhOistp0M3TXA== dependencies: - "@mapbox/mapbox-gl-style-spec" "^13.14.0" - mapbox-to-css-font "^2.4.0" - webfont-matcher "^1.1.0" + "@mapbox/mapbox-gl-style-spec" "^13.23.1" + mapbox-to-css-font "^2.4.1" + ol "^7.3.0" -ol@^6.5.0: - version "6.5.0" - resolved "https://registry.yarnpkg.com/ol/-/ol-6.5.0.tgz#d9cd59081ac34dc4caf0509c3f667748a8207a21" - integrity sha512-a5ebahrjF5yCPFle1rc0aHzKp/9A4LlUnjh+S3I+x4EgcvcddDhpOX3WDOs0Pg9/wEElrikHSGEvbeej2Hh4Ug== +ol@^7.3.0, ol@^7.4.0: + version "7.4.0" + resolved "https://registry.yarnpkg.com/ol/-/ol-7.4.0.tgz#935436c0843d1f939972e076d4fcb130530ce9d7" + integrity sha512-bgBbiah694HhC0jt8ptEFNRXwgO8d6xWH3G97PCg4bmn9Li5nLLbi59oSrvqUI6VPVwonPQF1YcqJymxxyMC6A== dependencies: - ol-mapbox-style "^6.1.1" + earcut "^2.2.3" + geotiff "^2.0.7" + ol-mapbox-style "^10.1.0" pbf "3.2.1" rbush "^3.0.1" @@ -12811,6 +12846,11 @@ p-try@^2.0.0: resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== +pako@^2.0.4: + version "2.1.0" + resolved "https://registry.yarnpkg.com/pako/-/pako-2.1.0.tgz#266cc37f98c7d883545d11335c00fbd4062c9a86" + integrity sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug== + pako@~1.0.5: version "1.0.11" resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.11.tgz#6c9599d340d54dfd3946380252a35705a6b992bf" @@ -12863,6 +12903,11 @@ parse-entities@^2.0.0: is-decimal "^1.0.0" is-hexadecimal "^1.0.0" +parse-headers@^2.0.2: + version "2.0.5" + resolved "https://registry.yarnpkg.com/parse-headers/-/parse-headers-2.0.5.tgz#069793f9356a54008571eb7f9761153e6c770da9" + integrity sha512-ft3iAoLOB/MlwbNXgzy43SWGP6sQki2jQvAyBg/zDFAgr9bfNWZIUj42Kw2eJIl8kEi4PbgE6U1Zau/HwI75HA== + parse-json@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-2.2.0.tgz#f480f40434ef80741f8469099f8dea18f55a4dc9" @@ -14157,6 +14202,11 @@ quick-lru@^4.0.1: resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-4.0.1.tgz#5b8878f113a58217848c6482026c73e1ba57727f" integrity sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g== +quick-lru@^6.1.1: + version "6.1.1" + resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-6.1.1.tgz#f8e5bf9010376c126c80c1a62827a526c0e60adf" + integrity sha512-S27GBT+F0NTRiehtbrgaSE1idUAJ5bX8dPAQTdylEyNlrdcH5X4Lz7Edz3DYzecbsCluD5zO8ZNEe04z3D3u6Q== + quickselect@^1.0.1: version "1.1.1" resolved "https://registry.yarnpkg.com/quickselect/-/quickselect-1.1.1.tgz#852e412ce418f237ad5b660d70cffac647ae94c2" @@ -14923,6 +14973,11 @@ reselect@^4.0.0: resolved "https://registry.yarnpkg.com/reselect/-/reselect-4.0.0.tgz#f2529830e5d3d0e021408b246a206ef4ea4437f7" integrity sha512-qUgANli03jjAyGlnbYVAV5vvnOmJnODyABz51RdBN7M4WaVu8mecZWgyQNkG8Yqe3KRGRt0l4K4B3XVEULC4CA== +resize-observer-polyfill@^1.5.1: + version "1.5.1" + resolved "https://registry.yarnpkg.com/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz#0e9020dd3d21024458d4ebd27e23e40269810464" + integrity sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg== + resolve-cwd@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-2.0.0.tgz#00a9f7387556e27038eae232caa372a6a59b665a" @@ -17331,10 +17386,10 @@ web-encoding@^1.1.5: optionalDependencies: "@zxing/text-encoding" "0.9.0" -webfont-matcher@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/webfont-matcher/-/webfont-matcher-1.1.0.tgz#98ce95097b29e31fbe733053e10e571642d1c6c7" - integrity sha1-mM6VCXsp4x++czBT4Q5XFkLRxsc= +web-worker@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/web-worker/-/web-worker-1.2.0.tgz#5d85a04a7fbc1e7db58f66595d7a3ac7c9c180da" + integrity sha512-PgF341avzqyx60neE9DD+XS26MMNMoUQRz9NOZwW32nPQrF6p77f1htcnjBSEV8BGMKZ16choqUG4hyI0Hx7mA== webidl-conversions@^3.0.0: version "3.0.1" @@ -17822,6 +17877,11 @@ xml-name-validator@^3.0.0: resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-3.0.0.tgz#6ae73e06de4d8c6e47f9fb181f78d648ad457c6a" integrity sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw== +xml-utils@^1.0.2: + version "1.7.0" + resolved "https://registry.yarnpkg.com/xml-utils/-/xml-utils-1.7.0.tgz#333ce391d8918f872aaf98d2cf90f9ef9b82bd0f" + integrity sha512-bWB489+RQQclC7A9OW8e5BzbT8Tu//jtAOvkYwewFr+Q9T9KDGvfzC1lp0pYPEQPEoPQLDkmxkepSC/2gIAZGw== + xmlchars@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/xmlchars/-/xmlchars-2.2.0.tgz#060fe1bcb7f9c76fe2a17db86a9bc3ab894210cb" From 0ef44fbd7c6f7b4d2c7e00d8497ebab8dd8f1898 Mon Sep 17 00:00:00 2001 From: Topias Heinonen Date: Wed, 5 Jul 2023 11:13:08 +0300 Subject: [PATCH 2/2] HAI-1833 Remove trailing slash from Hankkeet URL Backend has deprecated support for URLs with trailing slashes, so remove them from the frontend. Only one such URL seems to be called, the hanke list called. Change the URL to one without the trailing slash. --- src/domain/hanke/portfolio/HankePortfolioContainer.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/domain/hanke/portfolio/HankePortfolioContainer.tsx b/src/domain/hanke/portfolio/HankePortfolioContainer.tsx index 31c8ccf55..e2125c16c 100644 --- a/src/domain/hanke/portfolio/HankePortfolioContainer.tsx +++ b/src/domain/hanke/portfolio/HankePortfolioContainer.tsx @@ -5,7 +5,7 @@ import { HankeData } from '../../types/hanke'; import HankePortfolioComponent from './HankePortfolioComponent'; const getHankkeet = async () => { - const { data } = await api.get(`/hankkeet/`, { + const { data } = await api.get(`/hankkeet`, { params: { geometry: true, },