Merged PR 1957: Fixes for d365
Related work items: #19548, #19887, #19889
This commit is contained in:
+22
-15
@@ -532,23 +532,30 @@ export const getBasicSearchDetailsPaged = async (
|
|||||||
appealTypeName,
|
appealTypeName,
|
||||||
caseReference,
|
caseReference,
|
||||||
primaryIdAttribute,
|
primaryIdAttribute,
|
||||||
incidentID
|
incidentIDs
|
||||||
) => {
|
) => {
|
||||||
//console.log("check appealtype:", appealType, caseReference);
|
if (!incidentIDs || incidentIDs.length === 0) return [];
|
||||||
|
|
||||||
return axios
|
// Build OData filter correctly
|
||||||
.get(
|
const filter = incidentIDs
|
||||||
"/api/endpoint/getbasicsearchdetailspaged_api?appealTypeName=" +
|
.map((id) => `_${primaryIdAttribute}s_value eq ${id}`)
|
||||||
appealTypeName +
|
.join(" or ");
|
||||||
"&primaryIdAttribute=" +
|
|
||||||
primaryIdAttribute +
|
const url = `/api/endpoint/getbasicsearchdetailspaged_api?appealTypeName=${appealTypeName}&primaryIdAttribute=${primaryIdAttribute}&incidentID=${encodeURIComponent(
|
||||||
"&incidentID=" +
|
filter
|
||||||
incidentID
|
)}`;
|
||||||
)
|
|
||||||
.then((res) => res.data)
|
// console.log(
|
||||||
.catch((error) => {
|
// `Fetching ${incidentIDs.length} incidents for appeal type: ${appealTypeName}`
|
||||||
consoleLogger(error);
|
// );
|
||||||
});
|
|
||||||
|
try {
|
||||||
|
const res = await axios.get(url);
|
||||||
|
return res.data.value || []; // ensure returning an array
|
||||||
|
} catch (error) {
|
||||||
|
consoleLogger(error);
|
||||||
|
return [];
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getSearchDocumentDetails = (incidentID) => {
|
export const getSearchDocumentDetails = (incidentID) => {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ export const getSelectQuery = (appealTypeName) => {
|
|||||||
return "&$select=pinswg_speacialistcaseprocess,modifiedon,_pinswg_appellant_value,pinswg_name,pinswg_siteaddresscounty,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_procedure,pinswg_questionnaireduedate,statuscode,pinswg_startdateoftheevent,pinswg_typeofevent,pinswg_startdate,pinswg_otherpartiesstatement,pinswg_finalcommentsduedate,pinswg_proofsofevidencewrittenstatementsofeviden,pinswg_speacialistcaseprocess,pinswg_statementduedate";
|
return "&$select=pinswg_speacialistcaseprocess,modifiedon,_pinswg_appellant_value,pinswg_name,pinswg_siteaddresscounty,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_procedure,pinswg_questionnaireduedate,statuscode,pinswg_startdateoftheevent,pinswg_typeofevent,pinswg_startdate,pinswg_otherpartiesstatement,pinswg_finalcommentsduedate,pinswg_proofsofevidencewrittenstatementsofeviden,pinswg_speacialistcaseprocess,pinswg_statementduedate";
|
||||||
break;
|
break;
|
||||||
case "pinswg_callinss77s":
|
case "pinswg_callinss77s":
|
||||||
return "&$select=modifiedon,_pinswg_appellant_value,pinswg_name,pinswg_siteaddresscounty,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_procedure,pinswg_proofsofevidencewrittenstatementsofeviden,pinswg_questionnaireduedate,pinswg_startdate,statuscode,pinswg_dateexportedtoiss,pinswg_startdateofevent,pinswg_typeofevent,pinswg_statementsduedate";
|
return "&$select=modifiedon,_pinswg_appellant_value,pinswg_name,pinswg_siteaddresscounty,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_procedure,pinswg_proofsofevidencewrittenstatementsofeviden,pinswg_questionnaireduedate,pinswg_startdate,statuscode,pinswg_dateexportedtoiss,pinswg_startdateofevent,pinswg_typeofevent,pinswg_statementsduedate,pinswg_otherpartiesstatement";
|
||||||
break;
|
break;
|
||||||
case "pinswg_commonlands":
|
case "pinswg_commonlands":
|
||||||
return "&$select=modifiedon,_pinswg_appellant_value,pinswg_name,pinswg_siteaddresscounty,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatement,pinswg_procedure,pinswg_proofsofevidencewrittenstatementsofeviden,pinswg_questionnaireduedate,pinswg_relevantauthorityname,pinswg_startdate,statuscode,pinswg_starttimeoftheevent,pinswg_typeofevent,pinswg_statementsduedate";
|
return "&$select=modifiedon,_pinswg_appellant_value,pinswg_name,pinswg_siteaddresscounty,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatement,pinswg_procedure,pinswg_proofsofevidencewrittenstatementsofeviden,pinswg_questionnaireduedate,pinswg_relevantauthorityname,pinswg_startdate,statuscode,pinswg_starttimeoftheevent,pinswg_typeofevent,pinswg_statementsduedate";
|
||||||
|
|||||||
@@ -221,7 +221,7 @@ function AppealsTab(props) {
|
|||||||
resultsArr.map((item, key) => {
|
resultsArr.map((item, key) => {
|
||||||
let detailsObj = jsonpath({
|
let detailsObj = jsonpath({
|
||||||
path:
|
path:
|
||||||
'$..value[?(@ && @.ticketnumber=="' +
|
'$..[?(@ && @.ticketnumber=="' +
|
||||||
item.ticketnumber +
|
item.ticketnumber +
|
||||||
'")]',
|
'")]',
|
||||||
json: searchDetailsObj,
|
json: searchDetailsObj,
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ const CaseSummary = (props) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
setCaseInvolvment(incidentid, loggedInUser);
|
//setCaseInvolvment(incidentid, loggedInUser);
|
||||||
};
|
};
|
||||||
|
|
||||||
const isWatchedCase = (whichIncident) => {
|
const isWatchedCase = (whichIncident) => {
|
||||||
|
|||||||
@@ -303,7 +303,7 @@ const DNSSearchResults = (props) => {
|
|||||||
resultsArr.map((item, key) => {
|
resultsArr.map((item, key) => {
|
||||||
let detailsObj = jsonpath({
|
let detailsObj = jsonpath({
|
||||||
path:
|
path:
|
||||||
'$..value[?(@ && @.ticketnumber=="' +
|
'$..[?(@ && @.ticketnumber=="' +
|
||||||
item.ticketnumber +
|
item.ticketnumber +
|
||||||
'")]',
|
'")]',
|
||||||
json: searchDetailsObj,
|
json: searchDetailsObj,
|
||||||
@@ -798,7 +798,14 @@ const DNSSearchResults = (props) => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{resultsArr.length > 0 ? (
|
|
||||||
|
{!searchLoaded ? (
|
||||||
|
<div className="govuk-grid-row">
|
||||||
|
<div className="govuk-grid-column-two-thirds">
|
||||||
|
<h3>Loading...</h3>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
) : resultsArr.length > 0 ? (
|
||||||
ResultsView(resultsArr)
|
ResultsView(resultsArr)
|
||||||
) : (
|
) : (
|
||||||
<div className="govuk-grid-row">
|
<div className="govuk-grid-row">
|
||||||
@@ -807,6 +814,16 @@ const DNSSearchResults = (props) => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{/* {resultsArr.length > 0 ? (
|
||||||
|
ResultsView(resultsArr)
|
||||||
|
) : (
|
||||||
|
<div className="govuk-grid-row">
|
||||||
|
<div className="govuk-grid-column-two-thirds">
|
||||||
|
<h3>{t("search:searchresults-no-records-label")}</h3>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)} */}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -244,7 +244,7 @@ const SearchResults = (props) => {
|
|||||||
resultsArr.map((item, key) => {
|
resultsArr.map((item, key) => {
|
||||||
let detailsObj = jsonpath({
|
let detailsObj = jsonpath({
|
||||||
path:
|
path:
|
||||||
'$..value[?(@ && @.ticketnumber=="' +
|
'$..[?(@ && @.ticketnumber=="' +
|
||||||
item.ticketnumber +
|
item.ticketnumber +
|
||||||
'")]',
|
'")]',
|
||||||
json: searchDetailsObj,
|
json: searchDetailsObj,
|
||||||
|
|||||||
+138
-41
@@ -179,49 +179,146 @@ export const getPartSavedDetails = (searchResultsObj) => {
|
|||||||
* Get the details of a case from the appeal type
|
* Get the details of a case from the appeal type
|
||||||
* @param object searchResultsObj
|
* @param object searchResultsObj
|
||||||
*/
|
*/
|
||||||
export const getSearchDetailsPaged = (searchResultsObj) => {
|
// export const getSearchDetailsPaged = (searchResultsObj) => {
|
||||||
let detailsArr = [];
|
// let detailsArr = [];
|
||||||
searchResultsObj = searchResultsObj.value;
|
// searchResultsObj = searchResultsObj.value;
|
||||||
const detailsObj = searchResultsObj.map((searchDetail, index) => {
|
// const detailsObj = searchResultsObj.map((searchDetail, index) => {
|
||||||
if (searchDetail.pinswg_appealcasetype == null) {
|
// if (searchDetail.pinswg_appealcasetype == null) {
|
||||||
console.log(searchDetail.title);
|
// console.log(searchDetail.title);
|
||||||
} else {
|
// } else {
|
||||||
let formMeta = getFormCollectionByID(
|
// let formMeta = getFormCollectionByID(
|
||||||
searchDetail.pinswg_appealcasetype
|
// searchDetail.pinswg_appealcasetype
|
||||||
);
|
// );
|
||||||
formMeta?.LogicalCollectionName &&
|
// formMeta?.LogicalCollectionName &&
|
||||||
formMeta?.LogicalCollectionName != "pinswg_sipses" &&
|
// formMeta?.LogicalCollectionName != "pinswg_sipses" &&
|
||||||
detailsArr.push(
|
// detailsArr.push(
|
||||||
getBasicSearchDetailsPaged(
|
// getBasicSearchDetailsPaged(
|
||||||
formMeta.LogicalCollectionName,
|
// formMeta.LogicalCollectionName,
|
||||||
searchDetail.title,
|
// searchDetail.title,
|
||||||
formMeta.PrimaryIdAttribute,
|
// formMeta.PrimaryIdAttribute,
|
||||||
searchDetail.incidentid
|
// searchDetail.incidentid
|
||||||
)
|
// )
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
return Promise.all(detailsArr);
|
// return Promise.all(detailsArr);
|
||||||
};
|
|
||||||
|
|
||||||
// export const absoluteUrl = (req, setLocalhost) => {
|
|
||||||
// var protocol = "https:";
|
|
||||||
// var host = req
|
|
||||||
// ? req.headers["x-forwarded-host"] || req.headers["host"]
|
|
||||||
// : window.location.host;
|
|
||||||
|
|
||||||
// if (host.indexOf("localhost") > -1) {
|
|
||||||
// if (setLocalhost) host = setLocalhost;
|
|
||||||
// protocol = "http:";
|
|
||||||
// }
|
|
||||||
|
|
||||||
// return {
|
|
||||||
// protocol: protocol,
|
|
||||||
// host: host,
|
|
||||||
// origin: protocol + "//" + host,
|
|
||||||
// };
|
|
||||||
// };
|
// };
|
||||||
|
|
||||||
|
// export const getSearchDetailsPaged = async (searchResultsObj) => {
|
||||||
|
// const searchResults = searchResultsObj.value;
|
||||||
|
|
||||||
|
// //Group incidents by appeal type
|
||||||
|
// const groupedByAppealType = {};
|
||||||
|
|
||||||
|
// searchResults.forEach((incident) => {
|
||||||
|
// const appealType = incident.pinswg_appealcasetype;
|
||||||
|
// if (!appealType) return;
|
||||||
|
|
||||||
|
// const formMeta = getFormCollectionByID(appealType);
|
||||||
|
// if (
|
||||||
|
// !formMeta?.LogicalCollectionName ||
|
||||||
|
// formMeta.LogicalCollectionName === "pinswg_sipses"
|
||||||
|
// )
|
||||||
|
// return;
|
||||||
|
|
||||||
|
// const key = formMeta.LogicalCollectionName;
|
||||||
|
// if (!groupedByAppealType[key]) groupedByAppealType[key] = [];
|
||||||
|
// groupedByAppealType[key].push({
|
||||||
|
// incidentID: incident.incidentid,
|
||||||
|
// caseReference: incident.title,
|
||||||
|
// primaryIdAttribute: formMeta.PrimaryIdAttribute,
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
|
||||||
|
// // Make all API calls in parallel per appeal type
|
||||||
|
// const allDetails = await Promise.all(
|
||||||
|
// Object.entries(groupedByAppealType).map(
|
||||||
|
// async ([appealTypeName, incidents]) => {
|
||||||
|
// console.log(
|
||||||
|
// `Fetching details for appeal type: ${appealTypeName}, incidents: ${incidents.length}`
|
||||||
|
// );
|
||||||
|
|
||||||
|
// // Fully parallel for each incident
|
||||||
|
// const results = await Promise.all(
|
||||||
|
// incidents.map((i) =>
|
||||||
|
// getBasicSearchDetailsPaged(
|
||||||
|
// appealTypeName,
|
||||||
|
// i.caseReference,
|
||||||
|
// i.primaryIdAttribute,
|
||||||
|
// i.incidentID
|
||||||
|
// ).catch((err) => {
|
||||||
|
// console.error(
|
||||||
|
// `Error fetching incident ${i.caseReference}:`,
|
||||||
|
// err
|
||||||
|
// );
|
||||||
|
// return null; // continue other calls even if one fails
|
||||||
|
// })
|
||||||
|
// )
|
||||||
|
// );
|
||||||
|
|
||||||
|
// return results.filter((r) => r); // remove nulls from failed calls
|
||||||
|
// }
|
||||||
|
// )
|
||||||
|
// );
|
||||||
|
|
||||||
|
// //Flatten all results into a single array
|
||||||
|
// return allDetails.flat();
|
||||||
|
// };
|
||||||
|
|
||||||
|
export const getSearchDetailsPaged = async (searchResultsObj) => {
|
||||||
|
searchResultsObj = searchResultsObj.value;
|
||||||
|
|
||||||
|
// Group incidents by appeal type
|
||||||
|
const groupedByAppealType = searchResultsObj.reduce((acc, detail) => {
|
||||||
|
const appealType = detail.pinswg_appealcasetype;
|
||||||
|
if (!appealType) {
|
||||||
|
console.log("No appeal type for:", detail.title);
|
||||||
|
return acc;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!acc[appealType]) acc[appealType] = [];
|
||||||
|
acc[appealType].push({
|
||||||
|
incidentID: detail.incidentid,
|
||||||
|
title: detail.title,
|
||||||
|
});
|
||||||
|
return acc;
|
||||||
|
}, {});
|
||||||
|
|
||||||
|
const allDetails = [];
|
||||||
|
|
||||||
|
// For each appeal type, call getBasicSearchDetailsPaged once with all incident IDs
|
||||||
|
for (const [appealType, incidents] of Object.entries(groupedByAppealType)) {
|
||||||
|
const incidentIDs = incidents.map((i) => i.incidentID);
|
||||||
|
|
||||||
|
// Get the form meta for this appeal type to access primaryIdAttribute
|
||||||
|
const formMeta = getFormCollectionByID(appealType);
|
||||||
|
|
||||||
|
if (!formMeta || !formMeta.PrimaryIdAttribute) {
|
||||||
|
console.log(`Missing form metadata for appeal type: ${appealType}`);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// console.log(
|
||||||
|
// `Fetching ${incidentIDs.length} incidents for appeal type: ${appealType} with primaryIdAttribute: ${formMeta.PrimaryIdAttribute}`
|
||||||
|
// );
|
||||||
|
|
||||||
|
try {
|
||||||
|
const details = await getBasicSearchDetailsPaged(
|
||||||
|
formMeta.LogicalCollectionName, // appealTypeName
|
||||||
|
null, // caseReference is no longer used in batch
|
||||||
|
formMeta.PrimaryIdAttribute, // primaryIdAttribute
|
||||||
|
incidentIDs // pass array of incidentIDs
|
||||||
|
);
|
||||||
|
|
||||||
|
allDetails.push(...details);
|
||||||
|
} catch (err) {
|
||||||
|
consoleLogger(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return allDetails;
|
||||||
|
};
|
||||||
|
|
||||||
export const getProgressObj = (
|
export const getProgressObj = (
|
||||||
formObjXML,
|
formObjXML,
|
||||||
titleList,
|
titleList,
|
||||||
|
|||||||
@@ -124,8 +124,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
// "=============================== Advanced Search results:",
|
// "=============================== Advanced Search results:",
|
||||||
// searchResultsObj
|
// searchResultsObj
|
||||||
// );
|
// );
|
||||||
const searchDetailsObj =
|
// const searchDetailsObj =
|
||||||
(await getSearchDetails(searchResultsObj)) || null;
|
// (await getSearchDetails(searchResultsObj)) || null;
|
||||||
// console.log(
|
// console.log(
|
||||||
// "=============================== Advanced Search results details:",
|
// "=============================== Advanced Search results details:",
|
||||||
// searchDetailsObj
|
// searchDetailsObj
|
||||||
@@ -136,7 +136,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
store.dispatch(setShowReps(showReps, showLoginCheck));
|
store.dispatch(setShowReps(showReps, showLoginCheck));
|
||||||
|
|
||||||
store.dispatch(setSearchResults(searchResultsObj));
|
store.dispatch(setSearchResults(searchResultsObj));
|
||||||
store.dispatch(setSearchDetails(searchDetailsObj));
|
// store.dispatch(setSearchDetails(searchDetailsObj));
|
||||||
store.dispatch(setSearch(Object.entries(query)));
|
store.dispatch(setSearch(Object.entries(query)));
|
||||||
return {
|
return {
|
||||||
props: {
|
props: {
|
||||||
|
|||||||
@@ -66,9 +66,7 @@ export default async function ApiProxy(req, res) {
|
|||||||
|
|
||||||
var queryUrl =
|
var queryUrl =
|
||||||
appealTypeName +
|
appealTypeName +
|
||||||
"?$filter=_" +
|
"?$filter=" +
|
||||||
primaryIdAttribute +
|
|
||||||
"s_value eq " +
|
|
||||||
incidentID +
|
incidentID +
|
||||||
"&$count=true" +
|
"&$count=true" +
|
||||||
"&$expand=" +
|
"&$expand=" +
|
||||||
@@ -79,7 +77,7 @@ export default async function ApiProxy(req, res) {
|
|||||||
|
|
||||||
queryUrl = queryUrl + getSelectQuery(appealTypeName);
|
queryUrl = queryUrl + getSelectQuery(appealTypeName);
|
||||||
|
|
||||||
//console.log("query: ", queryUrl, "<<<<end query");
|
console.log("query: ", queryUrl, "<<<<end query");
|
||||||
|
|
||||||
return axios
|
return axios
|
||||||
.get(
|
.get(
|
||||||
|
|||||||
@@ -43,9 +43,11 @@ export default async function ApiProxy(req, res) {
|
|||||||
console.log(req.body, queryUrl);
|
console.log(req.body, queryUrl);
|
||||||
|
|
||||||
var crmUrl = "https://" + process.env.CRMURL;
|
var crmUrl = "https://" + process.env.CRMURL;
|
||||||
|
var crmVersion = process.env.CRMURL_VERSION;
|
||||||
|
|
||||||
var data = {
|
var data = {
|
||||||
"@odata.id": crmUrl + "/api/data/v8.2/contacts(" + contactid + ")",
|
"@odata.id":
|
||||||
|
crmUrl + "/api/data/" + crmVersion + "/contacts(" + contactid + ")",
|
||||||
};
|
};
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
|
|||||||
+30
-27
@@ -124,38 +124,41 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
"public, s-maxage=10, stale-while-revalidate=59"
|
"public, s-maxage=10, stale-while-revalidate=59"
|
||||||
);
|
);
|
||||||
|
|
||||||
let searchResultsObj = await getBasicDNSSearch();
|
// let searchResultsObj = await getBasicDNSSearch();
|
||||||
|
|
||||||
searchResultsObj =
|
// searchResultsObj =
|
||||||
searchResultsObj.status == 502
|
// searchResultsObj.status == 502
|
||||||
? {
|
// ? {
|
||||||
value: [],
|
// value: [],
|
||||||
errorCode: searchResultsObj.status,
|
// errorCode: searchResultsObj.status,
|
||||||
errorMsg: searchResultsObj.statusText,
|
// errorMsg: searchResultsObj.statusText,
|
||||||
}
|
// }
|
||||||
: searchResultsObj;
|
// : searchResultsObj;
|
||||||
|
|
||||||
const showLoginCheck = process.env.SHOWLOGIN || false;
|
const showLoginCheck = process.env.SHOWLOGIN || false;
|
||||||
const showMapCheck = process.env.SHOWMAPS || false;
|
const showMapCheck = process.env.SHOWMAPS || false;
|
||||||
|
|
||||||
if (_.has(searchResultsObj, "status") == true) {
|
// if (_.has(searchResultsObj, "status") == true) {
|
||||||
return {
|
// return {
|
||||||
redirect: {
|
// redirect: {
|
||||||
//destination: "/dns-not-found",
|
// //destination: "/dns-not-found",
|
||||||
destination: "/error",
|
// destination: "/error",
|
||||||
permanent: false,
|
// permanent: false,
|
||||||
},
|
// },
|
||||||
};
|
// };
|
||||||
} else {
|
// } else {
|
||||||
const searchDetailsObj = await getSearchDetails(
|
// // const searchDetailsObj = await getSearchDetails(
|
||||||
searchResultsObj
|
// // searchResultsObj
|
||||||
);
|
// // );
|
||||||
const dnsCoords = await getDNSCoords();
|
// const dnsCoords = await getDNSCoords();
|
||||||
store.dispatch(setSearchResults(searchResultsObj));
|
// // store.dispatch(setSearchResults(searchResultsObj));
|
||||||
store.dispatch(setSearchDetails(searchDetailsObj));
|
// // store.dispatch(setSearchDetails(searchDetailsObj));
|
||||||
store.dispatch(setSearch("DNS"));
|
// store.dispatch(setSearch("DNS"));
|
||||||
store.dispatch(setDNSCoords(dnsCoords));
|
// store.dispatch(setDNSCoords(dnsCoords));
|
||||||
}
|
// }
|
||||||
|
const dnsCoords = await getDNSCoords();
|
||||||
|
store.dispatch(setSearch("DNS"));
|
||||||
|
store.dispatch(setDNSCoords(dnsCoords));
|
||||||
|
|
||||||
return {
|
return {
|
||||||
props: {
|
props: {
|
||||||
|
|||||||
@@ -107,17 +107,14 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
|
|
||||||
loggedInUser = loggedInUser.value[0].contactid;
|
loggedInUser = loggedInUser.value[0].contactid;
|
||||||
|
|
||||||
const [accountDetails, searchResultsObj, watchedCases] =
|
const [accountDetails, watchedCases] = await Promise.all([
|
||||||
await Promise.all([
|
await getPersonalAccount(loggedInUser),
|
||||||
await getPersonalAccount(loggedInUser),
|
await getWatchedCases(loggedInUser),
|
||||||
await getAdvancedSearch(query),
|
]);
|
||||||
await getWatchedCases(loggedInUser),
|
|
||||||
]);
|
|
||||||
|
|
||||||
console.log(accountDetails);
|
console.log(accountDetails);
|
||||||
|
|
||||||
const [searchDetailsObj, watchedCasesDetails] = await Promise.all([
|
const [watchedCasesDetails] = await Promise.all([
|
||||||
await getSearchDetails(searchResultsObj),
|
|
||||||
await getDetails(watchedCases, "myWatchedCases"),
|
await getDetails(watchedCases, "myWatchedCases"),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@@ -126,8 +123,6 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
store.dispatch(setShowReps(showReps, showLoginCheck));
|
store.dispatch(setShowReps(showReps, showLoginCheck));
|
||||||
|
|
||||||
store.dispatch(setAccountDetails(accountDetails));
|
store.dispatch(setAccountDetails(accountDetails));
|
||||||
store.dispatch(setSearchResults(searchResultsObj));
|
|
||||||
store.dispatch(setSearchDetails(searchDetailsObj));
|
|
||||||
store.dispatch(setWatchedCases(watchedCases));
|
store.dispatch(setWatchedCases(watchedCases));
|
||||||
store.dispatch(setWatchedCasesDetails(watchedCasesDetails));
|
store.dispatch(setWatchedCasesDetails(watchedCasesDetails));
|
||||||
store.dispatch(setSearch(Object.entries(query)));
|
store.dispatch(setSearch(Object.entries(query)));
|
||||||
|
|||||||
@@ -161,31 +161,28 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
let [accountDetails, searchResultsObj, watchedCases] =
|
let [accountDetails, watchedCases] = await Promise.all([
|
||||||
await Promise.all([
|
await getPersonalAccount(loggedInUser),
|
||||||
await getPersonalAccount(loggedInUser),
|
await getWatchedCases(loggedInUser),
|
||||||
await getBasicDNSSearch(),
|
]);
|
||||||
await getWatchedCases(loggedInUser),
|
|
||||||
]);
|
|
||||||
|
|
||||||
searchResultsObj =
|
// searchResultsObj =
|
||||||
searchResultsObj.status == 502
|
// searchResultsObj.status == 502
|
||||||
? {
|
// ? {
|
||||||
value: [],
|
// value: [],
|
||||||
errorCode: searchResultsObj.status,
|
// errorCode: searchResultsObj.status,
|
||||||
errorMsg: searchResultsObj.statusText,
|
// errorMsg: searchResultsObj.statusText,
|
||||||
}
|
// }
|
||||||
: searchResultsObj;
|
// : searchResultsObj;
|
||||||
|
|
||||||
const showMapCheck = process.env.SHOWMAPS || false;
|
const showMapCheck = process.env.SHOWMAPS || false;
|
||||||
|
|
||||||
const [searchDetailsObj, watchedCasesDetails] = await Promise.all([
|
const [watchedCasesDetails] = await Promise.all([
|
||||||
await getSearchDetails(searchResultsObj),
|
|
||||||
await getDetails(watchedCases, "myWatchedCases"),
|
await getDetails(watchedCases, "myWatchedCases"),
|
||||||
]);
|
]);
|
||||||
const dnsCoords = await getDNSCoords();
|
const dnsCoords = await getDNSCoords();
|
||||||
store.dispatch(setSearchResults(searchResultsObj));
|
// store.dispatch(setSearchResults(searchResultsObj));
|
||||||
store.dispatch(setSearchDetails(searchDetailsObj));
|
// store.dispatch(setSearchDetails(searchDetailsObj));
|
||||||
store.dispatch(setSearch("DNS"));
|
store.dispatch(setSearch("DNS"));
|
||||||
store.dispatch(setDNSCoords(dnsCoords));
|
store.dispatch(setDNSCoords(dnsCoords));
|
||||||
store.dispatch(setWatchedCases(watchedCases));
|
store.dispatch(setWatchedCases(watchedCases));
|
||||||
|
|||||||
@@ -100,20 +100,10 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
let [searchResultsObj, loggedInUser] = await Promise.all([
|
let [loggedInUser] = await Promise.all([
|
||||||
await getBasicSearch(query.q),
|
|
||||||
await getPortalLogin(thisSession.user.email),
|
await getPortalLogin(thisSession.user.email),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
searchResultsObj =
|
|
||||||
searchResultsObj.status == 502
|
|
||||||
? {
|
|
||||||
value: [],
|
|
||||||
errorCode: searchResultsObj.status,
|
|
||||||
errorMsg: searchResultsObj.statusText,
|
|
||||||
}
|
|
||||||
: searchResultsObj;
|
|
||||||
|
|
||||||
//console.log("sssss", searchResultsObj);
|
//console.log("sssss", searchResultsObj);
|
||||||
|
|
||||||
loggedInUser = loggedInUser.value[0].contactid;
|
loggedInUser = loggedInUser.value[0].contactid;
|
||||||
@@ -122,15 +112,11 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
|
|
||||||
//console.log("sssss", loggedInUser);
|
//console.log("sssss", loggedInUser);
|
||||||
|
|
||||||
const [accountDetails, searchDetailsObj, watchedCasesDetails] =
|
const [accountDetails, watchedCasesDetails] = await Promise.all([
|
||||||
await Promise.all([
|
await getPersonalAccount(loggedInUser),
|
||||||
await getPersonalAccount(loggedInUser),
|
await getDetails(watchedCases, "myWatchedCases"),
|
||||||
await getSearchDetails(searchResultsObj),
|
]);
|
||||||
await getDetails(watchedCases, "myWatchedCases"),
|
|
||||||
]);
|
|
||||||
store.dispatch(setAccountDetails(accountDetails));
|
store.dispatch(setAccountDetails(accountDetails));
|
||||||
store.dispatch(setSearchResults(searchResultsObj));
|
|
||||||
store.dispatch(setSearchDetails(searchDetailsObj));
|
|
||||||
store.dispatch(setSearch(query.q));
|
store.dispatch(setSearch(query.q));
|
||||||
store.dispatch(setWatchedCases(watchedCases));
|
store.dispatch(setWatchedCases(watchedCases));
|
||||||
store.dispatch(setWatchedCasesDetails(watchedCasesDetails));
|
store.dispatch(setWatchedCasesDetails(watchedCasesDetails));
|
||||||
|
|||||||
+24
-23
@@ -132,33 +132,34 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
const showReps = process.env.SHOWREPRESENTATIONS || false;
|
const showReps = process.env.SHOWREPRESENTATIONS || false;
|
||||||
store.dispatch(setShowReps(showReps, showLoginCheck));
|
store.dispatch(setShowReps(showReps, showLoginCheck));
|
||||||
|
|
||||||
let searchResultsObj = await getBasicSearch(query.q);
|
// let searchResultsObj = await getBasicSearch(query.q);
|
||||||
|
|
||||||
searchResultsObj =
|
// searchResultsObj =
|
||||||
searchResultsObj.status == 502
|
// searchResultsObj.status == 502
|
||||||
? {
|
// ? {
|
||||||
value: [],
|
// value: [],
|
||||||
errorCode: searchResultsObj.status,
|
// errorCode: searchResultsObj.status,
|
||||||
errorMsg: searchResultsObj.statusText,
|
// errorMsg: searchResultsObj.statusText,
|
||||||
}
|
// }
|
||||||
: searchResultsObj;
|
// : searchResultsObj;
|
||||||
|
|
||||||
if (_.has(searchResultsObj, "status") == true) {
|
// if (_.has(searchResultsObj, "status") == true) {
|
||||||
return {
|
// return {
|
||||||
redirect: {
|
// redirect: {
|
||||||
//destination: "/dns-not-found",
|
// //destination: "/dns-not-found",
|
||||||
destination: "/error",
|
// destination: "/error",
|
||||||
permanent: false,
|
// permanent: false,
|
||||||
},
|
// },
|
||||||
};
|
// };
|
||||||
} else {
|
// } else {
|
||||||
const searchDetailsObj = await getSearchDetails(searchResultsObj);
|
// // const searchDetailsObj = await getSearchDetails(searchResultsObj);
|
||||||
|
|
||||||
store.dispatch(setSearchResults(searchResultsObj));
|
// store.dispatch(setSearchResults(searchResultsObj));
|
||||||
store.dispatch(setSearchDetails(searchDetailsObj));
|
// // store.dispatch(setSearchDetails(searchDetailsObj));
|
||||||
store.dispatch(setSearch(query.q));
|
// store.dispatch(setSearch(query.q));
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
store.dispatch(setSearch(query.q));
|
||||||
return {
|
return {
|
||||||
props: {
|
props: {
|
||||||
isLinkedCase: isLinked,
|
isLinkedCase: isLinked,
|
||||||
|
|||||||
Reference in New Issue
Block a user