dmw preliminary work
This commit is contained in:
+39
-15
@@ -1,3 +1,4 @@
|
|||||||
|
import { he } from "date-fns/locale";
|
||||||
import GoogleMapReact from "google-map-react";
|
import GoogleMapReact from "google-map-react";
|
||||||
const GoogleMapComponent = (props) => {
|
const GoogleMapComponent = (props) => {
|
||||||
const { center, zoom } = props;
|
const { center, zoom } = props;
|
||||||
@@ -21,22 +22,45 @@ const GoogleMapComponent = (props) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// console.log(
|
||||||
|
// "https://datamap.gov.wales/maps/pedw-dev/embed?center=" +
|
||||||
|
// props.center.lng +
|
||||||
|
// "," +
|
||||||
|
// props.center.lat +
|
||||||
|
// "&zoom=12#/"
|
||||||
|
// );
|
||||||
return (
|
return (
|
||||||
<GoogleMapReact
|
// <GoogleMapReact
|
||||||
options={function (maps) {
|
// options={function (maps) {
|
||||||
return {
|
// return {
|
||||||
overviewMapControl: true,
|
// overviewMapControl: true,
|
||||||
mapTypeControl: true,
|
// mapTypeControl: true,
|
||||||
};
|
// };
|
||||||
}}
|
// }}
|
||||||
bootstrapURLKeys={{
|
// bootstrapURLKeys={{
|
||||||
key: "AIzaSyCzeVrHt544bp_72YCFkw21eDsmI2JEsQo",
|
// key: "AIzaSyCzeVrHt544bp_72YCFkw21eDsmI2JEsQo",
|
||||||
}}
|
// }}
|
||||||
defaultCenter={center}
|
// defaultCenter={center}
|
||||||
defaultZoom={zoom}
|
// defaultZoom={zoom}
|
||||||
yesIWantToUseGoogleMapApiInternals
|
// yesIWantToUseGoogleMapApiInternals
|
||||||
onGoogleApiLoaded={({ map, maps }) => ModelsMap(map, maps)}
|
// onGoogleApiLoaded={({ map, maps }) => ModelsMap(map, maps)}
|
||||||
></GoogleMapReact>
|
// ></GoogleMapReact>
|
||||||
|
|
||||||
|
<iframe
|
||||||
|
src={
|
||||||
|
"https://datamap.gov.wales/maps/pedw-dev/embed?center=" +
|
||||||
|
props.center.lng +
|
||||||
|
"," +
|
||||||
|
props.center.lat +
|
||||||
|
"&zoom=6#/"
|
||||||
|
}
|
||||||
|
//src={"https://datamap.gov.wales/maps/pedw-dev/embed#/"}
|
||||||
|
width={"100%"}
|
||||||
|
maxheight={"400px"}
|
||||||
|
height={"100%"}
|
||||||
|
className={"mappingFrame"}
|
||||||
|
></iframe>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ class MyDocument extends Document {
|
|||||||
csp += `style-src 'self' 'unsafe-inline' https://pro.fontawesome.com/ https://www.google-analytics.com https://tagmanager.google.com/ https://www.googletagmanager.com/ https://fonts.googleapis.com/;`;
|
csp += `style-src 'self' 'unsafe-inline' https://pro.fontawesome.com/ https://www.google-analytics.com https://tagmanager.google.com/ https://www.googletagmanager.com/ https://fonts.googleapis.com/;`;
|
||||||
csp += `img-src 'self' 'unsafe-inline' https://maps.gstatic.com https://maps.googleapis.com https://www.gov.wales https://gov.wales https://fonts.gstatic.com https://www.googletagmanager.com https://www.google-analytics.com https://ssl.gstatic.com/ blob: data:;`;
|
csp += `img-src 'self' 'unsafe-inline' https://maps.gstatic.com https://maps.googleapis.com https://www.gov.wales https://gov.wales https://fonts.gstatic.com https://www.googletagmanager.com https://www.google-analytics.com https://ssl.gstatic.com/ blob: data:;`;
|
||||||
csp += `font-src 'self' 'unsafe-inline' https://pro.fontawesome.com/ https://fonts.gstatic.com/ data:;`;
|
csp += `font-src 'self' 'unsafe-inline' https://pro.fontawesome.com/ https://fonts.gstatic.com/ data:;`;
|
||||||
|
csp += `frame-src https://datamap.gov.wales`;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Html lang={locale}>
|
<Html lang={locale}>
|
||||||
|
|||||||
@@ -21,6 +21,70 @@ const hashAPIPath = (queryPath) => {
|
|||||||
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
|
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const renameKeys = (obj) => {
|
||||||
|
const keyMappings = {
|
||||||
|
"pinswg_projectlocation": "location",
|
||||||
|
"pinswg_mapzoomlevel": "zoomLevel",
|
||||||
|
"pinswg_name": "projectName",
|
||||||
|
"pinswg_anticipatedgridreferenceeastingtext": "easting",
|
||||||
|
"pinswg_anticipatedgridreferencenorthingtext": "northing",
|
||||||
|
"pinswg_anticipatedgridrefeasting": "easting",
|
||||||
|
"pinswg_anticipatedgridrefnorthing": "northing",
|
||||||
|
"pinswg_projectname": "projectTitle",
|
||||||
|
"pinswg_dnsid": "dnsId",
|
||||||
|
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue":
|
||||||
|
"lpaDisplayName",
|
||||||
|
"_pinswg_associatedlpa_value": "lpaId",
|
||||||
|
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue":
|
||||||
|
"appellantDisplayName",
|
||||||
|
"_pinswg_appellant_value": "appellantId",
|
||||||
|
"zoom": "mapZoom",
|
||||||
|
"center": "locationCenter",
|
||||||
|
};
|
||||||
|
|
||||||
|
let renamedObj = {};
|
||||||
|
Object.keys(obj).forEach((key) => {
|
||||||
|
// Skip keys that need to be removed
|
||||||
|
if (keysToRemove.includes(key)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if the key exists in the mapping
|
||||||
|
if (keyMappings[key]) {
|
||||||
|
renamedObj[keyMappings[key]] = obj[key];
|
||||||
|
} else {
|
||||||
|
renamedObj[key] = obj[key];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Recursively rename keys in nested objects
|
||||||
|
if (obj.center) {
|
||||||
|
renamedObj.locationCenter = {
|
||||||
|
lat: obj.center.lat,
|
||||||
|
lng: obj.center.lng,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (renamedObj.easting) {
|
||||||
|
renamedObj.easting = String(renamedObj.easting);
|
||||||
|
}
|
||||||
|
if (renamedObj.northing) {
|
||||||
|
renamedObj.northing = String(renamedObj.northing);
|
||||||
|
}
|
||||||
|
|
||||||
|
return renamedObj;
|
||||||
|
};
|
||||||
|
|
||||||
|
const keysToRemove = [
|
||||||
|
"_pinswg_associatedlpa_value@Microsoft.Dynamics.CRM.associatednavigationproperty",
|
||||||
|
"_pinswg_appellant_value@Microsoft.Dynamics.CRM.associatednavigationproperty",
|
||||||
|
"_pinswg_associatedlpa_value@Microsoft.Dynamics.CRM.lookuplogicalname",
|
||||||
|
"_pinswg_appellant_value@Microsoft.Dynamics.CRM.lookuplogicalname",
|
||||||
|
"pinswg_anticipatedgridrefeasting@OData.Community.Display.V1.FormattedValue",
|
||||||
|
"pinswg_anticipatedgridrefnorthing@OData.Community.Display.V1.FormattedValue",
|
||||||
|
// Add any other keys to remove here
|
||||||
|
];
|
||||||
|
|
||||||
export default async function ApiProxy(req, res) {
|
export default async function ApiProxy(req, res) {
|
||||||
var token = await getToken();
|
var token = await getToken();
|
||||||
|
|
||||||
@@ -90,7 +154,15 @@ export default async function ApiProxy(req, res) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Send the merged values as the response
|
// Send the merged values as the response
|
||||||
return res.status(200).json(coordsObj);
|
|
||||||
|
const updatedData = {
|
||||||
|
value: coordsObj.value.map((item) => renameKeys(item)),
|
||||||
|
"@odata.count": coordsObj["@odata.count"],
|
||||||
|
};
|
||||||
|
|
||||||
|
return req.query.hasOwnProperty("fordmw")
|
||||||
|
? res.status(200).json(updatedData)
|
||||||
|
: res.status(200).json(coordsObj);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Catch any errors and send an error response
|
// Catch any errors and send an error response
|
||||||
consoleLogger(error);
|
consoleLogger(error);
|
||||||
|
|||||||
@@ -1936,6 +1936,11 @@ ul#sharePageLinks.active {
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.mappingFrame {
|
||||||
|
border: 1px solid $lightgrey
|
||||||
|
}
|
||||||
|
|
||||||
//dns application view
|
//dns application view
|
||||||
|
|
||||||
.govuk-warning-text__icon {
|
.govuk-warning-text__icon {
|
||||||
|
|||||||
Reference in New Issue
Block a user