From 61e645c963f121a1d1377ede653477ab30288564 Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Thu, 14 Nov 2024 14:33:19 +0000 Subject: [PATCH] added in options for uploadstream for rep pdfs --- actions/azurestorage.js | 21 ++++++++++-- actions/index.js | 2 +- components/case/representation/index.js | 32 +++++++++---------- .../representation/representationElements.js | 4 +-- .../case/representation/representationLPA.js | 8 ++--- .../representationLPAQuestionnaire_s78.js | 3 +- components/myportal.js | 21 ++++++++---- components/pdftemplates/enforcement_pdf.js | 6 ++-- .../pdftemplates/lpaQuestionnaire_pdf.js | 8 ++--- locales/cy/myportal.json | 1 + locales/en/myportal.json | 1 + 11 files changed, 66 insertions(+), 41 deletions(-) diff --git a/actions/azurestorage.js b/actions/azurestorage.js index 5af1760f..8a8997a6 100644 --- a/actions/azurestorage.js +++ b/actions/azurestorage.js @@ -385,10 +385,18 @@ export const createAppealPDFBlob = async ( //console.log(content); const blobName = caseID + "/files/" + pdfFileName + ".pdf"; + const uploadOptions = { + blockSize: 4 * 1024 * 1024, // 4 MiB max block size + concurrency: 2, // maximum number of parallel transfer workers + maxSingleShotSize: 8 * 1024 * 1024, // 8 MiB initial transfer size + }; console.log("blobName:", blobName); const blockBlobClient = containerClient.getBlockBlobClient(blobName); - const uploadBlobResponse = await blockBlobClient.uploadStream(content); + const uploadBlobResponse = await blockBlobClient.uploadStream( + content, + uploadOptions + ); console.log(uploadBlobResponse); @@ -426,10 +434,19 @@ export const createRepPDFBlob = async ( //console.log(content); const blobName = caseID + "/" + repName + "/files/" + repName + ".pdf"; + const uploadOptions = { + blockSize: 4 * 1024 * 1024, // 4 MiB max block size + concurrency: 2, // maximum number of parallel transfer workers + maxSingleShotSize: 8 * 1024 * 1024, // 8 MiB initial transfer size + }; + console.log("blobName:", blobName); const blockBlobClient = containerClient.getBlockBlobClient(blobName); - const uploadBlobResponse = await blockBlobClient.uploadStream(content); + const uploadBlobResponse = await blockBlobClient.uploadStream( + content, + uploadOptions + ); let whichLocation = repName.indexOf("_IP_") > 0 diff --git a/actions/index.js b/actions/index.js index 1686728a..7a7d0128 100644 --- a/actions/index.js +++ b/actions/index.js @@ -1544,7 +1544,7 @@ export const uploadRepFiles = async ( export const generateRepPDF = async (formValues, containerID, casefolderID) => { //let files = filesObj; - console.log("generateRepPDF function: " + formValues); + //console.log("generateRepPDF function: " + formValues); // var formData = new FormData(); // formValues.append("appealData", JSON.stringify(formValues)); // formValues.append("containerID", containerID); diff --git a/components/case/representation/index.js b/components/case/representation/index.js index 42a02a13..239b610d 100644 --- a/components/case/representation/index.js +++ b/components/case/representation/index.js @@ -223,7 +223,7 @@ let MakeRepresentation = (props) => { const buildRepsArr = (detailsObj) => { let buildArr = []; - console.log(currentView.caseReference.appealType, ""); + // console.log(currentView.caseReference.appealType, ""); let todaysDate = new Date(); @@ -737,7 +737,6 @@ let MakeRepresentation = (props) => { Object.assign(values, { "filesList": buildFileArray, })), - console.log("zxcvbnm"), uploadRepresentationFiles(values), generateRepPDF( values, @@ -750,11 +749,11 @@ let MakeRepresentation = (props) => { window.scrollTo({ top: 0, behavior: "smooth" }); values = setRepFileName(values); - console.log("onHandleSubmit form values - ", JSON.stringify(values)); + //console.log("onHandleSubmit form values - ", JSON.stringify(values)); const buildFileArray = []; - console.log("attached docs: - ", buildFileArray); + //console.log("attached docs: - ", buildFileArray); let setCaseDetailsObj = router.query.hasOwnProperty("state") ? router.query.state == "edit" @@ -777,11 +776,11 @@ let MakeRepresentation = (props) => { detailsObj = detailsObj[0]; - console.log( - "Has data from form:", - formObj.hasOwnProperty("representationForm") && - formObj.representationForm.hasOwnProperty("values") - ); + // console.log( + // "Has data from form:", + // formObj.hasOwnProperty("representationForm") && + // formObj.representationForm.hasOwnProperty("values") + // ); formObj.hasOwnProperty("representationForm") && !router.query.hasOwnProperty("state") && @@ -871,7 +870,6 @@ let MakeRepresentation = (props) => { Object.assign(values, { "locale": router.locale }), props.invalid == false && updateRepresentation(values, false, false), - console.log("qwerty"), // values.hasOwnProperty("representationDocuments") && // (values.representationDocuments.map((Blob) => // buildFileArray.push({ @@ -904,13 +902,13 @@ let MakeRepresentation = (props) => { return _.includes(key, "representationDocuments"); }); - console.log( - "\n////////////////////////\n upload files:", - values.containerID, - "\n////////////////////////\n fileListObj:", - fileListObj, - "\n////////////////////////\n" - ); + // console.log( + // "\n////////////////////////\n upload files:", + // values.containerID, + // "\n////////////////////////\n fileListObj:", + // fileListObj, + // "\n////////////////////////\n" + // ); var dataObj = values; diff --git a/components/case/representation/representationElements.js b/components/case/representation/representationElements.js index 5cbdc6a8..444045d0 100644 --- a/components/case/representation/representationElements.js +++ b/components/case/representation/representationElements.js @@ -361,7 +361,7 @@ export const RenderLPACondtionalRadioList = ({ }) => { const required = (value) => (value ? undefined : "Required"); - console.log(error); + //console.log(error); return ( <> @@ -463,7 +463,7 @@ export const RenderPickList = ({ errorMsg, ...custom }) => { - console.log(custom.disabled); + // console.log(custom.disabled); let { t } = useTranslation(); return ( diff --git a/components/case/representation/representationLPA.js b/components/case/representation/representationLPA.js index fc4323b9..aac77cc3 100644 --- a/components/case/representation/representationLPA.js +++ b/components/case/representation/representationLPA.js @@ -391,10 +391,10 @@ let RepLPA = (props) => { {showQuestionnaireSection > 1 && ( { - window.scrollTo({ - top: 0, - behavior: "smooth", - }); + // window.scrollTo({ + // top: 0, + // behavior: "smooth", + // }); setRepFileName( props.formObj[ "representationForm" diff --git a/components/case/representation/representationQuestionnaires/representationLPAQuestionnaire_s78.js b/components/case/representation/representationQuestionnaires/representationLPAQuestionnaire_s78.js index c6f36496..6431d6b4 100644 --- a/components/case/representation/representationQuestionnaires/representationLPAQuestionnaire_s78.js +++ b/components/case/representation/representationQuestionnaires/representationLPAQuestionnaire_s78.js @@ -89,7 +89,7 @@ let S78_Questionnaire = (props) => { ); resultsObj = resultsObj[0]; - console.log(resultsObj); + //console.log(resultsObj); const onHandleSubmit = (values) => { //if (currentSection == sectionCount) { @@ -1065,7 +1065,6 @@ S78_Questionnaire = connect((state) => { })(S78_Questionnaire); const mapStateToProps = (state, props) => { - console.log(); return { search: state.search, searchResultsObj: state.searchResultsObj, diff --git a/components/myportal.js b/components/myportal.js index 65629f5c..60693d03 100644 --- a/components/myportal.js +++ b/components/myportal.js @@ -14,6 +14,8 @@ import MyRepresentations from "./myportal/myrepresentations"; import SearchCases from "./myportal/searchcases"; import WatchedCases from "./myportal/watchedcases"; import ServiceBanner from "./myportal/servicebanner"; +import { JSONPath as jsonpath } from "jsonpath-plus"; +import transLookup from "../data/lookuptranslations.json"; const MyPortal = (props) => { const { showFileUpload, showLoginCheck } = props; @@ -100,12 +102,19 @@ const MyPortal = (props) => { {isLPA && (

- { - props.accountDetails.accountDetails[ - "pinswg_contact_associatedlpa@OData.Community.Display.V1.FormattedValue" - ] - }{" "} - LPA Portal + {router.locale == "cy" + ? jsonpath( + '$..[?(@.value=="' + + props.accountDetails.accountDetails[ + "pinswg_contact_associatedlpa@OData.Community.Display.V1.FormattedValue" + ] + + '")].value_cy', + transLookup + ) + : props.accountDetails.accountDetails[ + "pinswg_contact_associatedlpa@OData.Community.Display.V1.FormattedValue" + ]}{" "} + {t("myportal:lpa-portal-heading")}

)} diff --git a/components/pdftemplates/enforcement_pdf.js b/components/pdftemplates/enforcement_pdf.js index 4daad698..12d5226c 100644 --- a/components/pdftemplates/enforcement_pdf.js +++ b/components/pdftemplates/enforcement_pdf.js @@ -85,7 +85,7 @@ const styles = StyleSheet.create({ }); export const EnforcementQuestionnaire_pdf = ({ docProps }) => { - console.log(docProps); + //console.log(docProps); function formatDates(dateObj) { var dateObj = new Date(dateObj); var dd = String(dateObj.getDate()).padStart(2, "0"); @@ -96,9 +96,9 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => { } let values = docProps; let appealTypeValue = getFormCollectionByID(values.appealType); - console.log("//////////////////////\n docpropseeeee:".docProps); + //console.log("//////////////////////\n docpropseeeee:".docProps); - console.log("sdffhjdhjdjdgkj: ", values.procedureType); + //console.log("sdffhjdhjdjdgkj: ", values.procedureType); return ( diff --git a/components/pdftemplates/lpaQuestionnaire_pdf.js b/components/pdftemplates/lpaQuestionnaire_pdf.js index 769ff7fc..939bd91e 100644 --- a/components/pdftemplates/lpaQuestionnaire_pdf.js +++ b/components/pdftemplates/lpaQuestionnaire_pdf.js @@ -4,7 +4,7 @@ import { Page, StyleSheet, Text, - View + View, } from "@react-pdf/renderer"; import Html from "react-pdf-html"; import { getFormCollectionByID } from "../../components/utils"; @@ -17,7 +17,7 @@ const getTrans = (locale, key) => { let jsonObj = locale == "cy" ? transLookupCY : transLookupEN; - console.log(locale, jsonObj[key]); + //console.log(locale, jsonObj[key]); return jsonObj[key]; }; @@ -107,10 +107,10 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => { return dd + "/" + mm + "/" + yyyy; } let values = docProps; - console.log("//////////////////////\n docprops:", docProps); + //console.log("//////////////////////\n docprops:", docProps); let appealTypeValue = getFormCollectionByID(values.appealType); - console.log("sdffhjdhjdjdgkj: ", values.procedureType); + //console.log("sdffhjdhjdjdgkj: ", values.procedureType); return ( diff --git a/locales/cy/myportal.json b/locales/cy/myportal.json index d4364e7a..2f37e456 100644 --- a/locales/cy/myportal.json +++ b/locales/cy/myportal.json @@ -2,6 +2,7 @@ "viewall-link": "Gweld y cyfan", "viewall-link-count": "Gweld pob un o'r {{count}} achos", "page-title": "Fy mhorth", + "lpa-portal-heading": "Porth LPA", "makenewappeal-card-title": "Gwneud apêl newydd", "makenewappeal-card-paragraph-one": "Cyn cyflwyno apêl newydd, gwnewch yn siŵr eich bod wedi darllen y cyfan", "makenewappeal-card-link": "berthnasol i'r math o apêl sydd gennych.", diff --git a/locales/en/myportal.json b/locales/en/myportal.json index 90ca95bb..6a1b198b 100644 --- a/locales/en/myportal.json +++ b/locales/en/myportal.json @@ -2,6 +2,7 @@ "viewall-link": "View all", "viewall-link-count": "View all {{count}} cases", "page-title": "My Portal", + "lpa-portal-heading": "LPA Portal", "makenewappeal-card-title": "Make a new appeal", "makenewappeal-card-paragraph-one": "Before submitting a new appeal, please ensure you have read all of the", "makenewappeal-card-link": "relevant to your appeal type.",