Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/npm_and_yarn/src/client/multi-9f3…
Browse files Browse the repository at this point in the history
…7c16f8f
  • Loading branch information
danjov authored Oct 9, 2024
2 parents 74c74b3 + 635a746 commit 1ae7c9c
Show file tree
Hide file tree
Showing 18 changed files with 523 additions and 591 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## [Unreleased]

### Added

- WMTS Services are now supported as custom user layers.

### Changed

- Updated the style of bulk edit form.
Expand Down
51 changes: 51 additions & 0 deletions src/client/cypress/e2e/settings/mapSettings.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { goToRouteAndAcceptTerms } from "../helpers/testHelpers.js";

describe("map settings", () => {
it("Adds wms and wmts to user maps", () => {
goToRouteAndAcceptTerms("/setting");

const wmsName = "Army logistics centres (ALC)";
const wmtsName = "Wetness potential agricultural land";

cy.contains("Map").click();
// Add WMS
cy.get('[data-cy="load-layers-button"]').click();
cy.get('[data-cy="wms-list-box"]').contains(wmsName);
cy.get('[data-cy="maps-for-user-box"]').should("not.exist");
cy.get('[data-cy="add-layer-button"]').eq(1).click();
cy.wait("@setting");
cy.get('[data-cy="maps-for-user-box"]').contains(wmsName);

// Select WMTS from Dropdown
cy.get('[role="combobox"]').click();
cy.get('div[role="option"]').last().click();

// Add WMTS
cy.get('[data-cy="load-layers-button"]').click();
cy.get('[data-cy="wmts-list-box"]').contains(wmtsName);
cy.get('[data-cy="add-layer-button"]').first().click();
cy.wait("@setting");
cy.get('[data-cy="maps-for-user-box"]').contains(wmtsName);

// Verify layers are added to overview map
cy.contains("h3", "Done").click();
cy.get('[data-cy="layers-button"]').click();
cy.contains(wmsName);
cy.contains(wmtsName);

// Remove layers
cy.get('[data-cy="settings-button"]').click();
cy.contains("Map").click();
cy.get('[data-cy="maps-for-user-box"]').contains(wmtsName);
cy.get('[data-cy="maps-for-user-box"]').contains(wmsName);
cy.get('[data-cy="delete-user-map-button"]').eq(0).click();
cy.wait("@setting");
cy.wait("@setting");
cy.wait("@setting"); //¯\_(ツ)_/¯

cy.get('[data-cy="maps-for-user-box"]').should("not.contain", wmsName);

cy.get('[data-cy="delete-user-map-button"]').eq(0).click();
cy.get('[data-cy="maps-for-user-box"]').should("not.exist");
});
});
6 changes: 6 additions & 0 deletions src/client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"@mui/system": "^5.16.5",
"@mui/x-data-grid": "^7.11.1",
"@react-hook/resize-observer": "^1.2.6",
"@types/proj4": "^2.5.5",
"axios": "^1.7.1",
"d3": "^7.9.0",
"date-fns": "^2.30.0",
Expand Down
2 changes: 2 additions & 0 deletions src/client/public/locale/de/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,8 @@
"nothingToShow": "Nichts zu zeigen",
"np": "Keine Angabe",
"oneSelected": "Ein Bohrung ausgewählt",
"onlyEPSG2056Supported": "Nur EPSG:2056 wird unterstützt.",
"onlyWmsAndWmtsSupported": "Nur Web Map Services (WMS) und Web Map Tile Services (WMTS) werden unterstützt.",
"openBorehole": "offenes Bohrloch",
"order": "Reihenfolge",
"organic_component": "Organische Komponenten",
Expand Down
2 changes: 2 additions & 0 deletions src/client/public/locale/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,8 @@
"nothingToShow": "Nothing to display",
"np": "Not specified",
"oneSelected": "One borehole selected",
"onlyEPSG2056Supported": "Only EPSG:2056 is supported",
"onlyWmsAndWmtsSupported": "Sono supportati solo i servizi WMS (Web Map Services) e WMTS (Web Map Tile Services).",
"openBorehole": "open hole",
"order": "Order",
"organic_component": "Organic components",
Expand Down
2 changes: 2 additions & 0 deletions src/client/public/locale/fr/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,8 @@
"nothingToShow": "Rien à montrer",
"np": "Sans indication",
"oneSelected": "Un forage sélectionné",
"onlyEPSG2056Supported": "Seulement le système de coordonnées EPSG:2056 est pris en charge.",
"onlyWmsAndWmtsSupported": "Seulement Web Map Services (WMS) et Web Map Tile Services (WMTS) sont pris en charge.",
"openBorehole": "forage ouvert",
"order": "Ordre",
"organic_component": "Composants organiques",
Expand Down
2 changes: 2 additions & 0 deletions src/client/public/locale/it/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,8 @@
"nothingToShow": "Niente da mostrare",
"np": "Senza indicazioni",
"oneSelected": "Una perforazione selezionata",
"onlyEPSG2056Supported": "È supportato solo EPSG:2056.",
"onlyWmsAndWmtsSupported": "Seulement Web Map Services (WMS) et Web Map Tile Services (WMTS) sont pris en charge.",
"openBorehole": "perforazione aperta",
"order": "Ordine",
"organic_component": "Componenti organici",
Expand Down
1 change: 1 addition & 0 deletions src/client/src/api-lib/ReduxStateInterfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export interface Setting {
}

export interface SettingData {
efilter: string;
map: {
explorer: string;
};
Expand Down
2 changes: 1 addition & 1 deletion src/client/src/api-lib/actions/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function patchSettings(tree, value, key = null) {
tree: tree,
value: value,
};
if (key !== null) {
if (key) {
payload.key = key;
}
return fetch("/setting", payload);
Expand Down
3 changes: 0 additions & 3 deletions src/client/src/components/map/mapComponent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import { Cluster } from "ol/source";
import TileWMS from "ol/source/TileWMS";
import VectorSource from "ol/source/Vector";
import WMTS from "ol/source/WMTS";
import WMTSTileGrid from "ol/tilegrid/WMTS";
import proj4 from "proj4";
import PropTypes from "prop-types";
import { getGeojson } from "../../api-lib";
Expand Down Expand Up @@ -223,8 +222,6 @@ class MapComponent extends React.Component {
opacity: 1,
source: new WMTS({
...layer.conf,
projection: getProjection(layer.conf.projection),
tileGrid: new WMTSTileGrid(layer.conf.tileGrid),
}),
zIndex: layer.position + 1,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,7 @@ import TranslationText from "../../../../components/legacyComponents/translation
import * as Styled from "./styles";

const EditorSettingList = props => {
const {
data,
toggleFilter,
attribute,
toggleField,
listName,
geocode,
codes,
toggleFieldArray,
toggleFilterArray,
type,
} = props;
const { data, toggleFilter, attribute, toggleField, listName, codes, toggleFieldArray, toggleFilterArray } = props;

const { t } = useTranslation();

Expand All @@ -33,15 +22,8 @@ const EditorSettingList = props => {
for (let idx = 0; idx < codes.data.layer_kind.length; idx++) {
const element = codes.data.layer_kind[idx];

if (element.code === geocode) {
if (type === "editor" && _.isObject(element.conf) && _.has(element.conf, `fields.${field}`)) {
return element.conf.fields[field];
}
if (type === "viewer" && _.isObject(element.conf) && _.has(element.conf, `viewerFields.${field}`)) {
return element.conf.viewerFields[field];
} else {
return false;
}
if (element.code === "Geol") {
return element.conf.fields[field];
}
}
}
Expand Down
Loading

0 comments on commit 1ae7c9c

Please sign in to comment.