pagination for documents seo head meta refactor
This commit is contained in:
@@ -19,6 +19,7 @@ import {
|
||||
setSearchResults,
|
||||
setSearchDetails,
|
||||
} from "../../store/searchOutput/action";
|
||||
import { getSearchDetailsPaged } from "../utils";
|
||||
|
||||
const DNSSearchResults = (props) => {
|
||||
const {
|
||||
@@ -250,66 +251,23 @@ const DNSSearchResults = (props) => {
|
||||
: pagesCount;
|
||||
|
||||
const getSearchPageResults = (pageNumber) => {
|
||||
console.log(advancedSearch, searchString, pageNumber);
|
||||
//console.log(advancedSearch, searchString, pageNumber);
|
||||
|
||||
getBasicDNSSearchPaged(pageNumber)
|
||||
.then((data) => {
|
||||
console.log(data);
|
||||
//console.log(data);
|
||||
setSearchResults(data);
|
||||
return data;
|
||||
})
|
||||
.then((data) => {
|
||||
console.log("getting details", data);
|
||||
return getSearchDetails(data).then((data) => {
|
||||
//console.log("getting details", data);
|
||||
return getSearchDetailsPaged(data).then((data) => {
|
||||
setSearchDetails(data);
|
||||
setShowSpinnerState(false);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
const getSearchDetails = (searchResultsObj) => {
|
||||
//console.log(searchResultsObj);
|
||||
|
||||
let detailsArr = [];
|
||||
//console.log("search results", searchResultsObj);
|
||||
searchResultsObj = searchResultsObj.value;
|
||||
const detailsObj = searchResultsObj.map((searchDetail, index) => {
|
||||
//console.log(searchDetail);
|
||||
if (searchDetail.pinswg_appealcasetype == null) {
|
||||
console.log(searchDetail.title);
|
||||
} else {
|
||||
let formMeta = getFormCollection(
|
||||
"pinswg_" +
|
||||
searchDetail[
|
||||
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
|
||||
]
|
||||
.replace(/(\band|[\s\-\+\(\)\,\&])/g, "")
|
||||
.toLowerCase()
|
||||
.slice(0, 39)
|
||||
);
|
||||
|
||||
detailsArr.push(
|
||||
getBasicSearchDetailsPaged(
|
||||
formMeta.LogicalCollectionName,
|
||||
searchDetail.title,
|
||||
formMeta.PrimaryIdAttribute,
|
||||
searchDetail.incidentid
|
||||
)
|
||||
);
|
||||
}
|
||||
});
|
||||
// console.log(detailsArr);
|
||||
return Promise.all(detailsArr);
|
||||
};
|
||||
|
||||
const getFormCollection = (formtype) => {
|
||||
const collectionName = jsonpath.query(
|
||||
data,
|
||||
"$..[?(@.LogicalName=='" + formtype + "')]"
|
||||
);
|
||||
//console.log(collectionName[0]);
|
||||
return collectionName[0];
|
||||
};
|
||||
return (
|
||||
<>
|
||||
<div className="govuk-grid-row">
|
||||
|
||||
Reference in New Issue
Block a user