diff --git a/.env.local b/.env.local index a086b470..b24eb907 100644 --- a/.env.local +++ b/.env.local @@ -45,7 +45,7 @@ RELAYPATH = "dev-pedw-hc" GOOGLE_TAG_MANAGER = GTM-T78CBC3 SHOWLOGIN = "true" SHOWREPRESENTATIONS = false -SHOWFILEUPLOAD = "true" +SHOWFILEUPLOAD = "false" SHOWMAPS = "true" //BASIC_AUTH_CREDENTIALS = pinswg:password|pinswg2:password2 diff --git a/actions/azurestorage.js b/actions/azurestorage.js index bdcd8d78..f27f3208 100644 --- a/actions/azurestorage.js +++ b/actions/azurestorage.js @@ -6,8 +6,8 @@ import { EnvironmentCredential, ClientSecretCredential, } from "@azure/identity"; -import { hashAPIPath } from "."; - +import { consoleLogger, hashAPIPath } from "."; +import _ from "lodash"; const STORAGE_PATH = process.env.AZURE_PEDW_STORAGE_ENDPOINT; const STORAGE_CONTAINER = process.env.AZURE_PEDW_CONTAINER; @@ -79,6 +79,7 @@ export const getBlobs = async (containerName) => { "isCurrentVersion": blob.isCurrentVersion, "contentLength": blob.properties.contentLength, "contentType": blob.contentType, + "lastModified": blob.properties.lastModified, "hashedfilepath": hashAPIPath( "/api/file/downloadblob?container=" + containerName.toLowerCase() + @@ -191,6 +192,22 @@ export const downloadFile = async (containerName, blobName) => { return downloaded; }; +export const downloadProgressFile = async (containerName, blobName) => { + //console.log.apply(containerName, blobName); + const creds = new DefaultAzureCredential(); + + const containerClient = new ContainerClient( + `${STORAGE_PATH}/${containerName}`, + creds + ); + + const blobClient = containerClient.getBlobClient(blobName); + const downloadedBlob = await blobClient.download(0); + + const downloaded = await streamToBuffer(downloadedBlob.readableStreamBody); + return downloaded; +}; + const streamToBuffer = async (readableStream) => { return new Promise((resolve, reject) => { const chunks = []; @@ -203,3 +220,52 @@ const streamToBuffer = async (readableStream) => { readableStream.on("error", reject); }); }; + +export const getProgressBlobs = async (containerName) => { + const creds = new DefaultAzureCredential(); + + const containerClient = new ContainerClient( + `${STORAGE_PATH}/${containerName}`, + creds + ); + + containerClient.createIfNotExists(); + + let blobObj = []; + for await (const blob of containerClient.listBlobsFlat()) { + blobObj.push({ + "name": blob.name.split("/")[1], + "path": blob.name, + "versionId": blob.versionId, + "isCurrentVersion": blob.isCurrentVersion, + "contentLength": blob.properties.contentLength, + "contentType": blob.contentType, + "lastModified": blob.properties.lastModified, + "hashedfilepath": hashAPIPath( + "/api/file/downloadblob?container=" + + containerName.toLowerCase() + + "&blobname=" + + blob.name.split("/")[1] + ), + "hasheddeletepath": hashAPIPath( + "/api/file/deleteblob?container=" + + containerName.toLowerCase() + + "&blobname=" + + blob.name.split("/")[1] + ), + "hashgetblobs": hashAPIPath( + "/api/file/getbloblist?container=" + containerName.toLowerCase() + ), + }); + } + + blobObj = _.sortBy(blobObj, [ + function (o) { + return o.lastModified; + }, + ]).reverse()[0]; + + console.log(blobObj.path); + + return blobObj; +}; diff --git a/components/myportal/topthree.js b/components/myportal/topthree.js index 0321b5dc..f3244e78 100644 --- a/components/myportal/topthree.js +++ b/components/myportal/topthree.js @@ -254,25 +254,29 @@ const TopThree = (props) => { : "")} -
- {showTopThreeArr[key].pinswg_appellantagent != - 846040000 && Raised by: } - {showTopThreeArr[key].pinswg_appellantagent != - 846040000 && - (showTopThreeArr[key].pinswg_agentcompanyname != - null && - showTopThreeArr[key].pinswg_agentcompanyname + - ", ") + - showTopThreeArr[key].pinswg_agentfirstname + + {showTopThreeArr[key].pinswg_appellantagent != null && ( +
+ {showTopThreeArr[key].pinswg_appellantagent != + 846040000 && Raised by: } + {showTopThreeArr[key].pinswg_appellantagent != + 846040000 && + (showTopThreeArr[key].pinswg_agentcompanyname != + null && + showTopThreeArr[key] + .pinswg_agentcompanyname + ", ") + + showTopThreeArr[key].pinswg_agentfirstname + + " " + + showTopThreeArr[key].pinswg_agentlastname} +
+ )} + {showTopThreeArr[key].pinswg_appellantfirstname != null && ( +
+ On behalf of: + {showTopThreeArr[key].pinswg_appellantfirstname + " " + - showTopThreeArr[key].pinswg_agentlastname} -
-
- On behalf of: - {showTopThreeArr[key].pinswg_appellantfirstname + - " " + - showTopThreeArr[key].pinswg_appellantlastname} -
+ showTopThreeArr[key].pinswg_appellantlastname} +
+ )} {router.locale == "cy" ? jsonpath.query( diff --git a/components/newappeal/buildprogress.js b/components/newappeal/buildprogress.js index 38e6d3b1..10e60be6 100644 --- a/components/newappeal/buildprogress.js +++ b/components/newappeal/buildprogress.js @@ -31,6 +31,8 @@ const BuildProgress = (props) => { // props // ); + //console.log(progObj); + return ( <>