delet blob wip
This commit is contained in:
+15
-8
@@ -11,18 +11,19 @@ NEXT_PUBLIC_HASHKEY = 028ffbae928d7191c0017f298260995f901d78eabde1436c0af0423459
|
||||
|
||||
//Dev oauth ESNR
|
||||
CLIENT_ID = 9b834097-03d7-409b-b038-ecfec31a394a
|
||||
CLIENT_SECRET = 4Vt8Q~olL1hx7n01B0~tXf-N2YL5DyC_Fk6waagX
|
||||
//CLIENT_SECRET = 4Vt8Q~olL1hx7n01B0~tXf-N2YL5DyC_Fk6waagX
|
||||
CLIENT_SECRET = AU88Q~NBOVOXqwb4mBx9y.NMIZ9s1o7boqZoKcSE
|
||||
RELAY_ROOT = https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/
|
||||
RELAYURI = "dev-pedw-ns.servicebus.windows.net"
|
||||
RELAYPATH = "dev-pedw-hc"
|
||||
|
||||
|
||||
//Test Oauth ESNR
|
||||
//CLIENT_ID = 6619ad85-c908-490d-811b-de8c93c0f2aa
|
||||
//CLIENT_SECRET = qKo7Q~5QvLEplbwnBbint_I5lXqx_-kDm8Vj-
|
||||
//RELAY_ROOT = https://test-pedw-ns.servicebus.windows.net/test-pedw-hc/
|
||||
//RELAYURI = "test-pedw-ns.servicebus.windows.net"
|
||||
//RELAYPATH = "test-pedw-hc"
|
||||
CLIENT_ID = d40b9373-96c2-4b04-8bd8-c2a2fe6444c1
|
||||
CLIENT_SECRET = IXI8Q~D5oqsC-nrtayHHc~tUAfjQFzNiKVQ~fc2S
|
||||
RELAY_ROOT = https://test-pedw-ns.servicebus.windows.net/test-pedw-hc/
|
||||
RELAYURI = "test-pedw-ns.servicebus.windows.net"
|
||||
RELAYPATH = "test-pedw-hc"
|
||||
|
||||
|
||||
//Preprod Oauth WGO
|
||||
@@ -43,7 +44,7 @@ RELAYPATH = "dev-pedw-hc"
|
||||
|
||||
|
||||
GOOGLE_TAG_MANAGER = GTM-T78CBC3
|
||||
SHOWLOGIN = "true"
|
||||
SHOWLOGIN = "false"
|
||||
SHOWREPRESENTATIONS = false
|
||||
SHOWFILEUPLOAD = "false"
|
||||
SHOWMAPS = "true"
|
||||
@@ -105,4 +106,10 @@ AZURE_TENANT_ID = $TENANT
|
||||
AZURE_CLIENT_SECRET = $CLIENT_SECRET
|
||||
|
||||
AZURE_PEDW_STORAGE_ENDPOINT = https://pedwdev.blob.core.windows.net
|
||||
AZURE_PEDW_CONTAINER = "pedwapplications"
|
||||
AZURE_PEDW_CONTAINER = "pedwapplications"
|
||||
|
||||
|
||||
|
||||
//gov.notify
|
||||
|
||||
NOTIFY_API_KEY = pedwnextauthkey-90f93710-9dae-423e-aea1-11eccd0dc132-0c9469d9-d671-444d-9e9d-3e5a62001043
|
||||
@@ -170,6 +170,35 @@ export const deleteBlob = async (containerName, blobName) => {
|
||||
return { "deleted": blobName };
|
||||
};
|
||||
|
||||
export const deleteBlobCase = async (containerName, blobName) => {
|
||||
const creds = new DefaultAzureCredential();
|
||||
|
||||
const options = {
|
||||
deleteSnapshots: "include", // or 'only'
|
||||
};
|
||||
|
||||
const containerClient = new ContainerClient(
|
||||
`${STORAGE_PATH}/${containerName}`,
|
||||
creds
|
||||
);
|
||||
|
||||
console.log("blob to delete:", blobName);
|
||||
|
||||
for await (const blob of containerClient.listBlobsFlat({
|
||||
prefix: blobName,
|
||||
})) {
|
||||
console.log(" ------ :", blob.name);
|
||||
containerClient.deleteBlob(blob.name);
|
||||
}
|
||||
|
||||
containerClient.deleteBlob(blobName);
|
||||
console.log(`deleted blob ${blobName}`);
|
||||
for await (const blob of containerClient.listBlobsFlat()) {
|
||||
console.log(" ------ :", blob.name);
|
||||
}
|
||||
return { "deleted": blobName };
|
||||
};
|
||||
|
||||
export const uploadFile = async (formContent, containerName, foldername) => {
|
||||
const creds = new DefaultAzureCredential();
|
||||
|
||||
|
||||
+16
-6
@@ -743,12 +743,22 @@ export const getAwaitingSubmissionProxy = (loggedInUserId) => {
|
||||
});
|
||||
};
|
||||
|
||||
export const getAwaitingSubmissionFromBlobProxy = (containerName) => {
|
||||
return axios
|
||||
.get(
|
||||
BASE_URL +
|
||||
"/api/file/getawaitingsubmissionfromblob?container=" +
|
||||
containerName
|
||||
)
|
||||
.then((res) => {
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
//console.log("API call error", error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getAwaitingSubmission = (loggedInUserId) => {
|
||||
console.log(
|
||||
BASE_URL +
|
||||
"/api/endpoint/getawaitingsubmission_api?loggedInUserId=" +
|
||||
loggedInUserId
|
||||
);
|
||||
return axios
|
||||
.get(
|
||||
BASE_URL +
|
||||
@@ -1041,7 +1051,7 @@ export const deleteAwaitingSubmissionsFromBlob = (
|
||||
casefolderID
|
||||
) => {
|
||||
var queryUrl =
|
||||
"/api/file/deleteawaitingsubmissionsfromblob?container=" +
|
||||
"/api/file/deleteblobcase?container=" +
|
||||
containerID +
|
||||
"&casefolderID=" +
|
||||
casefolderID;
|
||||
|
||||
@@ -221,7 +221,7 @@ let Login = (props) => {
|
||||
type="button"
|
||||
onClick={() =>
|
||||
signIn("email", {
|
||||
callbackUrl: "/myportal",
|
||||
callbackUrl: "/",
|
||||
})
|
||||
}
|
||||
>
|
||||
|
||||
+4
-3
@@ -25,16 +25,17 @@ const MainHome = (props) => {
|
||||
<div className="govuk-grid-row">
|
||||
<div className="govuk-grid-column-full">
|
||||
<div className="flex-container grid-row govuk-body ">
|
||||
<CaseSearch /> <Dns />
|
||||
{showLogin != "true" && <LoginSoon />}
|
||||
<CaseSearch />
|
||||
{showLogin == "true" && (
|
||||
<Login
|
||||
GG_CLIENT_ID={GG_CLIENT_ID}
|
||||
GG_REDIRECT_URI={GG_REDIRECT_URI}
|
||||
session={session}
|
||||
/>
|
||||
)}
|
||||
{showLogin != "true" && <LoginSoon />}
|
||||
)}{" "}
|
||||
<CaseComment />
|
||||
<Dns />
|
||||
{/* <Inspectorate /> */}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -107,6 +107,7 @@ const MyPortal = (props) => {
|
||||
.awaitingSubmissionFromBlob["@odata.count"] >
|
||||
0 && (
|
||||
<AwaitingSubmissionFromBlob
|
||||
containerID={props.containerID}
|
||||
awaitingSubmissionFromBlob={
|
||||
props.awaitingSubmission
|
||||
.awaitingSubmissionFromBlob
|
||||
|
||||
@@ -4,6 +4,13 @@ import useTranslation from "next-translate/useTranslation";
|
||||
import TopThree from "./topthree";
|
||||
import { connect } from "react-redux";
|
||||
import { setCurrentView } from "../../store/currentView/action";
|
||||
import {
|
||||
deleteAwaitingSubmissionsFromBlob,
|
||||
getAwaitingSubmissionFromBlobProxy,
|
||||
} from "../../actions";
|
||||
import { setAwaitingSubmissionFromBlob } from "../../store/awaitingSubmission/action";
|
||||
import { parseCookies, setCookie, destroyCookie } from "nookies";
|
||||
import { getFormCollectionByID } from "../../components/utils";
|
||||
|
||||
const AwaitingSubmissionFromBlob = (props) => {
|
||||
let { t } = useTranslation();
|
||||
@@ -15,16 +22,87 @@ const AwaitingSubmissionFromBlob = (props) => {
|
||||
let topthreeRow = [];
|
||||
let showTopThreeArr = props.awaitingSubmissionFromBlob.value;
|
||||
|
||||
const deleteCaseItem = (containerID, caseID) => {
|
||||
let cookies = parseCookies();
|
||||
console.log("sssss", containerID, caseID);
|
||||
|
||||
deleteAwaitingSubmissionsFromBlob(containerID, caseID)
|
||||
.then((data) => {
|
||||
return data;
|
||||
})
|
||||
.then(() => {
|
||||
getAwaitingSubmissionFromBlobProxy(containerID).then((data) => {
|
||||
props.setAwaitingSubmissionFromBlob(data);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
let topThreeOnlyArr = showTopThreeArr;
|
||||
console.log(showTopThreeArr);
|
||||
Object.keys(topThreeOnlyArr).map((key, index) => {
|
||||
topthreeRow.push(
|
||||
<div className="cardModuleItem" key={index}>
|
||||
<div className="cardModuleDetails">
|
||||
<div className="cardModuleReference">
|
||||
<b>{t("myportal:case-reference")}:</b>
|
||||
{showTopThreeArr[index].pinswg_name}
|
||||
</div>
|
||||
|
||||
<Link
|
||||
href={
|
||||
router.locale == "cy"
|
||||
? "/fymhorth/parhauigyflwyno"
|
||||
: "/myportal" +
|
||||
"/" +
|
||||
getFormCollectionByID(
|
||||
showTopThreeArr[key]
|
||||
.pinswg_appealcasetype
|
||||
).UrlName +
|
||||
"?lpa=" +
|
||||
showTopThreeArr[key][
|
||||
"_pinswg_associatedlpa_value"
|
||||
] +
|
||||
"&apt=" +
|
||||
showTopThreeArr[key]
|
||||
.pinswg_appealcasetype +
|
||||
"&casereference=" +
|
||||
showTopThreeArr[key].pinswg_name +
|
||||
"&inid=" +
|
||||
showTopThreeArr[key].incidentid
|
||||
}
|
||||
>
|
||||
<a
|
||||
className="govuk-link--no-underline"
|
||||
data-id={index}
|
||||
onClick={() => {
|
||||
setCurrentReference({
|
||||
"currentReference":
|
||||
topThreeType != "watchedCases"
|
||||
? topThreeType !=
|
||||
"myRepresentations"
|
||||
? showTopThreeArr[key]
|
||||
.ticketnumber
|
||||
: showTopThreeArr[key][
|
||||
"_pinswg_case_value@OData.Community.Display.V1.FormattedValue"
|
||||
]
|
||||
: showTopThreeArr[key][
|
||||
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
|
||||
],
|
||||
"currentType": topThreeType,
|
||||
|
||||
"incidentid": getIncidentId(
|
||||
topThreeType,
|
||||
showTopThreeArr[key]
|
||||
),
|
||||
|
||||
"appealType":
|
||||
showTopThreeArr[key]
|
||||
.pinswg_appealcasetype,
|
||||
});
|
||||
}}
|
||||
>
|
||||
{showTopThreeArr[index].pinswg_name}
|
||||
</a>
|
||||
</Link>
|
||||
</div>
|
||||
<div className="carModuleAddress">
|
||||
<b>{t("myportal:case-address")}:</b>{" "}
|
||||
{_.isEmpty(showTopThreeArr)
|
||||
@@ -54,6 +132,25 @@ const AwaitingSubmissionFromBlob = (props) => {
|
||||
: "")}
|
||||
</div>
|
||||
</div>
|
||||
<div className="">
|
||||
<a
|
||||
href="#"
|
||||
className=" cardModuleRemoveCase govuk-link govuk-link--no-underline govuk-link--inverse "
|
||||
onClick={() => {
|
||||
event.preventDefault();
|
||||
deleteCaseItem(
|
||||
props.containerID,
|
||||
showTopThreeArr[key].pinswg_name
|
||||
);
|
||||
alert(
|
||||
"You have deleted case " +
|
||||
showTopThreeArr[key].pinswg_name
|
||||
);
|
||||
}}
|
||||
>
|
||||
—
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
});
|
||||
@@ -99,6 +196,9 @@ const mapDispatchToProps = (dispatch) => {
|
||||
setCurrentView: (currentView) => {
|
||||
dispatch(setCurrentView(currentView));
|
||||
},
|
||||
setAwaitingSubmissionFromBlob: (awaitingSubmission) => {
|
||||
dispatch(setAwaitingSubmissionFromBlob(awaitingSubmission));
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -150,6 +150,7 @@ let BuildSection = (props) => {
|
||||
appTypeCollection.NavigationProperty;
|
||||
|
||||
Object.assign(updateBody, {
|
||||
"pinswg_appealcasetype": props.appealType.appealTypeID,
|
||||
"pinswg_Appellant@odata.bind":
|
||||
"/contacts(" + props.props.accountDetails.loggedinUserId + ")",
|
||||
"pinswg_name": props.appealType.caseReference.ticketnumber,
|
||||
|
||||
+1
-1
@@ -87,4 +87,4 @@
|
||||
"prettier": "2.5.1",
|
||||
"prisma": "^3.12.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ export default async function ApiProxy(req, res) {
|
||||
loggedInUserId +
|
||||
" and pinswg_appealcasetype ne null&$orderby=createdon desc&$count=true";
|
||||
|
||||
//console.log(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl));
|
||||
return axios
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
@@ -35,7 +36,6 @@ export default async function ApiProxy(req, res) {
|
||||
data.value.forEach(function (element) {
|
||||
element.pinswg_title = element.title;
|
||||
});
|
||||
//console.log(data);
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch((err) => {
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
import { hashAPIPath } from "../../../actions";
|
||||
import { deleteBlobCase } from "../../../actions/azurestorage";
|
||||
|
||||
import nextConnect from "next-connect";
|
||||
import middleware from "../middleware/middleware";
|
||||
|
||||
const ApiProxy = nextConnect();
|
||||
ApiProxy.use(middleware);
|
||||
|
||||
ApiProxy.get(async (req, res) => {
|
||||
var containerName = req.query.container;
|
||||
var casefolderID = req.query.casefolderID;
|
||||
var blobName = req.query.blobname;
|
||||
var checkHash = req.query.hash;
|
||||
|
||||
var checkquerypath =
|
||||
"/api/file/deleteblobcase?container=" +
|
||||
containerName +
|
||||
"&casefolderID=" +
|
||||
casefolderID;
|
||||
|
||||
// console.log(hashAPIPath(checkquerypath), checkHash);
|
||||
// console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash);
|
||||
|
||||
//if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) {
|
||||
await deleteBlobCase(containerName, casefolderID).then((data) => {
|
||||
return res.status(200).json({ data: data });
|
||||
});
|
||||
// } else {
|
||||
// return res.status(400).json();
|
||||
// }
|
||||
});
|
||||
|
||||
export const config = {
|
||||
api: {
|
||||
bodyParser: false,
|
||||
},
|
||||
};
|
||||
|
||||
export default ApiProxy;
|
||||
@@ -21,18 +21,18 @@ ApiProxy.get(async (req, res) => {
|
||||
// console.log(hashAPIPath(checkquerypath), checkHash);
|
||||
// console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash);
|
||||
|
||||
if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) {
|
||||
const blobObj = await getAllProgressBlobs(containerName)
|
||||
.then((data) => {
|
||||
//console.log(data);
|
||||
return downloadAllProgressFiles(containerName, data);
|
||||
})
|
||||
.then((data) => {
|
||||
return res.status(200).json(data);
|
||||
});
|
||||
} else {
|
||||
return res.status(400).json();
|
||||
}
|
||||
//if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) {
|
||||
const blobObj = await getAllProgressBlobs(containerName)
|
||||
.then((data) => {
|
||||
//console.log(data);
|
||||
return downloadAllProgressFiles(containerName, data);
|
||||
})
|
||||
.then((data) => {
|
||||
return res.status(200).json(data);
|
||||
});
|
||||
// } else {
|
||||
// return res.status(400).json();
|
||||
// }
|
||||
});
|
||||
|
||||
export const config = {
|
||||
|
||||
@@ -243,7 +243,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
query.casereference
|
||||
);
|
||||
|
||||
console.log("/////////\nappela tupe data:", appealTypeData);
|
||||
// console.log("/////////\nappeal type data:", appealTypeData);
|
||||
|
||||
//
|
||||
// Removed to make progress from Blob not CRM
|
||||
|
||||
@@ -144,6 +144,7 @@ const Home = (props) => {
|
||||
accountDetails={accountDetails}
|
||||
ggLogout={govGateway.config.end_session_endpoint}
|
||||
showFileUpload={showFileUpload}
|
||||
containerID={accountDetails.containerID}
|
||||
/>
|
||||
</div>
|
||||
<Footer footerLinks={footerLinks} />
|
||||
|
||||
Reference in New Issue
Block a user