update jsonpath library

This commit is contained in:
2024-02-08 14:28:40 +00:00
parent f034f4be3d
commit 2af463fbe9
67 changed files with 961 additions and 966 deletions
+23 -23
View File
@@ -3,7 +3,7 @@ import { useRouter } from "next/router";
import { useState, useEffect, useRef } from "react";
import { useDispatch, useSelector, shallowEqual, connect } from "react-redux";
import useTranslation from "next-translate/useTranslation";
import jsonpath from "jsonpath";
import { JSONPath as jsonpath } from "jsonpath-plus";
import _ from "lodash";
import transLookup from "../../data/lookuptranslations.json";
@@ -137,9 +137,9 @@ const CaseSummary = (props) => {
};
const isWatchedCase = (whichIncident) => {
let isWatched = jsonpath.query(
watchedCases,
"$..value[?(@._pinswg_watchedcase_value=='" + whichIncident + "')]"
let isWatched = jsonpath(
"$..value[?(@._pinswg_watchedcase_value=='" + whichIncident + "')]",
watchedCases
);
return isWatched;
@@ -168,23 +168,23 @@ const CaseSummary = (props) => {
var casesObj = {};
currentType == "searchResultsObj"
? (casesObj = jsonpath.query(
searchResultsObj,
'$..[?(@.title=="' + caseReference + '")]'
? (casesObj = jsonpath(
'$..[?(@.title=="' + caseReference + '")]',
searchResultsObj
))
: currentType == "watchedCases"
? (casesObj = jsonpath.query(
setCaseQueryObj,
'$..[?(@.pinswg_title=="' + caseReference + '")]'
? (casesObj = jsonpath(
'$..[?(@.pinswg_title=="' + caseReference + '")]',
setCaseQueryObj
))
: currentType == "myCases"
? (casesObj = jsonpath.query(
setCaseQueryObj,
'$..[?(@.pinswg_title=="' + caseReference + '")]'
? (casesObj = jsonpath(
'$..[?(@.pinswg_title=="' + caseReference + '")]',
setCaseQueryObj
))
: (casesObj = jsonpath.query(
setCaseQueryObj,
'$..[?(@.reference=="' + caseReference + '")]'
: (casesObj = jsonpath(
'$..[?(@.reference=="' + caseReference + '")]',
setCaseQueryObj
));
casesObj = Object.assign({}, ...casesObj);
@@ -192,13 +192,13 @@ const CaseSummary = (props) => {
var detailsObj = {};
currentType == "searchResultsObj"
? (detailsObj = jsonpath.query(
searchDetailsObj,
'$..[?(@.pinswg_name=="' + caseReference + '")]'
? (detailsObj = jsonpath(
'$..[?(@.pinswg_name=="' + caseReference + '")]',
searchDetailsObj
))
: (detailsObj = jsonpath.query(
setCaseDetailsObj,
'$..[?(@.pinswg_name=="' + caseReference + '")]'
: (detailsObj = jsonpath(
'$..[?(@.pinswg_name=="' + caseReference + '")]',
setCaseDetailsObj
));
detailsObj = detailsObj[0];
@@ -366,7 +366,7 @@ const CaseSummary = (props) => {
</dt>
<dd className="govuk-summary-list__value">
{router.locale == "cy"
? jsonpath.query(
? jsonpath(
transLookup,
'$..[?(@.value=="' +
detailsObj[