From a362a2c00f01280a433db422d52670218f6cd92c Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Thu, 26 Sep 2024 10:07:27 +0100 Subject: [PATCH] clean up debug info, reduce page weight --- .env.local | 2 +- .gitignore | 7 ++++- actions/azurestorage.js | 40 +++++++++++++-------------- components/case/documents.js | 10 +++---- components/myportal/servicebanner.js | 2 +- i18n.js | 6 ++-- package.json | 5 +++- pages/_document.js | 2 +- pages/myportal/case/[ticketnumber].js | 2 +- pages/myportal/index.js | 6 ++-- postcss.config.js | 3 ++ 11 files changed, 49 insertions(+), 36 deletions(-) create mode 100644 postcss.config.js diff --git a/.env.local b/.env.local index 500c4e67..482406d2 100644 --- a/.env.local +++ b/.env.local @@ -64,7 +64,7 @@ NEXTAUTH_URL_INTERNAL = $API_ROOT NEXTAUTH_SECRET = SuperSecret // CNR sql server -DATABASE_URL = sqlserver://sql-srv-plt-pedw-cnr-uks-01.database.windows.net:1433;database=PEDW;user=PedwSqlAdmin;password=GhWKr62F5sQ69dZx;encrypt=true;trustServerCertificate=false;hostNameInCertificate=*.database.windows.net;loginTimeout=30;authentication=ActiveDirectoryPassword +DATABASE_URL = sqlserver://sql-srv-plt-pedw-cnr-uks-01.database.windows.net:1433;database=PEDW;user=PedwSqlAdmin;password=GhWKr62F5sQ69dZx;encrypt=true;trustServerCertificate=true;hostNameInCertificate=*.database.windows.net;loginTimeout=30;authentication=ActiveDirectoryPassword // dev test sql server diff --git a/.gitignore b/.gitignore index a9a37757..23848e18 100644 --- a/.gitignore +++ b/.gitignore @@ -26,4 +26,9 @@ docker dockerfile* .dockerignore Makefile -docker*.yml \ No newline at end of file +docker*.yml + +# Polling + +pages/api/poll-queue.js +pages/polling.js \ No newline at end of file diff --git a/actions/azurestorage.js b/actions/azurestorage.js index 78a0000c..eab8146f 100644 --- a/actions/azurestorage.js +++ b/actions/azurestorage.js @@ -70,11 +70,11 @@ export const createContainerSas = async (containerName) => { expiresOn: TEN_MINUTES_AFTER_NOW, }; - console.log( - "\n////////////////////////\nsasOptions :", - JSON.stringify(sasOptions), - "\n////////////////////////" - ); + // console.log( + // "\n////////////////////////\nsasOptions :", + // JSON.stringify(sasOptions), + // "\n////////////////////////" + // ); const sasToken = generateBlobSASQueryParameters( sasOptions, @@ -82,11 +82,11 @@ export const createContainerSas = async (containerName) => { accountName ).toString(); - console.log( - "\n////////////////////////\nsasToken :", - sasToken, - "\n////////////////////////" - ); + // console.log( + // "\n////////////////////////\nsasToken :", + // sasToken, + // "\n////////////////////////" + // ); return sasToken; }; @@ -140,7 +140,7 @@ export const createBlobSas = async (containerName, blobName) => { export const createContainer = async (containerName) => { const creds = new DefaultAzureCredential(); - console.log(JSON.stringify(creds)); + //console.log(JSON.stringify(creds)); //containerName = containerName.toLowerCase(); //console.log( @@ -159,7 +159,7 @@ export const createContainer = async (containerName) => { const createContainerResponse = await containerClient .createIfNotExists() .then((data) => { - console.log(data); + //console.log(data); return data; }) .catch((error) => { @@ -933,7 +933,7 @@ export const downloadAllRepsFiles = async (containerName, repsBlobObj) => { Array.isArray(repsBlobObj) && !repsBlobObj.length && - console.log("is empt and an array"); + console.log("No partial reps for this container:" + containerName); for (const prop in repsBlobObj) { //console.log(`Progress - ${prop}: ${repsBlobObj[prop].path}`); @@ -1128,13 +1128,13 @@ export const getAllProgressBlobs = async (containerName) => { }); } - console.log( - "\n////////////////////////////\n", - sasUrl, - "blobObj:", - blobObj, - "\n////////////////////////////" - ); + // console.log( + // "\n////////////////////////////\n", + // sasUrl, + // "blobObj:", + // blobObj, + // "\n////////////////////////////" + // ); return blobObj; }; diff --git a/components/case/documents.js b/components/case/documents.js index 8f11dc85..aaecce69 100644 --- a/components/case/documents.js +++ b/components/case/documents.js @@ -47,8 +47,8 @@ const DocumentDetails = (props) => { var startTime = docsOffline.split(",")[0]; var endTime = docsOffline.split(",")[1]; - console.log(startTime); - console.log(endTime); + // console.log(startTime); + // console.log(endTime); var currentDate = new Date(); @@ -62,9 +62,9 @@ const DocumentDetails = (props) => { endDate.setMinutes(endTime.split(":")[1]); endDate.setSeconds(endTime.split(":")[2]); - console.log(startDate); - console.log(endDate); - console.log(currentDate); + // console.log(startDate); + // console.log(endDate); + // console.log(currentDate); var valid = startDate < currentDate && endDate > currentDate; ShowDocLinks = valid; diff --git a/components/myportal/servicebanner.js b/components/myportal/servicebanner.js index 95f98340..5ea5967e 100644 --- a/components/myportal/servicebanner.js +++ b/components/myportal/servicebanner.js @@ -71,7 +71,7 @@ const ServiceBanner = (props) => {
{props.accountDetails.accountDetails.firstname}{" "} {props.accountDetails.accountDetails.lastname} diff --git a/i18n.js b/i18n.js index ee4c269f..a5076db4 100644 --- a/i18n.js +++ b/i18n.js @@ -9,7 +9,7 @@ module.exports = { }, ], "pages": { - "*": ["common", "newappeal", "search"], + "*": ["common", "search"], "/": ["common", "home", "case"], "/error": ["common", "home", "myportal"], "/furtherdetails": ["common", "home", "myportal"], @@ -39,11 +39,13 @@ module.exports = { "/case/id/[incident]": ["case", "home"], "/myportal/representation": ["case", "myrepresentations", "common"], "/myportal/error": ["myportal", "common"], - "/myportal/case/id/[incident]": ["case","home"], + "/myportal/case/id/[incident]": ["case", "home"], "/myportal/addresssearch": ["search", "case", "myportal"], "/myportal/addresssearchresults": ["search", "case", "myportal"], + "/myportal/[appealtypes]": ["newappeal", "home"], "/newappeal": ["newappeal", "home"], "/newappeal/*": ["newappeal", "home"], + "/newappeal/[appealtypes]": ["newappeal", "home"], "/newappeal/selectappeal": ["newappeal", "home"], "/dns/*": ["dnsCommon", "case", "common"], "/dns/[developmentName]": ["dnsCommon", "case", "common"], diff --git a/package.json b/package.json index 95e7e2b1..a97f5ceb 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,7 @@ "fs": "0.0.2", "google-map-react": "^2.2.1", "govuk-frontend": "^5.0.0", + "history": "^5.3.0", "jsonpath": "^1.1.1", "jsonpath-plus": "^4.0.0", "leaflet": "^1.9.4", @@ -58,6 +59,7 @@ "nodemailer": "^6.9.7", "nookies": "^2.5.2", "notifications-node-client": "^7.0.6", + "openapi-types": "^12.1.3", "ospoint": "^0.2.1", "path": "^0.12.7", "prop-types": "^15.8.1", @@ -83,13 +85,14 @@ "sass-loader": "13.3.2", "swagger-ui": "^5.10.3", "swagger-ui-react": "^5.10.3", + "tslib": "^2.7.0", "typescript": "^5.3.2", "uuid": "9.0.0", "webpack": "^5.66.0", "xpath": "^0.0.32" }, "devDependencies": { - "eslint": "^8.6.0", + "eslint": "^9.11.1", "eslint-config-next": "^14.0.1", "eslint-plugin-jsdoc": "^48.2.3", "prisma": "^5.0.0" diff --git a/pages/_document.js b/pages/_document.js index 1bb4bb06..23e6e7c2 100644 --- a/pages/_document.js +++ b/pages/_document.js @@ -45,7 +45,7 @@ class MyDocument extends Document { csp += `connect-src 'self' https://ukwest-0.in.applicationinsights.azure.com https://js.monitor.azure.com https://region1.google-analytics.com;`; csp += `script-src 'self' 'unsafe-eval' 'unsafe-inline' https://ukwest-0.in.applicationinsights.azure.com https://region1.google-analytics.com https://www.google-analytics.com/ https://tagmanager.google.com/ https://www.googletagmanager.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://www.gov.wales https://gov.wales https://fonts.gstatic.com https://www.googletagmanager.com https://www.google-analytics.com https://ssl.gstatic.com/ data:;`; + csp += `img-src 'self' 'unsafe-inline' 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:;`; return ( diff --git a/pages/myportal/case/[ticketnumber].js b/pages/myportal/case/[ticketnumber].js index dd082036..7bbb2432 100644 --- a/pages/myportal/case/[ticketnumber].js +++ b/pages/myportal/case/[ticketnumber].js @@ -123,7 +123,7 @@ export const getServerSideProps = wrapper.getServerSideProps( console.log(cookies); console.log("the query :", query.ticketnumber); - console.log("viewkey:" + query.hasOwnProperty("key") ? "yes" : "no"); + console.log("viewkey: " + (query.hasOwnProperty("key") ? "yes" : "no")); const showLoginCheck = process.env.SHOWLOGIN || false; let thisSession = await getSession(ctx); diff --git a/pages/myportal/index.js b/pages/myportal/index.js index d9b9d135..feb37a78 100644 --- a/pages/myportal/index.js +++ b/pages/myportal/index.js @@ -227,7 +227,7 @@ export const getServerSideProps = wrapper.getServerSideProps( myCases, myRepresentations, watchedCases, - awaitingSubmission, + //awaitingSubmission, awaitingSubmissionFromBlob, ] = await Promise.all([ accountDetails.pinswg_typeofinvolvement == 846040012 @@ -236,7 +236,7 @@ export const getServerSideProps = wrapper.getServerSideProps( await getRepsFromBlob(thisSession.user.id), await getWatchedCases(loggedInUser), - await getAwaitingSubmission(loggedInUser), + //await getAwaitingSubmission(loggedInUser), await getAwaitingSubmissionFromBlob(thisSession.user.id), ]); @@ -337,7 +337,7 @@ export const getServerSideProps = wrapper.getServerSideProps( store.dispatch(setWatchedCasesDetails(watchedCasesDetails)); store.dispatch(setMySubmittedReps(mySubmittedReps)); store.dispatch(setMySubmittedRepsDetails(mySubmittedRepsDetails)); - store.dispatch(setAwaitingSubmission(awaitingSubmission)); + //store.dispatch(setAwaitingSubmission(awaitingSubmission)); store.dispatch( setAwaitingSubmissionFromBlob(awaitingSubmissionFromBlob) ); diff --git a/postcss.config.js b/postcss.config.js new file mode 100644 index 00000000..f09702ff --- /dev/null +++ b/postcss.config.js @@ -0,0 +1,3 @@ +module.exports = { + plugins: {}, +};