From 397761de7e6cd416cde951024dc0c8f1f730134c Mon Sep 17 00:00:00 2001 From: Anil_Kumar_Majji <106086523+Anil-kumar-Majji@users.noreply.github.com> Date: Wed, 11 Dec 2024 11:52:26 +0530 Subject: [PATCH] MOSIP-36144 : UI Development Partner Admin Tabular view of uploaded certificates (#1012) * UI Development Partner Admin Tabular view of uploaded certificates Signed-off-by: Anil_Kumar_Majji <106086523+Anil-kumar-Majji@users.noreply.github.com> * UI Development Partner Admin Tabular View of uploaded certificates Signed-off-by: Anil_Kumar_Majji <106086523+Anil-kumar-Majji@users.noreply.github.com> * UI Development Partner Admin Tabular View of uploaded certificates Signed-off-by: Anil_Kumar_Majji <106086523+Anil-kumar-Majji@users.noreply.github.com> * UI Development Partner Admin Tabular View of uploaded certificates Signed-off-by: Anil_Kumar_Majji <106086523+Anil-kumar-Majji@users.noreply.github.com> --------- Signed-off-by: Anil_Kumar_Majji <106086523+Anil-kumar-Majji@users.noreply.github.com> --- pmp-revamp-ui/public/i18n/ara.json | 21 +- pmp-revamp-ui/public/i18n/eng.json | 15 +- pmp-revamp-ui/public/i18n/fra.json | 15 +- .../certificates/RootTrustCertificateList.js | 528 +++++------------- .../certificates/RootTrustCertificateTab.js | 42 ++ .../RootTrustCertificatesFilter.js | 95 ++-- .../UploadRootTrustCertificate.js | 2 +- 7 files changed, 295 insertions(+), 423 deletions(-) create mode 100644 pmp-revamp-ui/src/pages/admin/certificates/RootTrustCertificateTab.js diff --git a/pmp-revamp-ui/public/i18n/ara.json b/pmp-revamp-ui/public/i18n/ara.json index 1c7c21ec..28ca3753 100644 --- a/pmp-revamp-ui/public/i18n/ara.json +++ b/pmp-revamp-ui/public/i18n/ara.json @@ -412,10 +412,10 @@ "sbiVersion": "إصدار SBI", "searchVersion": "البحث عن إصدار SBI", "linkedDevices": "الأجهزة المرتبطة", - "status":"حالة", + "status": "حالة", "action": "الإجراء", "partnerId": "معرف الشريك", - "orgName":"منظمة", + "orgName": "منظمة", "partnerType": "نوع الشريك", "device": "جهاز", "sbiCreatedDate": "تاريخ إنشاء SBI", @@ -502,7 +502,7 @@ "ftmChipProviderServices": "خدمات مزودي شريحة FTM", "addFtmBtn": "إضافة شريحة FTM", "partnerId": "معرف الشريك", - "orgName":"منظمة", + "orgName": "منظمة", "listOfFtm": "قائمة تفاصيل شريحة FTM", "make": "يصنع", "model": "نموذج", @@ -561,7 +561,8 @@ "description": "عند النقر فوق تأكيد، سيتم إلغاء تنشيط تفاصيل شريحة FTM الخاصة بك." }, "rootTrustCertificate": { - "organisation": "منظمة", + "rootOfTrustCertificates": "جذر شهادات الثقة", + "certificateId": "معرف الشهادة", "partnerDomain": "مجال الشريك", "issuedTo": "صدر ل", "issuedBy": "صادرة عن", @@ -572,8 +573,10 @@ "action": "فعل", "UploadCertBtn": "تحميل الشهادة", "listOfCertificates": "قائمة شهادات جذر الثقة", - "selectOrganisation": "حدد المنظمة", + "selectCertificateId": "حدد معرف الشهادة", "selectPartnerDomain": "حدد مجال الشريك", + "selectIssuedTo": "حدد صدر إلى", + "selectIssuedBy": "اختر جهة الإصدار", "selectStatus": "حدد الحالة", "deActivate": "إلغاء التنشيط", "view": "منظر" @@ -585,10 +588,14 @@ "dropdownPlaceholder": "حدد مجال الشريك", "successMsg": "تم تحميل شهادة جذر الثقة لـ {{partnerDomain}} بنجاح" }, - "viewRootOfTrustCertificate": { - "viewRootOfTrustCertificate": "عرض شهادة جذر الثقة", + "rootTrustCertificateList": { + "rootTrustCertificateList": "قائمة جذر شهادات الثقة", + "rootOfTrustCertificates": "شهادات الثقة الجذرية", "caCertificates": "شهادات كاليفورنيا" }, + "intermediateTrustCertificateList": { + "intermediateRootTrustCertificates": "شهادات ثقة الجذر المتوسطة" + }, "partnerList": { "partnerTitle": "الشركاء", "listOfPartnerTitle": "قائمة الشركاء", diff --git a/pmp-revamp-ui/public/i18n/eng.json b/pmp-revamp-ui/public/i18n/eng.json index 928daff4..b25662bc 100644 --- a/pmp-revamp-ui/public/i18n/eng.json +++ b/pmp-revamp-ui/public/i18n/eng.json @@ -556,7 +556,8 @@ "description": "On clicking Confirm, your FTM Chip details will be deactivated." }, "rootTrustCertificate": { - "organisation": "Organisation", + "rootOfTrustCertificates": "Root of Trust Certificates", + "certificateId": "Certificate Id", "partnerDomain": "Partner Domain", "issuedTo": "Issued To", "issuedBy": "Issued By", @@ -567,8 +568,10 @@ "action": "Action", "UploadCertBtn": "Upload Certificate", "listOfCertificates": "List of Root of Trust certificates", - "selectOrganisation": "Select Organisation", + "selectCertificateId": "Select Certificate Id", "selectPartnerDomain": "Select Partner Domain", + "selectIssuedTo": "Select Issued To", + "selectIssuedBy": "Select Issued By", "selectStatus": "Select Status", "deActivate": "Deactivate", "view": "View" @@ -581,10 +584,14 @@ "dropdownPlaceholder": "Select partner domain", "successMsg": "Root of Trust Certificate for {{partnerDomain}} is uploaded successfully" }, - "viewRootOfTrustCertificate": { - "viewRootOfTrustCertificate": "View Root of Trust Certificate", + "rootTrustCertificateList": { + "rootTrustCertificateList": "List of Root of Trust Certificates", + "rootOfTrustCertificates": "Root Trust Certificates", "caCertificates": "Ca Certificates" }, + "intermediateTrustCertificateList": { + "intermediateRootTrustCertificates": "Intermediate Root Trust Certificates" + }, "partnerList": { "partnerTitle": "Partners", "listOfPartnerTitle": "List of Partners", diff --git a/pmp-revamp-ui/public/i18n/fra.json b/pmp-revamp-ui/public/i18n/fra.json index e7338024..b0f6adfe 100644 --- a/pmp-revamp-ui/public/i18n/fra.json +++ b/pmp-revamp-ui/public/i18n/fra.json @@ -561,7 +561,8 @@ "description": "En cliquant sur Confirmer, les détails de votre puce FTM seront désactivés." }, "rootTrustCertificate": { - "organisation": "Organisation", + "rootOfTrustCertificates": "Certificats racine de confiance", + "certificateId": "Id du certificat", "partnerDomain": "Domaine partenaire", "issuedTo": "Délivré à", "issuedBy": "Délivré par", @@ -572,8 +573,10 @@ "action": "Action", "UploadCertBtn": "Télécharger le certificat", "listOfCertificates": "Liste des certificats Root of Trust", - "selectOrganisation": "Sélectionnez une organisation", + "selectCertificateId": "Sélectionnez l'identifiant du certificat", "selectPartnerDomain": "Sélectionnez un domaine partenaire", + "selectIssuedTo": "Sélectionnez Délivré à", + "selectIssuedBy": "Sélectionnez Publié par", "selectStatus": "Sélectionnez le statut", "deActivate": "Désactiver", "view": "Voir" @@ -585,10 +588,14 @@ "dropdownPlaceholder": "Sélectionnez un domaine partenaire", "successMsg": "Le certificat racine de confiance pour {{partnerDomain}} a été téléchargé avec succès" }, - "viewRootOfTrustCertificate": { - "viewRootOfTrustCertificate": "Afficher le certificat racine de confiance", + "rootTrustCertificateList": { + "rootTrustCertificateList": "Liste des certificats racine de confiance", + "rootOfTrustCertificates": "Certificats de confiance racine", "caCertificates": "Certificats CA" }, + "intermediateTrustCertificateList": { + "intermediateRootTrustCertificates": "Certificats de confiance racine intermédiaires" + }, "partnerList":{ "partnerTitle": "Partenaires", "listOfPartnerTitle": "Liste des partenaires", diff --git a/pmp-revamp-ui/src/pages/admin/certificates/RootTrustCertificateList.js b/pmp-revamp-ui/src/pages/admin/certificates/RootTrustCertificateList.js index 3b31abb3..fc12aeaf 100644 --- a/pmp-revamp-ui/src/pages/admin/certificates/RootTrustCertificateList.js +++ b/pmp-revamp-ui/src/pages/admin/certificates/RootTrustCertificateList.js @@ -3,7 +3,7 @@ import { useNavigate } from 'react-router-dom'; import { useTranslation } from "react-i18next"; import { getUserProfile } from "../../../services/UserProfileService"; import { isLangRTL, onPressEnterKey } from "../../../utils/AppUtils"; -import { formatDate, getStatusCode, handleMouseClickForDropdown, toggleSortAscOrder, toggleSortDescOrder, bgOfStatus,} from "../../../utils/AppUtils"; +import { formatDate, getStatusCode, handleMouseClickForDropdown, toggleSortAscOrder, toggleSortDescOrder, bgOfStatus, } from "../../../utils/AppUtils"; import LoadingIcon from "../../common/LoadingIcon"; import ErrorMessage from "../../common/ErrorMessage"; import Title from "../../common/Title"; @@ -12,6 +12,8 @@ import FilterButtons from "../../common/FilterButtons"; import RootTrustCertificatesFilter from "./RootTrustCertificatesFilter"; import SortingIcon from "../../common/SortingIcon"; import Pagination from "../../common/Pagination"; +import RootTrustCertificateTab from "./RootTrustCertificateTab"; +import EmptyList from "../../common/EmptyList"; function RootTrustCertificateList() { const { t } = useTranslation(); @@ -20,7 +22,7 @@ function RootTrustCertificateList() { const isLoginLanguageRTL = isLangRTL(getUserProfile().langCode); const [errorCode, setErrorCode] = useState(""); const [errorMsg, setErrorMsg] = useState(""); - const [dataLoaded, setDataLoaded] = useState(false); + const [dataLoaded, setDataLoaded] = useState(true); const [certificateData, setCertificateData] = useState([]); const [filteredCertificateData, setFilteredCertificateData] = useState([]); const [order, setOrder] = useState("ASC"); @@ -30,6 +32,7 @@ function RootTrustCertificateList() { const [isDescending, setIsDescending] = useState(false); const [viewCertificateId, setViewCertificateId] = useState(-1); const [selectedRecordsPerPage, setSelectedRecordsPerPage] = useState(8); + const [tableDataLoaded, setTableDataLoaded] = useState(true); const defaultFilterQuery = { orgName: "", partnerDomain: "", @@ -42,11 +45,8 @@ function RootTrustCertificateList() { }, [submenuRef]); const tableHeaders = [ - { id: "orgName", headerNameKey: "rootTrustCertificate.organisation" }, - { - id: "partnerDomain", - headerNameKey: "rootTrustCertificate.partnerDomain", - }, + { id: "certificateId", headerNameKey: "rootTrustCertificate.certificateId" }, + { id: "partnerDomain", headerNameKey: "rootTrustCertificate.partnerDomain", }, { id: "issuedTo", headerNameKey: "rootTrustCertificate.issuedTo" }, { id: "issuedBy", headerNameKey: "rootTrustCertificate.issuedBy" }, { id: "validFrom", headerNameKey: "rootTrustCertificate.validFrom" }, @@ -56,36 +56,30 @@ function RootTrustCertificateList() { { id: "action", headerNameKey: "rootTrustCertificate.action" }, ]; - useEffect(() => { - const fetchData = async () => { - try { - setDataLoaded(false); - - const trustCertDummyData = []; - - const sortedData = trustCertDummyData.sort( - (a, b) => new Date(b.timeOfUpload) - new Date(a.timeOfUpload) - ); - setCertificateData(sortedData); - setFilteredCertificateData(sortedData); - setDataLoaded(true); - } catch (err) { - console.error("Error fetching data:", err); - setErrorMsg(err); - } - }; - fetchData(); - }, []); + const rootTrustCertificatesList = [ + {certId: "10081", partnerDomain: "AUTH", issuedTo: "client_auth1", issuedBy: "mosip_auth1", validFrom: "2024-12-10T19:35:01.085+00:00", validTill: "2025-12-10T19:35:01.085+00:00", timeOfUpload: "2024-12-09T19:35:01.085+00:00", status: "active"}, + {certId: "10082", partnerDomain: "AUTH", issuedTo: "client_auth2", issuedBy: "mosip_auth1", validFrom: "2024-11-21T19:35:01.085+00:00", validTill: "2025-12-21T19:35:01.085+00:00", timeOfUpload: "2024-12-20T19:35:01.085+00:00", status: "deactivated"}, + {certId: "10083", partnerDomain: "DEVICE", issuedTo: "device_client3", issuedBy: "mosip_device1", validFrom: "2024-09-11T19:35:01.085+00:00", validTill: "2025-12-09T19:35:01.085+00:00", timeOfUpload: "2024-12-11T19:35:01.085+00:00", status: "active"}, + {certId: "10084", partnerDomain: "FTM", issuedTo: "client_ftm2", issuedBy: "mosip_auth1", validFrom: "2024-12-10T19:35:31.085+00:00", validTill: "2025-12-10T19:35:01.085+00:00", timeOfUpload: "2024-12-09T19:35:01.085+00:00", status: "deactivated"}, + {certId: "10085", partnerDomain: "DEVICE", issuedTo: "device_client1", issuedBy: "mosip_device1", validFrom: "2024-12-08T19:35:01.085+00:00", validTill: "2025-12-08T19:35:01.085+00:00", timeOfUpload: "2024-12-05T19:35:01.085+00:00", status: "deactivated"}, + {certId: "10086", partnerDomain: "AUTH", issuedTo: "client_auth3", issuedBy: "mosip_auth1", validFrom: "2024-12-10T19:35:01.085+00:00", validTill: "2025-12-10T19:35:01.085+00:00", timeOfUpload: "2024-12-07T19:35:01.085+00:00", status: "active"}, + {certId: "10087", partnerDomain: "DEVICE", issuedTo: "device_client1", issuedBy: "mosip_device1", validFrom: "2024-12-19T19:35:01.085+00:00", validTill: "2025-12-19T19:35:01.085+00:00", timeOfUpload: "2024-12-08T19:35:01.085+00:00", status: "active"}, + {certId: "10088", partnerDomain: "FTM", issuedTo: "client_ftm3", issuedBy: "mosip_auth1", validFrom: "2024-12-27T19:35:01.085+00:00", validTill: "2025-12-27T19:35:01.085+00:00", timeOfUpload: "2024-12-24T19:35:01.085+00:00", status: "deactivated"}, + {certId: "10089", partnerDomain: "AUTH", issuedTo: "client_auth2", issuedBy: "mosip_auth1", validFrom: "2024-12-14T19:35:01.085+00:00", validTill: "2025-12-14T19:35:01.085+00:00", timeOfUpload: "2024-12-13T19:35:01.085+00:00", status: "active"}, + {certId: "100810", partnerDomain: "FTM", issuedTo: "client_ftm2", issuedBy: "mosip_auth1", validFrom: "2024-12-03T19:35:01.085+00:00", validTill: "2025-12-03T19:35:01.085+00:00", timeOfUpload: "2024-12-03T19:35:01.085+00:00", status: "active"}, + {certId: "100811", partnerDomain: "DEVICE", issuedTo: "device_client1", issuedBy: "mosip_device1", validFrom: "2024-12-06T19:35:01.085+00:00", validTill: "2025-12-06T19:35:01.085+00:00", timeOfUpload: "2024-12-11T19:35:01.085+00:00", status: "deactivated"}, + {certId: "100812", partnerDomain: "DEVICE", issuedTo: "device_client1", issuedBy: "mosip_device1", validFrom: "2024-12-01T19:35:01.085+00:00", validTill: "2025-12-01T19:35:01.085+00:00", timeOfUpload: "2024-12-04T19:35:01.085+00:00", status: "active"}, + {certId: "100813", partnerDomain: "AUTH", issuedTo: "client_auth3", issuedBy: "mosip_auth1", validFrom: "2024-12-22T19:35:01.085+00:00", validTill: "2025-12-22T19:35:01.085+00:00", timeOfUpload: "2024-12-20T19:35:01.085+00:00", status: "active"}, + {certId: "100814", partnerDomain: "AUTH", issuedTo: "client_auth3", issuedBy: "mosip_auth1", validFrom: "2024-12-05T19:35:01.085+00:00", validTill: "2025-12-15T19:35:01.085+00:00", timeOfUpload: "2024-12-04T19:35:01.085+00:00", status: "active"}, + {certId: "100815", partnerDomain: "FTM", issuedTo: "client_ftm1", issuedBy: "mosip_auth1", validFrom: "2024-12-18T19:35:01.085+00:00", validTill: "2025-12-18T19:35:01.085+00:00", timeOfUpload: "2024-12-15T19:35:01.085+00:00", status: "deactivated"}, +]; const showUploadCertificate = () => { navigate('/partnermanagement/admin/certificates/upload-root-trust-certificate') }; const showCertificateDetails = (selectedCertificateData) => { - localStorage.setItem( - "selectedCertificateData", - JSON.stringify(selectedCertificateData) - ); + }; const cancelErrorMsg = () => { @@ -93,59 +87,11 @@ function RootTrustCertificateList() { }; //This part is related to Sorting - const sortAscOrder = (header) => { - const isDateCol = header === "timeOfUpload" ? true : false; - toggleSortAscOrder( - header, - isDateCol, - filteredCertificateData, - setFilteredCertificateData, - order, - setOrder, - isDescending, - setIsDescending, - activeSortAsc, - setActiveSortAsc, - activeSortDesc, - setActiveSortDesc - ); - }; - - const sortDescOrder = (header) => { - const isDateCol = header === "timeOfUpload" ? true : false; - toggleSortDescOrder( - header, - isDateCol, - filteredCertificateData, - setFilteredCertificateData, - order, - setOrder, - isDescending, - setIsDescending, - activeSortAsc, - setActiveSortAsc, - activeSortDesc, - setActiveSortDesc - ); - }; const style = { backArrowIcon: "!mt-[9%]", }; - useEffect(() => { - let filteredRows = certificateData; - Object.keys(filterQuery).forEach((key) => { - if (filterQuery[key] !== "") { - filteredRows = filteredRows.filter( - (item) => item[key] === filterQuery[key] - ); - } - }); - setFilteredCertificateData(filteredRows); - setFirstIndex(0); - }, [filterQuery, certificateData]); - const onResetFilter = () => { window.location.reload(); }; @@ -156,325 +102,157 @@ function RootTrustCertificateList() { firstIndex + selectedRecordsPerPage ); - //This part is related to Filter - const onFilterChange = (fieldName, selectedFilter) => { - setFilterQuery((oldFilterQuery) => ({ - ...oldFilterQuery, - [fieldName]: selectedFilter, - })); - //useEffect will be triggered which will do the filter + const showDeactivateCertificate = (selectedClientdata) => { + }; - const showDeactivateCertificate = (selectedClientdata) => { - if (selectedClientdata.status === "ACTIVE") { - document.body.style.overflow = "hidden"; - } + const styles = { + loadingDiv: "!py-[20%]" }; return ( -
-
- {t(header.headerNameKey)}
- {header.id !== "action" && (
-
- |
- );
- })}
- ||||||||
---|---|---|---|---|---|---|---|---|
- showCertificateDetails(certificate) - } - className="px-2" - > - {certificate.orgName} - | -- showCertificateDetails(certificate) - } - className="px-2" - > - {certificate.partnerDomain} - | -- showCertificateDetails(certificate) - } - className="px-2" - > - {certificate.issuedTo} - | -- showCertificateDetails(certificate) - } - className="px-2" - > - {certificate.issuedBy} - | -- showCertificateDetails(certificate) - } - className="px-2" - > - {formatDate( - certificate.validFrom, - "date", - false - )} - | -- showCertificateDetails(certificate) - } - className="px-2" - > - {formatDate( - certificate.validTill, - "date", - false - )} - | -- showCertificateDetails(certificate) - } - className="px-2" - > - {formatDate( - certificate.timeOfUpload, - "date", - false - )} - | -
- showCertificateDetails(certificate)
- }
- className=""
- >
-
- {getStatusCode(certificate.status, t)}
-
- |
-
-
- (submenuRef.current[index] = el)
- }
- >
-
- - setViewCertificateId( - index === viewCertificateId - ? null - : index - ) - } - className={`font-semibold mb-0.5 cursor-pointer text-center`} - tabIndex="0" - onKeyPress={(e) => - onPressEnterKey(e, () => - setViewCertificateId( - index === viewCertificateId - ? null - : index - ) - ) - } - > - ... - - {viewCertificateId === index && ( -
-
- )}
- - showCertificateDetails(certificate) - } - className={`py-1.5 px-4 cursor-pointer text-[#3E3E3E] hover:bg-gray-100 ${isLoginLanguageRTL - ? "pl-10" - : "pr-10" - }`} - tabIndex="0" - onKeyPress={(e) => - onPressEnterKey(e, () => - showCertificateDetails( - certificate - ) - ) - } - > - {t("rootTrustCertificate.view")} - -- - showDeactivateCertificate(certificate) - } - className={`py-1.5 px-4 ${isLoginLanguageRTL - ? "pl-10" - : "pr-10" - } ${certificate.status === "approved" - ? "text-crimson-red cursor-pointer" - : "text-[#A5A5A5] cursor-auto" - } hover:bg-gray-100`} - tabIndex="0" - onKeyPress={(e) => - onPressEnterKey(e, () => - showDeactivateCertificate( - certificate - ) - ) - } - > - {t("rootTrustCertificate.deActivate")} - - |
-
+
+ {t(header.headerNameKey)}
+ {header.id !== "action" && (
+
+ |
+ );
+ })}
+ ||||||||
---|---|---|---|---|---|---|---|---|
showCertificateDetails(certificate)} className={`${isLoginLanguageRTL ? 'pr-[0.2rem]' : 'pl-[0.2rem]'}`}>{certificate.certId} | +showCertificateDetails(certificate)} className={`${isLoginLanguageRTL ? 'pr-[0.2rem]' : 'pl-[0.2rem]'}`}>{certificate.partnerDomain} | +showCertificateDetails(certificate)}>{certificate.issuedTo} | +showCertificateDetails(certificate)}>{certificate.issuedBy} | +showCertificateDetails(certificate)} className="px-1">{formatDate(certificate.validFrom, "date", false)} | +showCertificateDetails(certificate)} className={`${isLoginLanguageRTL ? 'pr-[0.2rem]' : 'pl-[0.2rem]'}`}>{formatDate(certificate.validTill, "date", false)} | +showCertificateDetails(certificate)}>{formatDate(certificate.timeOfUpload, "dateTime", false)} | + showCertificateDetails(certificate)}>
+
+ {getStatusCode(certificate.status, t)}
+
+ |
+
+ (submenuRef.current[index] = el)}>
+
+ setViewCertificateId(index === viewCertificateId ? null : index)} className={`font-semibold mb-0.5 cursor-pointer text-center`} + tabIndex="0" onKeyPress={(e) => onPressEnterKey(e, () => setViewCertificateId(index === viewCertificateId ? null : index))} + > + ... + + {viewCertificateId === index && ( +
+
+ )}
+ showCertificateDetails(certificate)} className={`py-1.5 px-4 cursor-pointer text-[#3E3E3E] hover:bg-gray-100 ${isLoginLanguageRTL ? "pl-10" : "pr-10"}`} + tabIndex="0" onKeyPress={(e) => onPressEnterKey(e, () => showCertificateDetails(certificate))} + > + {t("rootTrustCertificate.view")} + ++ showDeactivateCertificate(certificate)} + className={`py-1.5 px-4 ${isLoginLanguageRTL ? "pl-10" : "pr-10"} ${certificate.status === "active" ? "cursor-pointer" : "text-[#A5A5A5] cursor-auto"} hover:bg-gray-100`} + tabIndex="0" onKeyPress={(e) => onPressEnterKey(e, () => showDeactivateCertificate(certificate))} + > + {t("rootTrustCertificate.deActivate")} + + |
+