removed references to doc history
This commit is contained in:
@@ -365,36 +365,6 @@ export const getSearchDocumentDetailsPaged = (
|
||||
});
|
||||
};
|
||||
|
||||
export const getSearchDocumentHistory = (documentID) => {
|
||||
return axios
|
||||
.get(
|
||||
"/api/endpoint/getsearchdocumenthistory_api?documentid=" +
|
||||
documentID
|
||||
)
|
||||
.then((res) => {
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log("API call error", error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getSearchDocumentHistoryPaged = (documentID, pageNumber) => {
|
||||
return axios
|
||||
.get(
|
||||
"/api/endpoint/getsearchdocumenthistorypaged_api?documentid=" +
|
||||
documentID +
|
||||
"&pageNumber=" +
|
||||
pageNumber
|
||||
)
|
||||
.then((res) => {
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log("API call error", error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getLinkedCases = (parentIncidentid) => {
|
||||
return axios
|
||||
.get(
|
||||
|
||||
@@ -42,7 +42,6 @@ const Case = (props) => {
|
||||
searchResultsObj={props.searchResultsObj}
|
||||
searchDetailsObj={props.searchDetailsObj}
|
||||
documentDetailsObj={props.documentDetailsObj}
|
||||
documentHistoryObj={props.documentHistoryObj}
|
||||
/>
|
||||
{showRepresentations == "true" && (
|
||||
<RepresentationList
|
||||
@@ -50,7 +49,6 @@ const Case = (props) => {
|
||||
caseReference={props.caseReference}
|
||||
representationsObj={props.representationsObj}
|
||||
documentDetailsObj={props.documentDetailsObj}
|
||||
documentHistoryObj={props.documentHistoryObj}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
|
||||
+89
-187
@@ -14,8 +14,6 @@ import {
|
||||
getBasicSearch,
|
||||
getBasicSearchDetails,
|
||||
getSearchDocumentDetails,
|
||||
getSearchDocumentHistory,
|
||||
getSearchDocumentHistoryPaged,
|
||||
getSearchDocumentDetailsPaged,
|
||||
} from "../../actions";
|
||||
|
||||
@@ -23,7 +21,6 @@ import {
|
||||
setSearchResults,
|
||||
setSearchDetails,
|
||||
setDocumentDetails,
|
||||
setDocumentHistory,
|
||||
getSearchResultsObj,
|
||||
} from "../../store/searchOutput/action";
|
||||
|
||||
@@ -36,9 +33,7 @@ const DocumentDetails = (props) => {
|
||||
searchResultsObj,
|
||||
searchDetailsObj,
|
||||
documentDetailsObj,
|
||||
documentHistoryObj,
|
||||
setDocumentDetails,
|
||||
setDocumentHistory,
|
||||
setCurrentPage,
|
||||
} = props;
|
||||
|
||||
@@ -150,7 +145,7 @@ const DocumentDetails = (props) => {
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
documentDetailsArr.map((item) => {
|
||||
documentDetailsArr.map((item, key) => {
|
||||
let detailsObj = jsonpath.query(
|
||||
item,
|
||||
"$..[?(@._pinswg_documentids_value=='" +
|
||||
@@ -158,30 +153,15 @@ const DocumentDetails = (props) => {
|
||||
"')]"
|
||||
);
|
||||
detailsObj = item;
|
||||
|
||||
if (typeof detailsObj != "undefined") {
|
||||
var documentHistoryArr =
|
||||
documentHistoryObj || [];
|
||||
return documentHistoryArr.map(
|
||||
(historyItem, key) => {
|
||||
let historyObj = jsonpath.query(
|
||||
documentHistoryObj[key],
|
||||
"$..value[?(@._pinswg_documentid_value=='" +
|
||||
detailsObj.pinswg_documentid +
|
||||
"')]"
|
||||
);
|
||||
|
||||
historyObj = historyObj[0];
|
||||
return !_.isEmpty(historyObj) ? (
|
||||
<div
|
||||
className="govuk-summary-list__row"
|
||||
key={key}
|
||||
>
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-16 ">
|
||||
{showDownloadingState ===
|
||||
key && (
|
||||
<div className="coverLoadingLink downloading">
|
||||
{/* <img
|
||||
return (
|
||||
<div
|
||||
className="govuk-summary-list__row"
|
||||
key={key}
|
||||
>
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-16 ">
|
||||
{showDownloadingState === key && (
|
||||
<div className="coverLoadingLink downloading">
|
||||
{/* <img
|
||||
className="data-loading-icon"
|
||||
src="/assets/images/loading.gif"
|
||||
alt={
|
||||
@@ -191,92 +171,81 @@ const DocumentDetails = (props) => {
|
||||
: "Fetching data"
|
||||
}
|
||||
/> */}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<Link
|
||||
scroll={false}
|
||||
href={detailsObj.pinswg_hashlink}
|
||||
>
|
||||
<a
|
||||
key={key}
|
||||
onClick={() => {
|
||||
toggleDownLoadLink(key);
|
||||
}}
|
||||
>
|
||||
<span className="results-visually-hidden">
|
||||
{t(
|
||||
"case:documents-name-label"
|
||||
)}
|
||||
:
|
||||
</span>
|
||||
{_.has(
|
||||
detailsObj,
|
||||
"pinswg_name"
|
||||
)
|
||||
? detailsObj.pinswg_name
|
||||
: ""}
|
||||
</a>
|
||||
</Link>
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||
<span className="results-visually-hidden">
|
||||
{t("case:documents-doc-type-label")}
|
||||
:
|
||||
</span>
|
||||
|
||||
<Link
|
||||
scroll={false}
|
||||
href={
|
||||
detailsObj.pinswg_hashlink
|
||||
}
|
||||
>
|
||||
<a
|
||||
key={key}
|
||||
onClick={() => {
|
||||
toggleDownLoadLink(
|
||||
key
|
||||
);
|
||||
}}
|
||||
>
|
||||
<span className="results-visually-hidden">
|
||||
{t(
|
||||
"case:documents-name-label"
|
||||
)}
|
||||
:
|
||||
</span>
|
||||
{_.has(historyObj, [
|
||||
"_pinswg_documentid_value@OData.Community.Display.V1.FormattedValue",
|
||||
])
|
||||
? historyObj[
|
||||
"_pinswg_documentid_value@OData.Community.Display.V1.FormattedValue"
|
||||
]
|
||||
: ""}
|
||||
</a>
|
||||
</Link>
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||
<span className="results-visually-hidden">
|
||||
{t(
|
||||
"case:documents-doc-type-label"
|
||||
)}
|
||||
:
|
||||
</span>
|
||||
{router.locale == "cy"
|
||||
? jsonpath.query(
|
||||
transLookup,
|
||||
'$..[?(@.value=="' +
|
||||
detailsObj[
|
||||
"pinswg_isharedocumentlocations@OData.Community.Display.V1.FormattedValue"
|
||||
] +
|
||||
'")].value_cy'
|
||||
)
|
||||
: detailsObj[
|
||||
"pinswg_isharedocumentlocations@OData.Community.Display.V1.FormattedValue"
|
||||
] ||
|
||||
t(
|
||||
"case:summary-no-date-entered-label"
|
||||
)}
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||
<span className="results-visually-hidden">
|
||||
{t(
|
||||
"case:documents-date-published-label"
|
||||
)}
|
||||
:
|
||||
</span>
|
||||
|
||||
{router.locale == "cy"
|
||||
? jsonpath.query(
|
||||
transLookup,
|
||||
'$..[?(@.value=="' +
|
||||
detailsObj[
|
||||
"pinswg_isharedocumentlocations@OData.Community.Display.V1.FormattedValue"
|
||||
] +
|
||||
'")].value_cy'
|
||||
)
|
||||
: detailsObj[
|
||||
"pinswg_isharedocumentlocations@OData.Community.Display.V1.FormattedValue"
|
||||
] ||
|
||||
t(
|
||||
"case:summary-no-date-entered-label"
|
||||
)}
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||
<span className="results-visually-hidden">
|
||||
{t(
|
||||
"case:documents-date-published-label"
|
||||
)}
|
||||
:
|
||||
</span>
|
||||
|
||||
{_.has(historyObj, [
|
||||
"pinswg_publisheddate@OData.Community.Display.V1.FormattedValue",
|
||||
])
|
||||
? formatDates(
|
||||
historyObj.pinswg_publisheddate
|
||||
)
|
||||
: ""}
|
||||
</dd>
|
||||
{/* <dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||
{_.has(
|
||||
detailsObj,
|
||||
"pinswg_latestpublisheddate"
|
||||
)
|
||||
? formatDates(
|
||||
detailsObj.pinswg_latestpublisheddate
|
||||
)
|
||||
: ""}
|
||||
</dd>
|
||||
{/* <dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||
<span className="results-visually-hidden">
|
||||
{t("case:documents-size-label")}:
|
||||
</span>
|
||||
92
|
||||
</dd> */}
|
||||
</div>
|
||||
) : (
|
||||
""
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
</div>
|
||||
);
|
||||
})
|
||||
)}
|
||||
</dl>
|
||||
@@ -300,50 +269,22 @@ const DocumentDetails = (props) => {
|
||||
}
|
||||
|
||||
const docDetailsObj = async () => {
|
||||
let docObj = await getSearchDocumentDetails(incidentid)
|
||||
.then((data) => {
|
||||
let docObj = await getSearchDocumentDetails(incidentid).then(
|
||||
(data) => {
|
||||
//console.log(data);
|
||||
setDocumentDetails(data);
|
||||
return data;
|
||||
})
|
||||
.then((data) => {
|
||||
let historyObj = getDocumentHistory(data.value).then(
|
||||
(result) => {
|
||||
setDocumentHistory(result);
|
||||
setDocumentSearchState(true);
|
||||
return result;
|
||||
}
|
||||
);
|
||||
setDocumentSearchState(true);
|
||||
|
||||
return data;
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
return docObj;
|
||||
};
|
||||
|
||||
const getDocumentHistory = async (searchDocumentDetailsObj) => {
|
||||
let historyArr = [];
|
||||
searchDocumentDetailsObj = searchDocumentDetailsObj || [];
|
||||
|
||||
const detailsObj = searchDocumentDetailsObj.map(
|
||||
(historyDetail, index) => {
|
||||
if (historyDetail.pinswg_publishtoweb != true) {
|
||||
console.log(historyDetail.pinswg_documentid);
|
||||
} else {
|
||||
historyArr.push(
|
||||
getSearchDocumentHistory(
|
||||
historyDetail.pinswg_documentid
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
return Promise.all(historyArr);
|
||||
};
|
||||
const searchDocumentResultsObj = docDetailsObj();
|
||||
}, [
|
||||
incidentid,
|
||||
setDocumentHistory,
|
||||
setDocumentDetails,
|
||||
selectedOption,
|
||||
fieldSortState,
|
||||
@@ -362,10 +303,7 @@ const DocumentDetails = (props) => {
|
||||
.then((data) => {
|
||||
//console.log("getting details", data);
|
||||
setDocumentDetails(data);
|
||||
return getDocumentHistory(data.value).then((data) => {
|
||||
setDocumentHistory(data);
|
||||
setShowSpinnerState(false);
|
||||
});
|
||||
setShowSpinnerState(false);
|
||||
});
|
||||
};
|
||||
|
||||
@@ -375,48 +313,15 @@ const DocumentDetails = (props) => {
|
||||
pageNumber,
|
||||
orderBy,
|
||||
fieldSort
|
||||
)
|
||||
.then((data) => {
|
||||
//console.log(data);
|
||||
setDocumentDetails(data);
|
||||
return data;
|
||||
})
|
||||
.then((data) => {
|
||||
let historyObj = getDocumentHistory(
|
||||
data.value,
|
||||
pageNumber
|
||||
).then((result) => {
|
||||
setDocumentHistory(result);
|
||||
return result;
|
||||
});
|
||||
|
||||
return data;
|
||||
});
|
||||
).then((data) => {
|
||||
//console.log(data);
|
||||
setDocumentDetails(data);
|
||||
return data;
|
||||
});
|
||||
|
||||
return docObj;
|
||||
};
|
||||
|
||||
const getDocumentHistory = async (searchDocumentDetailsObj, pageNumber) => {
|
||||
let historyArr = [];
|
||||
searchDocumentDetailsObj = searchDocumentDetailsObj || [];
|
||||
|
||||
const detailsObj = searchDocumentDetailsObj.map(
|
||||
(historyDetail, index) => {
|
||||
if (historyDetail.pinswg_publishtoweb != true) {
|
||||
console.log(historyDetail.pinswg_documentid);
|
||||
} else {
|
||||
historyArr.push(
|
||||
getSearchDocumentHistoryPaged(
|
||||
historyDetail.pinswg_documentid,
|
||||
pageNumber
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
return Promise.all(historyArr);
|
||||
};
|
||||
|
||||
function formatDates(dateObj) {
|
||||
var dateObj = new Date(dateObj);
|
||||
var dd = String(dateObj.getDate()).padStart(2, "0");
|
||||
@@ -498,7 +403,7 @@ const DocumentDetails = (props) => {
|
||||
<div className="govuk-grid-row">
|
||||
<div className="govuk-grid-column-full">
|
||||
<h2>{t("case:documents-heading-label")}</h2>
|
||||
{_.isEmpty(documentHistoryObj) ? (
|
||||
{_.isEmpty(documentDetailsObj) ? (
|
||||
<div className="govuk-grid-row">
|
||||
<div className="govuk-grid-column-two-thirds">
|
||||
<h3>
|
||||
@@ -536,9 +441,6 @@ const mapDispatchToProps = (dispatch) => {
|
||||
setDocumentDetails: (detailsObj) => {
|
||||
dispatch(setDocumentDetails(detailsObj));
|
||||
},
|
||||
setDocumentHistory: (historyObj) => {
|
||||
dispatch(setDocumentHistory(historyObj));
|
||||
},
|
||||
setCurrentPage: (currentPage) => {
|
||||
dispatch(setCurrentPage(currentPage));
|
||||
},
|
||||
|
||||
@@ -43,9 +43,6 @@ const Home = (props) => {
|
||||
documentDetailsObj={
|
||||
props.searchResultsObj.documentDetailsObj
|
||||
}
|
||||
documentHistoryObj={
|
||||
props.searchResultsObj.documentHistoryObj
|
||||
}
|
||||
myRepresentations={
|
||||
props.myRepresentations.myRepresentations
|
||||
}
|
||||
|
||||
@@ -53,9 +53,6 @@ const CaseHome = (props) => {
|
||||
documentDetailsObj={
|
||||
props.searchResultsObj.documentDetailsObj
|
||||
}
|
||||
documentHistoryObj={
|
||||
props.searchResultsObj.documentHistoryObj
|
||||
}
|
||||
myRepresentations={
|
||||
props.myRepresentations.myRepresentations
|
||||
}
|
||||
|
||||
@@ -44,9 +44,6 @@ const Home = (props) => {
|
||||
documentDetailsObj={
|
||||
props.searchResultsObj.documentDetailsObj
|
||||
}
|
||||
documentHistoryObj={
|
||||
props.searchResultsObj.documentHistoryObj
|
||||
}
|
||||
myRepresentations={
|
||||
props.myRepresentations.myRepresentations
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ const searchResultsInitialState = {
|
||||
searchResultsObj: {},
|
||||
searchDetailsObj: {},
|
||||
documentDetailsObj: {},
|
||||
documentHistoryObj: {},
|
||||
representationsObj: {},
|
||||
};
|
||||
|
||||
@@ -25,11 +24,7 @@ export default function reducer(state = searchResultsInitialState, action) {
|
||||
...state,
|
||||
documentDetailsObj: action.documentDetailsObj,
|
||||
};
|
||||
case searchResultsActionTypes.SETDOCUMENTHISTORY:
|
||||
return {
|
||||
...state,
|
||||
documentHistoryObj: action.documentHistoryObj,
|
||||
};
|
||||
|
||||
case searchResultsActionTypes.SETREPRESENTATIONS:
|
||||
return {
|
||||
...state,
|
||||
|
||||
Reference in New Issue
Block a user