From 8b1d28481b4ffe51f4b8bdfe907cc09c4964cf38 Mon Sep 17 00:00:00 2001
From: SwethaKrish4 <110164892+SwethaKrish4@users.noreply.github.com>
Date: Mon, 21 Oct 2024 18:59:56 +0530
Subject: [PATCH 1/3] MOSIP-36311: Added separate state variables for sorting
and pagination
Signed-off-by: SwethaKrish4 <110164892+SwethaKrish4@users.noreply.github.com>
---
pmp-reactjs-ui/public/i18n/ara.json | 3 +-
pmp-reactjs-ui/public/i18n/eng.json | 3 +-
pmp-reactjs-ui/public/i18n/fra.json | 3 +-
pmp-reactjs-ui/src/nav/SideNav.js | 6 +-
.../certificates/RootTrustCertificateList.js | 4 +-
.../src/pages/admin/partners/PartnersList.js | 304 ++++++------------
.../src/pages/common/FilterButtons.js | 4 +-
pmp-reactjs-ui/src/pages/common/Pagination.js | 14 +-
.../authenticationServices/ApiKeysList.js | 4 +-
.../authenticationServices/OidcClientsList.js | 4 +-
.../deviceProviderServices/DevicesList.js | 4 +-
.../partner/ftmProviderServices/FtmList.js | 4 +-
.../pages/partner/policies/PoliciesList.js | 4 +-
pmp-reactjs-ui/src/utils/AppUtils.js | 2 +-
14 files changed, 135 insertions(+), 228 deletions(-)
diff --git a/pmp-reactjs-ui/public/i18n/ara.json b/pmp-reactjs-ui/public/i18n/ara.json
index c5eb5057..771b30e4 100644
--- a/pmp-reactjs-ui/public/i18n/ara.json
+++ b/pmp-reactjs-ui/public/i18n/ara.json
@@ -567,7 +567,8 @@
"selectPartnerType": "حدد نوع الشريك",
"selectEmailAddress": "حدد عنوان البريد الإلكتروني",
"selectPolicyGroup": "حدد مجموعة السياسات",
- "selectStatus": "حدد الحالة"
+ "selectStatus": "حدد الحالة",
+ "errorInPartnersList": "أثناء جلب تفاصيل الشركاء، واجهنا خطأً."
},
"viewPartnerDetails": {
"viewPartnerDetails": "عرض تفاصيل الشريك",
diff --git a/pmp-reactjs-ui/public/i18n/eng.json b/pmp-reactjs-ui/public/i18n/eng.json
index 8c631002..64a719e1 100644
--- a/pmp-reactjs-ui/public/i18n/eng.json
+++ b/pmp-reactjs-ui/public/i18n/eng.json
@@ -563,7 +563,8 @@
"selectPartnerType": "Select Partner Type",
"selectEmailAddress": "Select Email Address",
"selectPolicyGroup": "Select Policy Group",
- "selectStatus": "Select Status"
+ "selectStatus": "Select Status",
+ "errorInPartnersList": "While fetching partners details, we have encountered with an error."
},
"viewPartnerDetails": {
"viewPartnerDetails": "View Partner Details",
diff --git a/pmp-reactjs-ui/public/i18n/fra.json b/pmp-reactjs-ui/public/i18n/fra.json
index da870dd0..91540de7 100644
--- a/pmp-reactjs-ui/public/i18n/fra.json
+++ b/pmp-reactjs-ui/public/i18n/fra.json
@@ -567,7 +567,8 @@
"selectPartnerType":"Sélectionnez le type de partenaire",
"selectEmailAddress": "Sélectionnez l'adresse e-mail",
"selectPolicyGroup":"Sélectionnez un groupe de stratégies",
- "selectStatus":"Sélectionnez le statut"
+ "selectStatus":"Sélectionnez le statut",
+ "errorInPartnersList": "Lors de la récupération des détails des partenaires, nous avons rencontré une erreur."
},
"viewPartnerDetails": {
"viewPartnerDetails": "Afficher les détails du partenaire",
diff --git a/pmp-reactjs-ui/src/nav/SideNav.js b/pmp-reactjs-ui/src/nav/SideNav.js
index eebe7ef1..e8884bb7 100644
--- a/pmp-reactjs-ui/src/nav/SideNav.js
+++ b/pmp-reactjs-ui/src/nav/SideNav.js
@@ -17,7 +17,7 @@ function SideNav({ open, policyRequiredPartnerTypes, partnerType }) {
const [enablePartnerAdminMenu, setEnablePartnerAdminMenu] = useState(false);
useEffect(() => {
- //console.log(selectedPath);
+ console.log(selectedPath);
if (selectedPath.includes('dashboard')) {
setActiveIcon("home");
} else if (selectedPath.includes('partnerCertificate')) {
@@ -36,6 +36,8 @@ function SideNav({ open, policyRequiredPartnerTypes, partnerType }) {
setActiveIcon('ftmChipProviderServices');
} else if (selectedPath.includes('rootTrustCertificateList')) {
setActiveIcon("rootOfTrustCertificate");
+ } else if (selectedPath.includes('partnersList')) {
+ setActiveIcon("partner");
}
else {
setActiveIcon("home");
@@ -90,7 +92,7 @@ function SideNav({ open, policyRequiredPartnerTypes, partnerType }) {
navigate('/partnermanagement/admin/certificates/rootTrustCertificateList');
};
const showPartner = () => {
- setActiveIcon("partner");
+ navigate('/partnermanagement/admin/partnersList');
};
const showAdminPolicies = () => {
setActiveIcon("admin_policies");
diff --git a/pmp-reactjs-ui/src/pages/admin/certificates/RootTrustCertificateList.js b/pmp-reactjs-ui/src/pages/admin/certificates/RootTrustCertificateList.js
index 91b5cbc6..a400e518 100644
--- a/pmp-reactjs-ui/src/pages/admin/certificates/RootTrustCertificateList.js
+++ b/pmp-reactjs-ui/src/pages/admin/certificates/RootTrustCertificateList.js
@@ -248,7 +248,7 @@ function RootTrustCertificateList() {
{
const fetchData = async () => {
- try {
- setDataLoaded(false);
-
- const partnersDummyData = [
- {
- partnerID: "P23423029",
- orgName: "MOSIP",
- partnerType: "DEVICE_Provider",
- emailID: "abc@mock.co.in",
- policyGroup: "mpolicygroup-default-cert",
- certUploadStatus: "uploaded",
- status: "ACTIVE",
- },
- {
- partnerID: "P23423089",
- orgName: "MOSIP444454",
- partnerType: "MANUAL_ADJUDICATION",
- emailID: "abhnc@mock.co.in",
- policyGroup: "mpolicygroup-default-cert",
- certUploadStatus: "uploaded",
- status: "deactivated",
- },
- {
- partnerID: "P23425029",
- orgName: "MOSIP4353243",
- partnerType: "MANUAL_ADJUDICATION",
- emailID: "abc@mock.co.in",
- policyGroup: "mpolicygroup-default-cert",
- certUploadStatus: "notUploaded",
- status: "ACTIVE",
- },
- {
- partnerID: "P23423529",
- orgName: "MOSIP5423",
- partnerType: "MANUAL_ADJUDICATION",
- emailID: "asbc@mock.co.in",
- policyGroup: "mpolicfccygroup-default-cert",
- certUploadStatus: "uploaded",
- status: "ACTIVE",
- },
- {
- partnerID: "P23423029",
- orgName: "MOSIP3434",
- partnerType: "INTERNAL_PARTNER",
- emailID: "abc@mock.co.in",
- policyGroup: "mpolicygroup-default-cert",
- certUploadStatus: "notUploaded",
- status: "ACTIVE",
- },
- {
- partnerID: "P23423029",
- orgName: "MOSIP3434",
- partnerType: "PRINT_PARTNER",
- emailID: "abc@mock.co.in",
- policyGroup: "mpolicygroup-default-cert",
- certUploadStatus: "uploaded",
- status: "deactivated",
- },
- {
- partnerID: "P23423029",
- orgName: "MOSIP33343",
- partnerType: "SDK_PARTNER",
- emailID: "abc@mock.co.in",
- policyGroup: "mpolicygroup-default-cert",
- certUploadStatus: "uploaded",
- status: "deactivated",
- },
- {
- partnerID: "P23423029",
- orgName: "MOSIP34324",
- partnerType: "MISP_PARTNER",
- emailID: "abc@mock.co.in",
- policyGroup: "mpolicygroup-default-cert",
- certUploadStatus: "notUploaded",
- status: "deactivated",
- },
- {
- partnerID: "P23423029",
- orgName: "MOSIP23434",
- partnerType: "ABIS_PARTNER",
- emailID: "abc@mock.co.in",
- policyGroup: "mpolicygroup-default-cert",
- certUploadStatus: "uploaded",
- status: "ACTIVE",
- },
- {
- partnerID: "P23423029",
- orgName: "MOSIP3243",
- partnerType: "ONLINE_VERIFICATION_PARTNER",
- emailID: "abc@mock.co.in",
- policyGroup: "mpolicygroup-default-cert",
- certUploadStatus: "notUploaded",
- status: "deactivated",
- },
- {
- partnerID: "P23423029",
- orgName: "MOSIP343",
- partnerType: "CREDENTIAL_PARTNER",
- emailID: "abc@mock.co.in",
- policyGroup: "mpolicygroup-default-cert",
- certUploadStatus: "uploaded",
- status: "ACTIVE",
- },
- {
- partnerID: "P23423029",
- orgName: "MOSIP324444",
- partnerType: "AUTH_PARTNER",
- emailID: "abc@mock.co.in",
- policyGroup: "mpolicygroup-default-cert",
- certUploadStatus: "notUploaded",
- status: "ACTIVE",
- },
- {
- partnerID: "P23423029",
- orgName: "MOSIP3432",
- partnerType: "FTM_PROVIDER",
- emailID: "abc@mock.co.in",
- policyGroup: "mpolicygroup-default-cert",
- certUploadStatus: "uploaded",
- status: "deactivated",
- },
- {
- partnerID: "P23423029",
- orgName: "MOSIP123",
- partnerType: "DEVICE_Provider",
- emailID: "abc@mock.co.in",
- policyGroup: "mpolicygroup-default-cert",
- certUploadStatus: "notUploaded",
- status: "ACTIVE",
- },
- ];
+ const queryParams = new URLSearchParams();
+ queryParams.append('sortFieldName', sortFieldName);
+ queryParams.append('sortType', sortType);
+ queryParams.append('pageNo', pageNo);
+ queryParams.append('pageSize', pageSize);
- const sortedData = partnersDummyData.sort(
- (a, b) => new Date(b.certExpiryDate) - new Date(a.certExpiryDate)
- );
- setPartnersData(sortedData);
- setFilteredPartnersData(sortedData);
- setDataLoaded(true);
+ const url = `${getPartnerManagerUrl('/partners/v3', process.env.NODE_ENV)}?${queryParams.toString()}`;
+ try {
+ triggerServerMethod ? setTableDataLoaded(false) : setDataLoaded(false);
+ const response = await HttpService.get(url);
+ if (response) {
+ console.log(response);
+ const responseData = response.data;
+ if (responseData && responseData.response) {
+ const resData = responseData.response.data;
+ setTotalRecords(responseData.response.totalResults);
+ setPartnersData(resData);
+ setFilteredPartnersData(resData);
+ } else {
+ handleServiceErrors(responseData, setErrorCode, setErrorMsg);
+ }
+ } else {
+ setErrorMsg(t('partnerList.errorInPartnersList'));
+ }
+ triggerServerMethod ? setTableDataLoaded(true) : setDataLoaded(true);
+ setTriggerServerMethod(false);
} catch (err) {
- console.error("Error fetching data:", err);
+ triggerServerMethod ? setTableDataLoaded(true) : setDataLoaded(true);
+ console.error('Error fetching data:', err);
setErrorMsg(err);
}
- };
+ }
fetchData();
- }, []);
+ }, [sortFieldName, sortType, pageNo, pageSize]);
+
+ const getPaginationValues = (recordsPerPage, pageIndex) =>{
+ // console.log(recordsPerPage, pageIndex);
+ if(pageNo !== pageIndex || pageSize !== recordsPerPage) {
+ setPageNo(pageIndex);
+ setPageSize(recordsPerPage);
+ setTriggerServerMethod(true);
+ }
+ }
const showViewPartnerDetails = (selectedPartnerData) => {
if (selectedPartnerData.status === 'ACTIVE') {
@@ -220,39 +127,25 @@ function PartnersList() {
//This part is related to Sorting
const sortAscOrder = (header) => {
- const isDateCol = header === "timeOfUpload" ? true : false;
- toggleSortAscOrder(
- header,
- isDateCol,
- filteredPartnersData,
- setFilteredPartnersData,
- order,
- setOrder,
- isDescending,
- setIsDescending,
- activeSortAsc,
- setActiveSortAsc,
- activeSortDesc,
- setActiveSortDesc
- );
+ if (order !== 'ASC' || activeSortAsc !== header) {
+ setTriggerServerMethod(true);
+ setSortFieldName((header === 'status') ? 'isActive' : header);
+ setSortType("desc");
+ setOrder("ASC");
+ setActiveSortDesc("");
+ setActiveSortAsc(header);
+ }
};
const sortDescOrder = (header) => {
- const isDateCol = header === "timeOfUpload" ? true : false;
- toggleSortDescOrder(
- header,
- isDateCol,
- filteredPartnersData,
- setFilteredPartnersData,
- order,
- setOrder,
- isDescending,
- setIsDescending,
- activeSortAsc,
- setActiveSortAsc,
- activeSortDesc,
- setActiveSortDesc
- );
+ if (order !== 'DESC' || activeSortDesc !== header) {
+ setTriggerServerMethod(true);
+ setSortFieldName((header === 'status') ? 'isActive' : header);
+ setSortType("asc");
+ setOrder("DESC");
+ setActiveSortDesc(header);
+ setActiveSortAsc("");
+ }
};
const style = {
@@ -276,12 +169,6 @@ function PartnersList() {
window.location.reload();
};
- //This part related to Pagination logic
- let tableRows = filteredPartnersData.slice(
- firstIndex,
- firstIndex + selectedRecordsPerPage
- );
-
//This part is related to Filter
const onFilterChange = (fieldName, selectedFilter) => {
setFilterQuery((oldFilterQuery) => ({
@@ -292,18 +179,22 @@ function PartnersList() {
};
const showDeactivatePartner = (selectedClientdata) => {
- if (selectedClientdata.status === "ACTIVE") {
+ if (selectedClientdata.isActive === true) {
document.body.style.overflow = "hidden";
}
};
+ const styles = {
+ loadingDiv: "!py-[20%]"
+ }
+
return (
- {!dataLoaded && }
- {dataLoaded && (
+ { !dataLoaded && }
+ { dataLoaded && (
<>
{errorMsg && (
@@ -340,7 +231,7 @@ function PartnersList() {
{t("partnerList.organisation")}
{t("partnerList.policyGroup")}
{t("partnerList.email")}
- {t("partnerList.certExpiryDate")}
+ {t("partnerList.certUploadStatus")}
{t("partnerList.status")}
{t("partnerList.action")}
@@ -358,10 +249,10 @@ function PartnersList() {
) : (
<>
-
+
)}
-
+ {!tableDataLoaded &&
}
+ {tableDataLoaded && (
@@ -399,22 +291,21 @@ function PartnersList() {
- {tableRows.map((partner, index) => {
+ {filteredPartnersData.map((partner, index) => {
return (
- showViewPartnerDetails(partner)} className="px-2 break-all">{partner.partnerID} |
+ className={`border-t border-[#E5EBFA] cursor-pointer text-[0.8rem] text-[#191919] font-semibold break-words ${partner.isActive === false ? "text-[#969696]" : "text-[#191919]"}`}>
+ showViewPartnerDetails(partner)} className="px-2 break-all">{partner.partnerId} |
showViewPartnerDetails(partner)} className="px-2 break-all">{partner.partnerType} |
showViewPartnerDetails(partner)} className="px-2 break-all">{partner.orgName} |
- showViewPartnerDetails(partner)} className="px-2 break-all">{partner.emailID} |
- showViewPartnerDetails(partner)} className="px-2 break-all">{partner.policyGroup} |
- showViewPartnerDetails(partner)} className={`px-3 break-all ${partner.certUploadStatus === 'notUploaded' && "text-[#BE1818]"}`}>
- {getStatusCode(partner.certUploadStatus, t)}
+ | showViewPartnerDetails(partner)} className="px-2 break-all">{partner.policyGroupName ? partner.policyGroupName : "-"} |
+ showViewPartnerDetails(partner)} className="px-2 break-all">{partner.emailAddress} |
+ showViewPartnerDetails(partner)} className={`px-3 break-all ${partner.certificateUploadStatus === 'not_uploaded' && "text-[#BE1818]"}`}>
+ {getStatusCode(partner.certificateUploadStatus, t)}
|
showViewPartnerDetails(partner)} className="break-all">
-
- {getStatusCode(partner.status, t)}
+
+ {partner.isActive ? t('statusCodes.activated'): t('statusCodes.deactivated')}
|
@@ -432,7 +323,7 @@ function PartnersList() {
{t("partnerList.view")}
- showDeactivatePartner(partner)} className={`py-1.5 px-4 ${isLoginLanguageRTL ? "pl-10" : "pr-10"} ${partner.status === "approved" ? "text-crimson-red cursor-pointer" : "text-[#A5A5A5] cursor-auto"} hover:bg-gray-100`}
+ showDeactivatePartner(partner)} className={`py-1.5 px-4 ${isLoginLanguageRTL ? "pl-10" : "pr-10"} ${partner.isActive === true ? "text-crimson-red cursor-pointer" : "text-[#A5A5A5] cursor-auto"} hover:bg-gray-100`}
tabIndex="0" onKeyPress={(e) => onPressEnterKey(e, () => showDeactivatePartner(partner))}
>
{t("partnerList.deActivate")}
@@ -447,12 +338,15 @@ function PartnersList() {
|
+ )}
>
)}
diff --git a/pmp-reactjs-ui/src/pages/common/FilterButtons.js b/pmp-reactjs-ui/src/pages/common/FilterButtons.js
index 5273f372..f263dc62 100644
--- a/pmp-reactjs-ui/src/pages/common/FilterButtons.js
+++ b/pmp-reactjs-ui/src/pages/common/FilterButtons.js
@@ -2,14 +2,14 @@ import { useTranslation } from 'react-i18next';
import { getUserProfile } from '../../services/UserProfileService';
import { isLangRTL, onPressEnterKey } from '../../utils/AppUtils';
-function FilterButtons({ listTitle, dataList, filter, onResetFilter, setFilter}) {
+function FilterButtons({ listTitle, dataListLength, filter, onResetFilter, setFilter}) {
const { t } = useTranslation();
const isLoginLanguageRTL = isLangRTL(getUserProfile().langCode);
return (
- {t(listTitle) + ' (' + dataList.length + ")"}
+ {t(listTitle) + ' (' + dataListLength + ")"}
{filter &&
onPressEnterKey(e,onResetFilter)}
diff --git a/pmp-reactjs-ui/src/pages/common/Pagination.js b/pmp-reactjs-ui/src/pages/common/Pagination.js
index 1fc61fbd..a3716419 100644
--- a/pmp-reactjs-ui/src/pages/common/Pagination.js
+++ b/pmp-reactjs-ui/src/pages/common/Pagination.js
@@ -6,10 +6,11 @@ import { isLangRTL, handleMouseClickForDropdown, onPressEnterKey } from '../../u
import { AiFillLeftCircle, AiFillRightCircle } from "react-icons/ai"; // icons form react-icons
import { IconContext } from "react-icons"; // for customizing icons
-function Pagination({ dataList, selectedRecordsPerPage, setSelectedRecordsPerPage, setFirstIndex}) {
+function Pagination({ dataListLength, selectedRecordsPerPage, setSelectedRecordsPerPage, setFirstIndex, isServerSideFilter=false, getPaginationValues}) {
const { t } = useTranslation();
const isLoginLanguageRTL = isLangRTL(getUserProfile().langCode);
const [isItemsPerPageOpen, setIsItemsPerPageOpen] = useState(false);
+ const [selectedPage, setSelectedPage] = useState(0);
const itemsPerPageOptions = [8, 16, 24, 32];
const itemsCountSelectionRef = useRef(null);
@@ -17,8 +18,15 @@ function Pagination({ dataList, selectedRecordsPerPage, setSelectedRecordsPerPag
handleMouseClickForDropdown(itemsCountSelectionRef, () => setIsItemsPerPageOpen(false));
}, [itemsCountSelectionRef]);
+ useEffect(() =>{
+ if(isServerSideFilter) {
+ getPaginationValues(selectedRecordsPerPage, selectedPage);
+ }
+ }, [selectedPage, selectedRecordsPerPage]);
+
const handlePageChange = (event) => {
- const newIndex = (event.selected * selectedRecordsPerPage) % dataList.length;
+ setSelectedPage(event.selected);
+ const newIndex = (event.selected * selectedRecordsPerPage) % dataListLength;
setFirstIndex(newIndex);
};
const changeItemsPerPage = (num) => {
@@ -35,7 +43,7 @@ function Pagination({ dataList, selectedRecordsPerPage, setSelectedRecordsPerPag
pageClassName={"page-item"}
activeClassName={"active"}
onPageChange={(event) => handlePageChange(event)}
- pageCount={Math.ceil(dataList.length / selectedRecordsPerPage)}
+ pageCount={Math.ceil(dataListLength / selectedRecordsPerPage)}
breakLabel="..."
previousLabel={
diff --git a/pmp-reactjs-ui/src/pages/partner/authenticationServices/ApiKeysList.js b/pmp-reactjs-ui/src/pages/partner/authenticationServices/ApiKeysList.js
index 8383bd53..753a5a79 100644
--- a/pmp-reactjs-ui/src/pages/partner/authenticationServices/ApiKeysList.js
+++ b/pmp-reactjs-ui/src/pages/partner/authenticationServices/ApiKeysList.js
@@ -225,7 +225,7 @@ function ApiKeysList() {
:
<>
-
+
>
}
diff --git a/pmp-reactjs-ui/src/pages/partner/authenticationServices/OidcClientsList.js b/pmp-reactjs-ui/src/pages/partner/authenticationServices/OidcClientsList.js
index 7eb42ae3..18dd5fc5 100644
--- a/pmp-reactjs-ui/src/pages/partner/authenticationServices/OidcClientsList.js
+++ b/pmp-reactjs-ui/src/pages/partner/authenticationServices/OidcClientsList.js
@@ -255,7 +255,7 @@ function OidcClientsList() {
:
<>
-
+
{filter &&
-
+
>
}
diff --git a/pmp-reactjs-ui/src/pages/partner/deviceProviderServices/DevicesList.js b/pmp-reactjs-ui/src/pages/partner/deviceProviderServices/DevicesList.js
index f27ad9c7..a71c7391 100644
--- a/pmp-reactjs-ui/src/pages/partner/deviceProviderServices/DevicesList.js
+++ b/pmp-reactjs-ui/src/pages/partner/deviceProviderServices/DevicesList.js
@@ -271,7 +271,7 @@ function DevicesList() {
:
<>
-
+
{filter &&
-
+
>
}
>
diff --git a/pmp-reactjs-ui/src/pages/partner/ftmProviderServices/FtmList.js b/pmp-reactjs-ui/src/pages/partner/ftmProviderServices/FtmList.js
index e20cd9ba..f659291b 100644
--- a/pmp-reactjs-ui/src/pages/partner/ftmProviderServices/FtmList.js
+++ b/pmp-reactjs-ui/src/pages/partner/ftmProviderServices/FtmList.js
@@ -242,7 +242,7 @@ function FtmList() {
:
<>
-
+
{filter &&
-
+
>
}
diff --git a/pmp-reactjs-ui/src/pages/partner/policies/PoliciesList.js b/pmp-reactjs-ui/src/pages/partner/policies/PoliciesList.js
index d4246798..c482a6de 100644
--- a/pmp-reactjs-ui/src/pages/partner/policies/PoliciesList.js
+++ b/pmp-reactjs-ui/src/pages/partner/policies/PoliciesList.js
@@ -190,7 +190,7 @@ function PoliciesList() {
:
<>
-
+
>
}
diff --git a/pmp-reactjs-ui/src/utils/AppUtils.js b/pmp-reactjs-ui/src/utils/AppUtils.js
index c0f92d38..8dde863c 100644
--- a/pmp-reactjs-ui/src/utils/AppUtils.js
+++ b/pmp-reactjs-ui/src/utils/AppUtils.js
@@ -64,7 +64,7 @@ export const getStatusCode = (status, t) => {
return t('statusCodes.expired');
} else if (status === "uploaded") {
return t('statusCodes.uploaded');
- } else if (status === "notuploaded") {
+ } else if (status === "not_uploaded") {
return t('statusCodes.notUploaded');
} else if (status === "-") {
return "-"
From ba27069aefeeac9a9a753ce41197311df2609cb7 Mon Sep 17 00:00:00 2001
From: SwethaKrish4 <110164892+SwethaKrish4@users.noreply.github.com>
Date: Mon, 21 Oct 2024 19:03:25 +0530
Subject: [PATCH 2/3] MOSIP-36311: Added separate state variables for sorting
and pagination
Signed-off-by: SwethaKrish4 <110164892+SwethaKrish4@users.noreply.github.com>
---
pmp-reactjs-ui/src/nav/SideNav.js | 2 +-
pmp-reactjs-ui/src/pages/admin/partners/PartnersList.js | 4 ----
2 files changed, 1 insertion(+), 5 deletions(-)
diff --git a/pmp-reactjs-ui/src/nav/SideNav.js b/pmp-reactjs-ui/src/nav/SideNav.js
index e8884bb7..c4322dfa 100644
--- a/pmp-reactjs-ui/src/nav/SideNav.js
+++ b/pmp-reactjs-ui/src/nav/SideNav.js
@@ -17,7 +17,7 @@ function SideNav({ open, policyRequiredPartnerTypes, partnerType }) {
const [enablePartnerAdminMenu, setEnablePartnerAdminMenu] = useState(false);
useEffect(() => {
- console.log(selectedPath);
+ //console.log(selectedPath);
if (selectedPath.includes('dashboard')) {
setActiveIcon("home");
} else if (selectedPath.includes('partnerCertificate')) {
diff --git a/pmp-reactjs-ui/src/pages/admin/partners/PartnersList.js b/pmp-reactjs-ui/src/pages/admin/partners/PartnersList.js
index fb274906..215e08cb 100644
--- a/pmp-reactjs-ui/src/pages/admin/partners/PartnersList.js
+++ b/pmp-reactjs-ui/src/pages/admin/partners/PartnersList.js
@@ -36,7 +36,6 @@ function PartnersList() {
const [firstIndex, setFirstIndex] = useState(0);
const [viewPartnerId, setViewPartnersId] = useState(-1);
const [selectedRecordsPerPage, setSelectedRecordsPerPage] = useState(8);
- const [serverRequest, setServerRequest] = useState({"filters": [], "sort": {"sortFieldName": "createdDateTime", "sortType": "desc"}, "pagination": {"pageNo":firstIndex, "pageSize":selectedRecordsPerPage}});
const [sortFieldName, setSortFieldName] = useState("createdDateTime");
const [sortType, setSortType] = useState("desc");
const [pageNo, setPageNo] = useState(0);
@@ -44,8 +43,6 @@ function PartnersList() {
const [triggerServerMethod, setTriggerServerMethod] = useState(false);
const [totalRecords, setTotalRecords] = useState(0);
const [tableDataLoaded, setTableDataLoaded] = useState(true);
- const [selectedPage, setSelectedPage] = useState(0);
- const [serverRecordPerPage, setServerRecordPerPage] = useState(8);
const defaultFilterQuery = {
orgName: "",
partnerType: "",
@@ -81,7 +78,6 @@ function PartnersList() {
triggerServerMethod ? setTableDataLoaded(false) : setDataLoaded(false);
const response = await HttpService.get(url);
if (response) {
- console.log(response);
const responseData = response.data;
if (responseData && responseData.response) {
const resData = responseData.response.data;
From a18e2d73810ec4404ba9bb5232f8caba1b2892d5 Mon Sep 17 00:00:00 2001
From: SwethaKrish4 <110164892+SwethaKrish4@users.noreply.github.com>
Date: Mon, 21 Oct 2024 19:04:26 +0530
Subject: [PATCH 3/3] MOSIP-36311: Added separate state variables for sorting
and pagination
Signed-off-by: SwethaKrish4 <110164892+SwethaKrish4@users.noreply.github.com>
---
pmp-reactjs-ui/src/pages/admin/partners/PartnersList.js | 1 -
1 file changed, 1 deletion(-)
diff --git a/pmp-reactjs-ui/src/pages/admin/partners/PartnersList.js b/pmp-reactjs-ui/src/pages/admin/partners/PartnersList.js
index 215e08cb..809fb7db 100644
--- a/pmp-reactjs-ui/src/pages/admin/partners/PartnersList.js
+++ b/pmp-reactjs-ui/src/pages/admin/partners/PartnersList.js
@@ -4,7 +4,6 @@ import { useTranslation } from "react-i18next";
import { getUserProfile } from "../../../services/UserProfileService";
import { isLangRTL, onPressEnterKey } from "../../../utils/AppUtils";
import {
- createRequest,
getPartnerManagerUrl,
handleServiceErrors,
getStatusCode,