update jsonpath library
This commit is contained in:
@@ -3,7 +3,7 @@ import { useRouter } from "next/router";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import { setCurrentReference } from "../../store/currentView/action";
|
||||
import { connect } from "react-redux";
|
||||
import jsonpath from "jsonpath";
|
||||
import { JSONPath as jsonpath } from "jsonpath-plus";
|
||||
import transLookup from "../../data/lookuptranslations.json";
|
||||
import { getFormCollectionByID } from "../../components/utils";
|
||||
|
||||
@@ -47,9 +47,9 @@ const ViewAllResults = (props) => {
|
||||
|
||||
let resultsRowArr = [];
|
||||
resultsArr.map((item, key) => {
|
||||
let detailsObj = jsonpath.query(
|
||||
searchDetailsObj,
|
||||
'$..value[?(@.pinswg_name=="' + item.pinswg_title + '")]'
|
||||
let detailsObj = jsonpath(
|
||||
'$..value[?(@.pinswg_name=="' + item.pinswg_title + '")]',
|
||||
searchDetailsObj
|
||||
);
|
||||
detailsObj = detailsObj[0];
|
||||
|
||||
@@ -297,11 +297,11 @@ const ViewAllResults = (props) => {
|
||||
{currentView.viewKey == "awaitingSubmissionDetails" &&
|
||||
_.has(resultsArr[key], "pinswg_lpaname")
|
||||
? router.locale == "cy"
|
||||
? jsonpath.query(
|
||||
transLookup,
|
||||
? jsonpath(
|
||||
'$..[?(@.value=="' +
|
||||
resultsArr[key].pinswg_lpaname +
|
||||
'")].value_cy'
|
||||
'")].value_cy',
|
||||
transLookup
|
||||
)
|
||||
: resultsArr[key].pinswg_lpaname || "N/A"
|
||||
: ""}
|
||||
@@ -309,13 +309,13 @@ const ViewAllResults = (props) => {
|
||||
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue",
|
||||
])
|
||||
? router.locale == "cy"
|
||||
? jsonpath.query(
|
||||
transLookup,
|
||||
? jsonpath(
|
||||
'$..[?(@.value=="' +
|
||||
resultsArr[key][
|
||||
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
|
||||
] +
|
||||
'")].value_cy'
|
||||
'")].value_cy',
|
||||
transLookup
|
||||
)
|
||||
: resultsArr[key][
|
||||
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
|
||||
@@ -325,13 +325,13 @@ const ViewAllResults = (props) => {
|
||||
"_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue",
|
||||
])
|
||||
? router.locale == "cy"
|
||||
? jsonpath.query(
|
||||
transLookup,
|
||||
? jsonpath(
|
||||
'$..[?(@.value=="' +
|
||||
searchDetailsObj[key].value[0][
|
||||
"_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValuee"
|
||||
] +
|
||||
'")].value_cy'
|
||||
'")].value_cy',
|
||||
transLookup
|
||||
)
|
||||
: currentView.viewKey == "myRepresentations"
|
||||
? searchDetailsObj[key].value
|
||||
@@ -343,13 +343,13 @@ const ViewAllResults = (props) => {
|
||||
"_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue",
|
||||
])
|
||||
? router.locale == "cy"
|
||||
? jsonpath.query(
|
||||
transLookup,
|
||||
? jsonpath(
|
||||
'$..[?(@.value=="' +
|
||||
resultsArr[key][
|
||||
"_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValuee"
|
||||
] +
|
||||
'")].value_cy'
|
||||
'")].value_cy',
|
||||
transLookup
|
||||
)
|
||||
: resultsArr[key][
|
||||
"_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue"
|
||||
@@ -359,13 +359,13 @@ const ViewAllResults = (props) => {
|
||||
: "N/A")
|
||||
: currentView.viewKey == "myRepresentations" &&
|
||||
router.locale == "cy" &&
|
||||
jsonpath.query(
|
||||
transLookup,
|
||||
jsonpath(
|
||||
'$..[?(@.value=="' +
|
||||
searchDetailsObj[key][
|
||||
"_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue"
|
||||
] +
|
||||
'")].value_cy'
|
||||
'")].value_cy',
|
||||
transLookup
|
||||
)}
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||
@@ -375,24 +375,24 @@ const ViewAllResults = (props) => {
|
||||
|
||||
{currentView.viewKey == "awaitingSubmissionDetails"
|
||||
? router.locale == "cy"
|
||||
? jsonpath.query(
|
||||
transLookup,
|
||||
? jsonpath(
|
||||
'$..[?(@.value=="' +
|
||||
getFormCollectionByID(
|
||||
item.pinswg_appealcasetype
|
||||
).value +
|
||||
'")].value_cy'
|
||||
'")].value_cy',
|
||||
transLookup
|
||||
)
|
||||
: getFormCollectionByID(item.pinswg_appealcasetype)
|
||||
.value || "N/A"
|
||||
: router.locale == "cy"
|
||||
? jsonpath.query(
|
||||
transLookup,
|
||||
? jsonpath(
|
||||
'$..[?(@.value=="' +
|
||||
item[
|
||||
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
|
||||
] +
|
||||
'")].value_cy'
|
||||
'")].value_cy',
|
||||
transLookup
|
||||
)
|
||||
: item[
|
||||
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
|
||||
@@ -403,13 +403,13 @@ const ViewAllResults = (props) => {
|
||||
|
||||
{currentView.viewKey == "myRepresentations" &&
|
||||
(router.locale == "cy"
|
||||
? jsonpath.query(
|
||||
transLookup,
|
||||
? jsonpath(
|
||||
'$..[?(@.value=="' +
|
||||
getFormCollectionByID(
|
||||
searchDetailsObj[key].appealType
|
||||
).value +
|
||||
'")].value_cy'
|
||||
'")].value_cy',
|
||||
transLookup
|
||||
)[0]
|
||||
: getFormCollectionByID(
|
||||
searchDetailsObj[key].appealType
|
||||
@@ -429,39 +429,39 @@ const ViewAllResults = (props) => {
|
||||
|
||||
{currentView.viewKey == "awaitingSubmissionDetails"
|
||||
? router.locale == "cy"
|
||||
? jsonpath.query(
|
||||
transLookup,
|
||||
? jsonpath(
|
||||
'$..[?(@.statuscode=="' +
|
||||
item.statuscode +
|
||||
'")].value_cy'
|
||||
'")].value_cy',
|
||||
transLookup
|
||||
)
|
||||
: jsonpath.query(
|
||||
transLookup,
|
||||
: jsonpath(
|
||||
'$..[?(@.statuscode=="' +
|
||||
item.statuscode +
|
||||
'")].value'
|
||||
'")].value',
|
||||
transLookup
|
||||
) || "N/A"
|
||||
: currentView.viewKey == "myRepresentations"
|
||||
? repRaisedDate(item.createdDate) // ? router.locale == "cy"
|
||||
: // ? jsonpath.query(
|
||||
// transLookup,
|
||||
: // ? jsonpath(
|
||||
//
|
||||
// '$..[?(@.value=="' +
|
||||
// searchDetailsObj[key].value[0][
|
||||
// "statuscode@OData.Community.Display.V1.FormattedValue"
|
||||
// ] +
|
||||
// '")].value_cy'
|
||||
// '")].value_cy',transLookup,
|
||||
// )
|
||||
// : searchDetailsObj[key].value[0][
|
||||
// "statuscode@OData.Community.Display.V1.FormattedValue"
|
||||
// ] || "N/A"
|
||||
// : router.locale == "cy"
|
||||
// ? jsonpath.query(
|
||||
// transLookup,
|
||||
// ? jsonpath(
|
||||
//
|
||||
// '$..[?(@.value=="' +
|
||||
// item[
|
||||
// "statuscode@OData.Community.Display.V1.FormattedValue"
|
||||
// ] +
|
||||
// '")].value_cy'
|
||||
// '")].value_cy',transLookup,
|
||||
// )
|
||||
item[
|
||||
"statuscode@OData.Community.Display.V1.FormattedValue"
|
||||
|
||||
Reference in New Issue
Block a user