updated query for my cases and long appealtypes

This commit is contained in:
robert.bond@test.gov.wales
2021-09-20 10:07:32 +01:00
parent c96a72f124
commit a9a8670691
8 changed files with 35 additions and 24 deletions
+21 -11
View File
@@ -19,22 +19,21 @@ const API_PATH = "/api/data/v8.2/";
//const WEBAPI_URL = "https://devcrm2016.llcdt.gov.wales/DVPINS" + API_PATH; //const WEBAPI_URL = "https://devcrm2016.llcdt.gov.wales/DVPINS" + API_PATH;
const WEBAPI_URL = "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; const WEBAPI_URL =
process.env.RELAY_ROOT ||
"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
const agent = new https.Agent({ const agent = new https.Agent({
rejectUnauthorized: false, rejectUnauthorized: false,
}); });
export const getSASToken = () => { export const getSASToken = () => {
// var ns = "dev-pedw-ns.servicebus.windows.net"; var m_ResourceURI =
// path = "dev-pedw-hc"; process.env.RELAYURI || "dev-pedw-ns.servicebus.windows.net";
// keyrule = "devpedwnspolicy"; var m_Path = process.env.RELAYPATH || "dev-pedw-hc";
// key = "Ml0Y/S/nfRcmIrHFRkO4jNm2J3iH52TSxPiak7+E1+Y="; var m_SasKey =
process.env.SASKEY || "Ml0Y/S/nfRcmIrHFRkO4jNm2J3iH52TSxPiak7+E1+Y=";
var m_ResourceURI = "dev-pedw-ns.servicebus.windows.net"; var m_SasKeyName = process.env.SASKEYNAME || "devpedwnspolicy";
var m_Path = "dev-pedw-hc";
var m_SasKey = "Ml0Y/S/nfRcmIrHFRkO4jNm2J3iH52TSxPiak7+E1+Y=";
var m_SasKeyName = "devpedwnspolicy";
var encodedResourceUri = encodeURIComponent( var encodedResourceUri = encodeURIComponent(
"https://" + m_ResourceURI + "/" + m_Path + "/" "https://" + m_ResourceURI + "/" + m_Path + "/"
@@ -67,7 +66,7 @@ export const getSASToken = () => {
}; };
const accessToken = const accessToken =
"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6IlVXelVaa0U3OE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Ke6BrsVjyaR9xSXsRJjgHPmJgWgnvq-2X0Dj7LCwXSEygDDOGlF1yqqN0Lv6qplhQoH-heZlC1K6qe_92nHPswXag6uN5nxTmk1Qw6zJt_aHMnXdwa18ghh4hGx5R0Jz53X113Q";
const SASToken = getSASToken(); const SASToken = getSASToken();
@@ -105,6 +104,17 @@ const azureHeaders = {
}, },
}; };
// const azureHeaders = {
// headers: {
// "OData-MaxVersion": "4.0",
// "OData-Version": "4.0",
// "Accept": "application/json",
// "Prefer": 'odata.include-annotations="*",return=representation',
// "Content-Type": "application/json",
// "Authorization": "Bearer " + accessToken,
// },
// };
export const getBasicSearch = (searchString) => { export const getBasicSearch = (searchString) => {
return axios return axios
.get( .get(
+1 -1
View File
@@ -93,7 +93,7 @@ let MakeRepresentation = (props) => {
? setRepresentationCapacity(false) ? setRepresentationCapacity(false)
: setRepresentationCapacity( : setRepresentationCapacity(
formObj["representationForm"].values.representationCapacity formObj["representationForm"].values.representationCapacity
.replace(/[\s\-\+\(\)\,\/]/g, "") .replace(/(\band|[\s\-\+\(\)\,\&])/g, "")
.toLowerCase() .toLowerCase()
); );
+3 -3
View File
@@ -107,7 +107,7 @@ let MakeRepresentation = (props) => {
) )
? false ? false
: formObj["representationForm"].values.representationCapacity : formObj["representationForm"].values.representationCapacity
.replace(/[\s\-\+\(\)\,\/]/g, "") .replace(/(\band|[\s\-\+\(\)\,\&])/g, "")
.toLowerCase(); .toLowerCase();
}; };
@@ -215,14 +215,14 @@ let MakeRepresentation = (props) => {
// console.log(_.isEmpty(currentView.representationCapacity)); // console.log(_.isEmpty(currentView.representationCapacity));
// console.log( // console.log(
// values.representationCapacity // values.representationCapacity
// .replace(/[\s\-\+\(\)\,\/]/g, "") // .replace(/(\band|[\s\-\+\(\)\,\&])/g, "")
// .toLowerCase() == currentView.representationCapacity // .toLowerCase() == currentView.representationCapacity
// ); // );
_.isEmpty(currentView.representationCapacity) _.isEmpty(currentView.representationCapacity)
? setRepresentationCapacity( ? setRepresentationCapacity(
values.representationCapacity values.representationCapacity
.replace(/[\s\-\+\(\)\,\/]/g, "") .replace(/(\band|[\s\-\+\(\)\,\&])/g, "")
.toLowerCase() .toLowerCase()
) )
: setRepresentationSubmit(true); : setRepresentationSubmit(true);
+1 -1
View File
@@ -21,7 +21,7 @@ const CaseSummary = (props) => {
} = props; } = props;
let setCaseQueryObj = props[currentType]; let setCaseQueryObj = props[currentType];
let setCaseDetailsObj = props[currentType][currentType + "Details"]; let setCaseDetailsObj = props[currentType + "Details"];
var casesObj = {}; var casesObj = {};
+3 -3
View File
@@ -22,7 +22,7 @@ let CompleteAppeal = (props) => {
"pinswg_" + "pinswg_" +
props.appealType.caseReference[ props.appealType.caseReference[
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue" "pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
].replace(/[\s\-\+\(\)\,\&\.]/g, "") + ].replace(/(\band|[\s\-\+\(\)\,\&])/g, "") +
"Ids"; "Ids";
Object.assign(updateBody, { Object.assign(updateBody, {
@@ -45,7 +45,7 @@ let CompleteAppeal = (props) => {
props.appealType.caseReference[ props.appealType.caseReference[
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue" "pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
] ]
.replace(/[\s\-\+\(\)\,\&\.]/g, "") .replace(/(\band|[\s\-\+\(\)\,\&])/g, "")
.toLowerCase() .toLowerCase()
); );
@@ -54,7 +54,7 @@ let CompleteAppeal = (props) => {
props.appealType.caseReference[ props.appealType.caseReference[
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue" "pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
] ]
.replace(/[\s\-\+\(\)\,\&\.]/g, "") .replace(/(\band|[\s\-\+\(\)\,\&])/g, "")
.toLowerCase() .toLowerCase()
); );
+1
View File
@@ -39,6 +39,7 @@ const Home = (props) => {
<Case <Case
props={props} props={props}
myCases={props.myCases.myCases} myCases={props.myCases.myCases}
myCasesDetails={props.myCases.myCasesDetails}
searchResultsObj={ searchResultsObj={
props.searchResultsObj.searchResultsObj props.searchResultsObj.searchResultsObj
} }
+4 -4
View File
@@ -102,7 +102,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
cookies.set("pinsUser", "f8b454ed-eded-eb11-aac7-00224800be9c", { cookies.set("pinsUser", "f8b454ed-eded-eb11-aac7-00224800be9c", {
httpOnly: true, // true by default httpOnly: true, // true by default
}); });
//console.log("my cases ", myCases);
const [ const [
myCasesDetails, myCasesDetails,
// myRepresentationsDetails, // myRepresentationsDetails,
@@ -143,8 +143,7 @@ const getFormCollection = (formtype) => {
}; };
const getDetails = (resultsObj) => { const getDetails = (resultsObj) => {
// console.log(resultsObj); //console.log(resultsObj);
let detailsArr = []; let detailsArr = [];
resultsObj = resultsObj.value; resultsObj = resultsObj.value;
const detailsObj = resultsObj.map((searchDetail, index) => { const detailsObj = resultsObj.map((searchDetail, index) => {
@@ -158,8 +157,9 @@ const getDetails = (resultsObj) => {
searchDetail[ searchDetail[
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue" "pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
] ]
.replace(/[\s\-\+\(\)\,\&\.]/g, "") .replace(/(\band|[\s\-\+\(\)\,\&])/g, "")
.toLowerCase() .toLowerCase()
.slice(0, 39)
), ),
searchDetail.ticketnumber searchDetail.ticketnumber
) )
+1 -1
View File
@@ -99,7 +99,7 @@ const getSearchDetails = (searchResultsObj) => {
searchDetail[ searchDetail[
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue" "pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
] ]
.replace(/[\s\-\+\(\)\,\&\.]/g, "") .replace(/(\band|[\s\-\+\(\)\,\&])/g, "")
.toLowerCase() .toLowerCase()
), ),
searchDetail.ticketnumber searchDetail.ticketnumber