From e803a348ec7d6b9f53b342ddbcec61495c740d60 Mon Sep 17 00:00:00 2001 From: Dilwoar Hussain Date: Thu, 10 Oct 2024 13:28:29 +0100 Subject: [PATCH 1/2] Gracefully handles missing mapping fields There are some instances where mapping fields is missing --- src/middleware/datasetOverview.middleware.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/middleware/datasetOverview.middleware.js b/src/middleware/datasetOverview.middleware.js index ac2a747e..ad5818a9 100644 --- a/src/middleware/datasetOverview.middleware.js +++ b/src/middleware/datasetOverview.middleware.js @@ -64,8 +64,8 @@ const fetchEntityCount = fetchOne({ export const prepareDatasetOverviewTemplateParams = (req, res, next) => { const { orgInfo, specification, columnSummary, entityCount, sources, dataset, issues } = req - const mappingFields = columnSummary[0].mapping_field?.split(';') ?? [] - const nonMappingFields = columnSummary[0].non_mapping_field?.split(';') ?? [] + const mappingFields = columnSummary[0]?.mapping_field?.split(';') ?? [] + const nonMappingFields = columnSummary[0]?.non_mapping_field?.split(';') ?? [] const allFields = [...mappingFields, ...nonMappingFields] const numberOfFieldsSupplied = specification.fields.map(field => field.field).reduce((acc, current) => { From 3545e37f2bf3d2219d78c130ce7fa999c83dff23 Mon Sep 17 00:00:00 2001 From: Dilwoar Hussain Date: Wed, 9 Oct 2024 16:19:40 +0100 Subject: [PATCH 2/2] Add map controls - The map interface is missing controls to enable the user to interact with it. - Users can move about the map using pinch-to-zoom controls on their trackpads, but they might not be aware of this, and might be using a mouse. - We should add these controls in to the map interface. - The controls need to be added in the JS set up: https://maplibre.org/maplibre-gl-js/docs/examples/navigation/ --- src/assets/js/map.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/assets/js/map.js b/src/assets/js/map.js index 7386452d..e1255066 100644 --- a/src/assets/js/map.js +++ b/src/assets/js/map.js @@ -33,6 +33,9 @@ class Map { interactive: opts.interactive ?? true }) + // Add map controls + this.addControls(opts.interactive) + this.map.on('load', () => { // Store the first symbol layer id this.setFirstMapLayerId() @@ -49,6 +52,15 @@ class Map { }) } + addControls (interactive = true) { + this.map.addControl(new maplibregl.ScaleControl(), 'bottom-left') + + if (interactive) { + this.map.addControl(new maplibregl.NavigationControl()) + this.map.addControl(new maplibregl.FullscreenControl()) + } + } + setFirstMapLayerId () { const layers = this.map.getStyle().layers