diff --git a/actions/azurestorage.js b/actions/azurestorage.js
index 10c41013..277fdcfd 100644
--- a/actions/azurestorage.js
+++ b/actions/azurestorage.js
@@ -276,16 +276,11 @@ export const createRepBlob = async (formContent, containerName, caseref) => {
const containerClient = new ContainerClient(sasUrl);
formContent = JSON.parse(formContent);
- let caseID = "";
-
- caseID = _.has(formContent, "pinswg_name")
- ? formContent.pinswg_name
- : caseref;
const content = JSON.stringify(formContent);
//console.log(content);
- const blobName = caseref + "/" + caseID + "_rep.json";
+ const blobName = caseref + "/" + formContent.repfile_name + "_rep.json";
console.log("blobName:", blobName);
const blockBlobClient = containerClient.getBlockBlobClient(blobName);
@@ -297,7 +292,7 @@ export const createRepBlob = async (formContent, containerName, caseref) => {
const tags = {
containerid: containerName,
- caseID: caseID,
+ caseID: formContent.caseRef,
blobType: "Representation",
};
@@ -378,13 +373,18 @@ export const uploadFile = async (formContent, containerName, foldername) => {
files[prop][0].path,
files[prop].size
);
+
+ console.log(
+ "////////////////////////\nfile name:",
+ files[prop][0].fieldName,
+ "\n////////////////////////////"
+ );
+
const tags = {
containerid: containerName,
- caseID: foldername,
- documentType: files[prop][0].fieldName.slice(
- 0,
- files[prop][0].fieldName.indexOf("_")
- ),
+ caseID: foldername.split("/")[0],
+ documentType: files[prop][0].fieldName.split(".")[1],
+ blobType: "RepresentationFile",
};
const withTags = await blockBlobClient.setTags(tags);
const withMeta = await blockBlobClient.setMetadata(tags);
@@ -410,21 +410,17 @@ export const uploadRepFiles = async (
console.log(...formContent);
console.log("rep files...", files, Object.keys(files).length, foldername);
- // console.log(`files[${prop}] = ${files[prop][0].size}`);
- const blobName = foldername + formContent.split("tmp/")[1];
-
- console.log(blobName);
-
+ const blobName = foldername + "/" + formContent.split("tmp/")[1];
const blockBlobClient = containerClient.getBlockBlobClient(blobName);
const uploadBlobResponse = await blockBlobClient.uploadFile(formContent);
const tags = {
containerid: containerName,
- caseID: foldername,
- documentType: "rep content",
+ caseID: formContent.split("tmp/")[0],
+ documentType: "Rep docs",
};
console.log(tags);
- // const withTags = await blockBlobClient.setTags(tags);
- // const withMeta = await blockBlobClient.setMetadata(tags);
+ const withTags = await blockBlobClient.setTags(tags);
+ const withMeta = await blockBlobClient.setMetadata(tags);
console.log(
`Uploaded block blob ${files} successfully`,
@@ -432,11 +428,10 @@ export const uploadRepFiles = async (
);
};
-export const uploadPDFRepFiles = async (
+export const uploadPDFCaseFiles = async (
formContent,
containerName,
- foldername,
- repType
+ foldername
) => {
const containerToken = await createContainerSas(containerName);
const sasUrl = `${STORAGE_PATH}/${containerName}?${containerToken}`;
@@ -446,28 +441,20 @@ export const uploadPDFRepFiles = async (
console.log(formContent, containerName, foldername);
console.log(
- "rep pdf files...",
+ "case pdf files...",
files,
Object.keys(files).length,
foldername
);
- // console.log(`files[${prop}] = ${files[prop][0].size}`);
- console.log(foldername + "/files/" + formContent.split("tmp/")[1]);
-
- const blobName = foldername + "/files/" + formContent.split("tmp/")[1];
-
- console.log(blobName);
-
- console.log(blobName);
+ const blobName = foldername + "/" + formContent.split("tmp/")[1];
const blockBlobClient = containerClient.getBlockBlobClient(blobName);
const uploadBlobResponse = await blockBlobClient.uploadFile(formContent);
const tags = {
containerid: containerName,
- caseID: foldername,
- documentType: repType,
- blobType: "RepresentationPDF",
+ caseID: foldername.split("/")[0],
+ blobType: "AppealPDF",
};
console.log("the tags:", tags);
@@ -481,7 +468,7 @@ export const uploadPDFRepFiles = async (
};
export const downloadFile = async (containerName, blobName) => {
- //console.log.apply(containerName, blobName);
+ //console.log(containerName, blobName);
const containerToken = await createContainerSas(containerName);
const sasUrl = `${STORAGE_PATH}/${containerName}?${containerToken}`;
const containerClient = new ContainerClient(sasUrl);
@@ -497,7 +484,7 @@ export const downloadProgressFile = async (
blobName,
casefolderID
) => {
- //console.log.apply(containerName, blobName);
+ console.log(containerName, blobName);
const containerToken = await createContainerSas(containerName);
const sasUrl = `${STORAGE_PATH}/${containerName}?${containerToken}`;
@@ -624,7 +611,7 @@ export const downloadAllRepsFiles = async (containerName, repsBlobObj) => {
repBlobObj = JSON.parse(repBlobObj);
- repBlobObj["casereference"] = repsBlobObj[prop].name.split("/")[0];
+ repBlobObj["casereference"] = repsBlobObj[prop].name.split("/")[1];
// repBlobObj = JSON.stringify(repBlobObj);
@@ -682,6 +669,17 @@ export const getCaseBlob = async (
content,
Buffer.byteLength(content)
);
+
+ const tags = {
+ containerid: containerName,
+ caseID: caseReference,
+ blobType: "Case",
+ };
+
+ console.log("the tags:", tags);
+ const withTags = await blockBlobClient.setTags(tags);
+ const withMeta = await blockBlobClient.setMetadata(tags);
+
return blobName;
};
@@ -699,22 +697,22 @@ export const getProgressBlobs = async (containerName, caseReference) => {
blobCount++;
}
- // console.log(
- // "this is the casefolder and blobcount:",
- // caseReference,
- // blobCount
- // );
+ console.log(
+ "this is the casefolder and blobcount:",
+ caseReference,
+ blobCount
+ );
let blobObj = [];
for await (const blob of containerClient.listBlobsFlat({
prefix: caseReference + "/" + caseReference + "_appeal.json",
})) {
- //console.log("getProgressBlobs in here");
+ console.log("getProgressBlobs in here", blob.name.split("/"));
blobObj.push({
"name": blob.name.split("/")[1],
"path": blob.name,
"versionId": blob.versionId,
- "caseObj": caseReference + "/" + caseReference + "_case.json",
+ "caseObj": caseReference + "/case/" + caseReference + "_case.json",
"isCurrentVersion": blob.isCurrentVersion,
"contentLength": blob.properties.contentLength,
"contentType": blob.contentType,
@@ -771,16 +769,16 @@ export const getAllProgressBlobs = async (containerName) => {
blobObj.push({
"name": blob.name.split("/")[1],
"path": blob.name,
- "versionId": blob.versionId,
+ //"versionId": blob.versionId,
"caseObj":
blob.name.split("/")[0] +
"/case/" +
blob.name.split("/")[0] +
"_case.json",
- "isCurrentVersion": blob.isCurrentVersion,
- "contentLength": blob.properties.contentLength,
- "contentType": blob.contentType,
- "lastModified": blob.properties.lastModified,
+ // "isCurrentVersion": blob.isCurrentVersion,
+ // "contentLength": blob.properties.contentLength,
+ // "contentType": blob.contentType,
+ // "lastModified": blob.properties.lastModified,
});
}
@@ -810,16 +808,26 @@ export const getRepsBlobs = async (containerName) => {
blobCount
);
+ const listOptions = {
+ includeMetadata: true,
+ includeSnapshots: false,
+ includeTags: true,
+ includeVersions: true,
+ };
+
let blobObj = [];
for await (const blob of containerClient.findBlobsByTags(
- "blobType='Representation'"
+ "blobType='Representation'",
+ listOptions
)) {
+ const blobClient = await containerClient.getBlobClient(blob.name);
console.log(blob);
- blob.name.split("/")[1].indexOf("_rep.json") > 0 &&
- blob.name.split("/")[1].indexOf("undefined") < 0 &&
+ blob.name.split("/")[2].indexOf("_rep.json") > 0 &&
+ blob.name.split("/")[2].indexOf("undefined") < 0 &&
blobObj.push({
- "name": blob.name.split("/")[1],
+ "name": blob.name.split("/")[2],
"path": blob.name,
+ "size": blobClient.getProperties().contentLength,
});
}
diff --git a/actions/index.js b/actions/index.js
index 0fb2eda5..b363b70c 100644
--- a/actions/index.js
+++ b/actions/index.js
@@ -1497,6 +1497,20 @@ export const downloadBlob = (containerName, blobName) => {
};
export const getProgressFromBlob = async (containerName, casereference) => {
+ console.log(
+ /////////////////\ngetProgressFromBlob",
+ BASE_URL +
+ "/api/file/getprogressobjblob?container=" +
+ containerName +
+ "&casefolderID=" +
+ casereference +
+ hashAPIPath(
+ "/api/file/getprogressobjblob?container=" +
+ containerName +
+ "&casefolderID=" +
+ casereference
+ )
+ );
try {
const res = await axios.get(
BASE_URL +
diff --git a/components/case/representation/index copy.js b/components/case/representation/index copy.js
deleted file mode 100644
index 5eaff2cd..00000000
--- a/components/case/representation/index copy.js
+++ /dev/null
@@ -1,212 +0,0 @@
-import Link from "next/link";
-import { useState, useEffect } from "react";
-import { useRouter } from "next/router";
-import useTranslation from "next-translate/useTranslation";
-import jsonpath from "jsonpath";
-import _ from "lodash";
-import { Field, FieldArray, reduxForm, formValueSelector } from "redux-form";
-import { connect } from "react-redux";
-import { useDropzone } from "react-dropzone";
-
-import { setRepresentationCapacity } from "../../../store/currentView/action";
-import RepCapacitySelection from "./representationCapacitySelection";
-import RepDetails from "./representationDetails";
-import RepAppellant from "./representationAppellant";
-import RepAgent from "./representationAgent";
-import RepInterestedPartyPerson from "./representationInterestedPartyPerson";
-import RepLandOwner from "./representationLandowner";
-import {
- RenderPickList,
- RenderRadioList,
- RenderTextfield,
-} from "./representationElements";
-
-let MakeRepresentation = (props) => {
- let { t } = useTranslation();
- const { acceptedFiles, getRootProps, getInputProps } = useDropzone();
-
- const [clearRepForm, setClearRepForm] = useState(false);
-
- const router = useRouter();
- const { locale } = router;
- const {
- caseReference,
- myCases,
- myRepresentations,
- watchedCases,
- awaitingSubmission,
- searchResultsObj,
- currentType,
- currentView,
- setRepresentationCapacity,
- } = props;
- const formObj = props.props.form;
- let setCaseQueryObj = props[currentType];
- var casesObj = {};
-
- currentType == "searchResultsObj"
- ? (casesObj = jsonpath.query(
- setCaseQueryObj,
- '$..[?(@.title=="' + caseReference + '")]'
- ))
- : (casesObj = jsonpath.query(
- setCaseQueryObj,
- '$..[?(@.reference=="' + caseReference + '")]'
- ));
-
- casesObj = Object.assign({}, ...casesObj);
-
- const capacityOptionsArr = [
- "Appellant",
- "Agent",
- "Interested Party/Person",
- "Land Owner",
- ];
-
- const appellantApplicantRepresentationArr = [
- "Other",
- "Statement",
- "Statement of common ground",
- "Written statement of evidence",
- ];
-
- const interestedPersonRepresentationArr = [
- "Interested Party/Person correspondence",
- ];
-
- const landOwnerRepresentationArr = [
- "Other",
- "Statement",
- "Written statement of evidence",
- ];
-
- const repCapacityType = () => {
- currentView.representationCapacity == false
- ? false
- : _.isEmpty(formObj["representationForm"])
- ? false
- : _.isEmpty(formObj["representationForm"].values)
- ? false
- : _.isEmpty(
- formObj["representationForm"].values.representationCapacity
- )
- ? setRepresentationCapacity(false)
- : setRepresentationCapacity(
- formObj["representationForm"].values.representationCapacity
- .replace(/(\band|[\s\-\+\(\)\,\&])/g, "")
- .toLowerCase()
- );
-
- return currentView.representationCapacity;
- };
-
- const whichControl = () => {
- repCapacityType();
- switch (currentView.representationCapacity) {
- case false:
- return (
-
@@ -924,24 +919,25 @@ let RepLPA = (props) => { const selector = formValueSelector("representationForm"); // <-- same as form name RepLPA = connect((state) => { - const representationTypeValue = selector(state, "representationType"); - const procedureTypeValue = selector(state, "procedureType"); + const representationType = selector(state, "representationType"); + const procedureType = selector(state, "procedureType"); return { - procedureTypeValue, - representationTypeValue, + procedureType, + representationType, }; })(RepLPA); const mapStateToProps = (state, props) => { console.log(); return { - initialValues: { - onBehalfOfLPA: - props.props.props.accountDetails.accountDetails[ - "pinswg_contact_associatedlpa@OData.Community.Display.V1.FormattedValue" - ], - }, + search: state.search, + searchResultsObj: state.searchResultsObj, + formData: state.formData, + appealType: state.appealType, + currentView: state.currentView, + myRepresentations: state.myRepresentations, + initialValues: state.currentView.caseReference.repDetails, }; }; diff --git a/components/case/representation/representationLPACapacitySelection.js b/components/case/representation/representationLPACapacitySelection.js index d1ef7b9d..a3e88cf4 100644 --- a/components/case/representation/representationLPACapacitySelection.js +++ b/components/case/representation/representationLPACapacitySelection.js @@ -50,6 +50,7 @@ let RepLPACapacitySelection = (props) => { casesObj={casesObj} caseReference={props.props.caseReference} searchResultsObj={props.props.searchResultsObj} + props={props.props} />{" "}