added in options for uploadstream for rep pdfs

This commit is contained in:
2024-11-14 14:33:19 +00:00
parent 379f238552
commit 61e645c963
11 changed files with 66 additions and 41 deletions
+19 -2
View File
@@ -385,10 +385,18 @@ export const createAppealPDFBlob = async (
//console.log(content); //console.log(content);
const blobName = caseID + "/files/" + pdfFileName + ".pdf"; 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); console.log("blobName:", blobName);
const blockBlobClient = containerClient.getBlockBlobClient(blobName); const blockBlobClient = containerClient.getBlockBlobClient(blobName);
const uploadBlobResponse = await blockBlobClient.uploadStream(content); const uploadBlobResponse = await blockBlobClient.uploadStream(
content,
uploadOptions
);
console.log(uploadBlobResponse); console.log(uploadBlobResponse);
@@ -426,10 +434,19 @@ export const createRepPDFBlob = async (
//console.log(content); //console.log(content);
const blobName = caseID + "/" + repName + "/files/" + repName + ".pdf"; 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); console.log("blobName:", blobName);
const blockBlobClient = containerClient.getBlockBlobClient(blobName); const blockBlobClient = containerClient.getBlockBlobClient(blobName);
const uploadBlobResponse = await blockBlobClient.uploadStream(content); const uploadBlobResponse = await blockBlobClient.uploadStream(
content,
uploadOptions
);
let whichLocation = let whichLocation =
repName.indexOf("_IP_") > 0 repName.indexOf("_IP_") > 0
+1 -1
View File
@@ -1544,7 +1544,7 @@ export const uploadRepFiles = async (
export const generateRepPDF = async (formValues, containerID, casefolderID) => { export const generateRepPDF = async (formValues, containerID, casefolderID) => {
//let files = filesObj; //let files = filesObj;
console.log("generateRepPDF function: " + formValues); //console.log("generateRepPDF function: " + formValues);
// var formData = new FormData(); // var formData = new FormData();
// formValues.append("appealData", JSON.stringify(formValues)); // formValues.append("appealData", JSON.stringify(formValues));
// formValues.append("containerID", containerID); // formValues.append("containerID", containerID);
+15 -17
View File
@@ -223,7 +223,7 @@ let MakeRepresentation = (props) => {
const buildRepsArr = (detailsObj) => { const buildRepsArr = (detailsObj) => {
let buildArr = []; let buildArr = [];
console.log(currentView.caseReference.appealType, ""); // console.log(currentView.caseReference.appealType, "");
let todaysDate = new Date(); let todaysDate = new Date();
@@ -737,7 +737,6 @@ let MakeRepresentation = (props) => {
Object.assign(values, { Object.assign(values, {
"filesList": buildFileArray, "filesList": buildFileArray,
})), })),
console.log("zxcvbnm"),
uploadRepresentationFiles(values), uploadRepresentationFiles(values),
generateRepPDF( generateRepPDF(
values, values,
@@ -750,11 +749,11 @@ let MakeRepresentation = (props) => {
window.scrollTo({ top: 0, behavior: "smooth" }); window.scrollTo({ top: 0, behavior: "smooth" });
values = setRepFileName(values); values = setRepFileName(values);
console.log("onHandleSubmit form values - ", JSON.stringify(values)); //console.log("onHandleSubmit form values - ", JSON.stringify(values));
const buildFileArray = []; const buildFileArray = [];
console.log("attached docs: - ", buildFileArray); //console.log("attached docs: - ", buildFileArray);
let setCaseDetailsObj = router.query.hasOwnProperty("state") let setCaseDetailsObj = router.query.hasOwnProperty("state")
? router.query.state == "edit" ? router.query.state == "edit"
@@ -777,11 +776,11 @@ let MakeRepresentation = (props) => {
detailsObj = detailsObj[0]; detailsObj = detailsObj[0];
console.log( // console.log(
"Has data from form:", // "Has data from form:",
formObj.hasOwnProperty("representationForm") && // formObj.hasOwnProperty("representationForm") &&
formObj.representationForm.hasOwnProperty("values") // formObj.representationForm.hasOwnProperty("values")
); // );
formObj.hasOwnProperty("representationForm") && formObj.hasOwnProperty("representationForm") &&
!router.query.hasOwnProperty("state") && !router.query.hasOwnProperty("state") &&
@@ -871,7 +870,6 @@ let MakeRepresentation = (props) => {
Object.assign(values, { "locale": router.locale }), Object.assign(values, { "locale": router.locale }),
props.invalid == false && props.invalid == false &&
updateRepresentation(values, false, false), updateRepresentation(values, false, false),
console.log("qwerty"),
// values.hasOwnProperty("representationDocuments") && // values.hasOwnProperty("representationDocuments") &&
// (values.representationDocuments.map((Blob) => // (values.representationDocuments.map((Blob) =>
// buildFileArray.push({ // buildFileArray.push({
@@ -904,13 +902,13 @@ let MakeRepresentation = (props) => {
return _.includes(key, "representationDocuments"); return _.includes(key, "representationDocuments");
}); });
console.log( // console.log(
"\n////////////////////////\n upload files:", // "\n////////////////////////\n upload files:",
values.containerID, // values.containerID,
"\n////////////////////////\n fileListObj:", // "\n////////////////////////\n fileListObj:",
fileListObj, // fileListObj,
"\n////////////////////////\n" // "\n////////////////////////\n"
); // );
var dataObj = values; var dataObj = values;
@@ -361,7 +361,7 @@ export const RenderLPACondtionalRadioList = ({
}) => { }) => {
const required = (value) => (value ? undefined : "Required"); const required = (value) => (value ? undefined : "Required");
console.log(error); //console.log(error);
return ( return (
<> <>
@@ -463,7 +463,7 @@ export const RenderPickList = ({
errorMsg, errorMsg,
...custom ...custom
}) => { }) => {
console.log(custom.disabled); // console.log(custom.disabled);
let { t } = useTranslation(); let { t } = useTranslation();
return ( return (
@@ -391,10 +391,10 @@ let RepLPA = (props) => {
{showQuestionnaireSection > 1 && ( {showQuestionnaireSection > 1 && (
<a <a
onClick={() => { onClick={() => {
window.scrollTo({ // window.scrollTo({
top: 0, // top: 0,
behavior: "smooth", // behavior: "smooth",
}); // });
setRepFileName( setRepFileName(
props.formObj[ props.formObj[
"representationForm" "representationForm"
@@ -89,7 +89,7 @@ let S78_Questionnaire = (props) => {
); );
resultsObj = resultsObj[0]; resultsObj = resultsObj[0];
console.log(resultsObj); //console.log(resultsObj);
const onHandleSubmit = (values) => { const onHandleSubmit = (values) => {
//if (currentSection == sectionCount) { //if (currentSection == sectionCount) {
@@ -1065,7 +1065,6 @@ S78_Questionnaire = connect((state) => {
})(S78_Questionnaire); })(S78_Questionnaire);
const mapStateToProps = (state, props) => { const mapStateToProps = (state, props) => {
console.log();
return { return {
search: state.search, search: state.search,
searchResultsObj: state.searchResultsObj, searchResultsObj: state.searchResultsObj,
+15 -6
View File
@@ -14,6 +14,8 @@ import MyRepresentations from "./myportal/myrepresentations";
import SearchCases from "./myportal/searchcases"; import SearchCases from "./myportal/searchcases";
import WatchedCases from "./myportal/watchedcases"; import WatchedCases from "./myportal/watchedcases";
import ServiceBanner from "./myportal/servicebanner"; import ServiceBanner from "./myportal/servicebanner";
import { JSONPath as jsonpath } from "jsonpath-plus";
import transLookup from "../data/lookuptranslations.json";
const MyPortal = (props) => { const MyPortal = (props) => {
const { showFileUpload, showLoginCheck } = props; const { showFileUpload, showLoginCheck } = props;
@@ -100,12 +102,19 @@ const MyPortal = (props) => {
{isLPA && ( {isLPA && (
<div> <div>
<h2 className="heading-small card-heading"> <h2 className="heading-small card-heading">
{ {router.locale == "cy"
props.accountDetails.accountDetails[ ? jsonpath(
"pinswg_contact_associatedlpa@OData.Community.Display.V1.FormattedValue" '$..[?(@.value=="' +
] props.accountDetails.accountDetails[
}{" "} "pinswg_contact_associatedlpa@OData.Community.Display.V1.FormattedValue"
LPA Portal ] +
'")].value_cy',
transLookup
)
: props.accountDetails.accountDetails[
"pinswg_contact_associatedlpa@OData.Community.Display.V1.FormattedValue"
]}{" "}
{t("myportal:lpa-portal-heading")}
</h2> </h2>
</div> </div>
)} )}
+3 -3
View File
@@ -85,7 +85,7 @@ const styles = StyleSheet.create({
}); });
export const EnforcementQuestionnaire_pdf = ({ docProps }) => { export const EnforcementQuestionnaire_pdf = ({ docProps }) => {
console.log(docProps); //console.log(docProps);
function formatDates(dateObj) { function formatDates(dateObj) {
var dateObj = new Date(dateObj); var dateObj = new Date(dateObj);
var dd = String(dateObj.getDate()).padStart(2, "0"); var dd = String(dateObj.getDate()).padStart(2, "0");
@@ -96,9 +96,9 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => {
} }
let values = docProps; let values = docProps;
let appealTypeValue = getFormCollectionByID(values.appealType); 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 ( return (
<Document> <Document>
<Page size="A4" style={styles.page} wrap> <Page size="A4" style={styles.page} wrap>
@@ -4,7 +4,7 @@ import {
Page, Page,
StyleSheet, StyleSheet,
Text, Text,
View View,
} from "@react-pdf/renderer"; } from "@react-pdf/renderer";
import Html from "react-pdf-html"; import Html from "react-pdf-html";
import { getFormCollectionByID } from "../../components/utils"; import { getFormCollectionByID } from "../../components/utils";
@@ -17,7 +17,7 @@ const getTrans = (locale, key) => {
let jsonObj = locale == "cy" ? transLookupCY : transLookupEN; let jsonObj = locale == "cy" ? transLookupCY : transLookupEN;
console.log(locale, jsonObj[key]); //console.log(locale, jsonObj[key]);
return jsonObj[key]; return jsonObj[key];
}; };
@@ -107,10 +107,10 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
return dd + "/" + mm + "/" + yyyy; return dd + "/" + mm + "/" + yyyy;
} }
let values = docProps; let values = docProps;
console.log("//////////////////////\n docprops:", docProps); //console.log("//////////////////////\n docprops:", docProps);
let appealTypeValue = getFormCollectionByID(values.appealType); let appealTypeValue = getFormCollectionByID(values.appealType);
console.log("sdffhjdhjdjdgkj: ", values.procedureType); //console.log("sdffhjdhjdjdgkj: ", values.procedureType);
return ( return (
<Document> <Document>
<Page size="A4" style={styles.page} wrap> <Page size="A4" style={styles.page} wrap>
+1
View File
@@ -2,6 +2,7 @@
"viewall-link": "Gweld y cyfan", "viewall-link": "Gweld y cyfan",
"viewall-link-count": "Gweld pob un o'r {{count}} achos", "viewall-link-count": "Gweld pob un o'r {{count}} achos",
"page-title": "Fy mhorth", "page-title": "Fy mhorth",
"lpa-portal-heading": "Porth LPA",
"makenewappeal-card-title": "Gwneud apêl newydd", "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-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.", "makenewappeal-card-link": "berthnasol i'r math o apêl sydd gennych.",
+1
View File
@@ -2,6 +2,7 @@
"viewall-link": "View all", "viewall-link": "View all",
"viewall-link-count": "View all {{count}} cases", "viewall-link-count": "View all {{count}} cases",
"page-title": "My Portal", "page-title": "My Portal",
"lpa-portal-heading": "LPA Portal",
"makenewappeal-card-title": "Make a new appeal", "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-paragraph-one": "Before submitting a new appeal, please ensure you have read all of the",
"makenewappeal-card-link": "relevant to your appeal type.", "makenewappeal-card-link": "relevant to your appeal type.",