Skip to content

Commit

Permalink
MOSIP-36405: Removed mosip signed certificate download option (#827)
Browse files Browse the repository at this point in the history
Signed-off-by: SwethaKrish4 <[email protected]>
  • Loading branch information
SwethaKrish4 authored Oct 9, 2024
1 parent fd37a0f commit 02b8833
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 67 deletions.
3 changes: 1 addition & 2 deletions pmp-reactjs-ui/public/i18n/ara.json
Original file line number Diff line number Diff line change
Expand Up @@ -507,8 +507,7 @@
"listOfFtmChipDetails": "قائمة تفاصيل شريحة FTM",
"ftmChipProvider": "مزود رقاقة FTM",
"ftmChipCertificate": " شهادة رقاقة FTM",
"originalCertSuccessMsg": "تم تنزيل الشهادة الأصلية بنجاح.",
"mosipSignedCertificateSuccessMsg": "تم تنزيل شهادة MOSIP الموقعة بنجاح."
"originalCertSuccessMsg": "تم تنزيل شهادة FTM Chip بنجاح."
},
"manageFtmChipCertificate": {
"manageFtmChipCertificate": "إدارة شهادة شريحة FTM",
Expand Down
3 changes: 1 addition & 2 deletions pmp-reactjs-ui/public/i18n/eng.json
Original file line number Diff line number Diff line change
Expand Up @@ -502,8 +502,7 @@
"listOfFtmChipDetails": "List of FTM Chip details",
"ftmChipProvider": "FTM Chip Provider",
"ftmChipCertificate": " FTM Chip Certificate",
"originalCertSuccessMsg": "Original Certificate downloaded successfully.",
"mosipSignedCertificateSuccessMsg": "MOSIP Signed Certificate downloaded successfully."
"originalCertSuccessMsg": "FTM Chip certificate is downloaded successfully."
},
"manageFtmChipCertificate": {
"manageFtmChipCertificate": "Manage FTM Chip Certificate",
Expand Down
3 changes: 1 addition & 2 deletions pmp-reactjs-ui/public/i18n/fra.json
Original file line number Diff line number Diff line change
Expand Up @@ -507,8 +507,7 @@
"listOfFtmChipDetails": "Liste des détails de la puce FTM",
"ftmChipProvider": "Fournisseur de puces FTM",
"ftmChipCertificate": " Certificat de puce FTM",
"originalCertSuccessMsg": "Certificat original téléchargé avec succès.",
"mosipSignedCertificateSuccessMsg": "Le certificat signé MOSIP a été téléchargé avec succès."
"originalCertSuccessMsg": "Le certificat de la puce FTM a été téléchargé avec succès."
},
"manageFtmChipCertificate": {
"manageFtmChipCertificate": "Gérer le certificat de puce FTM",
Expand Down
1 change: 1 addition & 0 deletions pmp-reactjs-ui/src/nav/SideNav.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ function SideNav({ open, policyRequiredPartnerTypes, partnerType }) {
setActiveIcon("pendingRequests");
};
const showRootOfTrustCertificate = () => {
navigate('/partnermanagement/admin/certificates/rootTrustCertificateList')
setActiveIcon("rootOfTrustCertificate");
};
const showPartner = () => {
Expand Down
16 changes: 8 additions & 8 deletions pmp-reactjs-ui/src/pages/dashboard/Dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ function Dashboard() {
)}
{isPartnerAdmin && (
<>
<div className="w-[23.5%] min-h-[50%] p-6 mr-3 mb-4 pt-16 bg-white border border-gray-200 shadow cursor-pointer text-center rounded-xl" tabIndex="0" onKeyPress={(e) => onPressEnterKey(e, partnerCertificatesList())}>
<div className="w-[23.5%] min-h-[50%] p-6 mr-3 mb-4 pt-16 bg-white border border-gray-200 shadow cursor-pointer text-center rounded-xl">
<div className="flex justify-center mb-5">
<img src={pending_requests_icon} alt="" className="w-8 h-8"></img>
</div>
Expand All @@ -279,7 +279,7 @@ function Dashboard() {
</div>
</div>

<div onClick={rootTrustCertificateList} className="w-[23.5%] min-h-[50%] p-6 mr-3 mb-4 pt-16 bg-white border border-gray-200 shadow cursor-pointer text-center rounded-xl" tabIndex="0" onKeyPress={(e) => onPressEnterKey(e, partnerCertificatesList())}>
<div onClick={rootTrustCertificateList} className="w-[23.5%] min-h-[50%] p-6 mr-3 mb-4 pt-16 bg-white border border-gray-200 shadow cursor-pointer text-center rounded-xl" tabIndex="0" onKeyPress={(e) => onPressEnterKey(e, rootTrustCertificateList())}>
<div className="flex justify-center mb-5">
<img src={partnerCertificateIcon} alt="" className="w-8 h-8"></img>
</div>
Expand All @@ -293,7 +293,7 @@ function Dashboard() {
</div>
</div>

<div className="w-[23.5%] min-h-[50%] p-6 mr-3 mb-4 pt-16 bg-white border border-gray-200 shadow cursor-pointer text-center rounded-xl" tabIndex="0" onKeyPress={(e) => onPressEnterKey(e, partnerCertificatesList())}>
<div className="w-[23.5%] min-h-[50%] p-6 mr-3 mb-4 pt-16 bg-white border border-gray-200 shadow cursor-pointer text-center rounded-xl">
<div className="flex justify-center mb-5">
<img src={partner_admin_icon} alt="" className="w-8 h-8"></img>
</div>
Expand All @@ -307,7 +307,7 @@ function Dashboard() {
</div>
</div>

<div className="w-[23.5%] min-h-[50%] p-6 mr-3 mb-4 pt-16 bg-white border border-gray-200 shadow cursor-pointer text-center rounded-xl" tabIndex="0" onKeyPress={(e) => onPressEnterKey(e, partnerCertificatesList())}>
<div className="w-[23.5%] min-h-[50%] p-6 mr-3 mb-4 pt-16 bg-white border border-gray-200 shadow cursor-pointer text-center rounded-xl">
<div className="flex justify-center mb-5">
<img src={admin_policies_icon} alt="" className="w-8 h-8"></img>
</div>
Expand All @@ -321,7 +321,7 @@ function Dashboard() {
</div>
</div>

<div className="w-[23.5%] min-h-[50%] p-6 mr-3 mb-4 pt-16 bg-white border border-gray-200 shadow cursor-pointer text-center rounded-xl" tabIndex="0" onKeyPress={(e) => onPressEnterKey(e, partnerCertificatesList())}>
<div className="w-[23.5%] min-h-[50%] p-6 mr-3 mb-4 pt-16 bg-white border border-gray-200 shadow cursor-pointer text-center rounded-xl">
<div className="flex justify-center mb-5">
<img src={partner_policy_mapping_icon} alt="" className="w-8 h-8"></img>
</div>
Expand All @@ -335,7 +335,7 @@ function Dashboard() {
</div>
</div>

<div className="w-[23.5%] min-h-[50%] p-6 mr-3 mb-4 pt-16 bg-white border border-gray-200 shadow cursor-pointer text-center rounded-xl" tabIndex="0" onKeyPress={(e) => onPressEnterKey(e, partnerCertificatesList())}>
<div className="w-[23.5%] min-h-[50%] p-6 mr-3 mb-4 pt-16 bg-white border border-gray-200 shadow cursor-pointer text-center rounded-xl">
<div className="flex justify-center mb-5">
<img src={deviceProviderServices_icon} alt="" className="w-8 h-8"></img>
</div>
Expand All @@ -349,7 +349,7 @@ function Dashboard() {
</div>
</div>

<div className="w-[23.5%] min-h-[50%] p-6 mr-3 mb-4 pt-16 bg-white border border-gray-200 shadow cursor-pointer text-center rounded-xl" tabIndex="0" onKeyPress={(e) => onPressEnterKey(e, partnerCertificatesList())}>
<div className="w-[23.5%] min-h-[50%] p-6 mr-3 mb-4 pt-16 bg-white border border-gray-200 shadow cursor-pointer text-center rounded-xl">
<div className="flex justify-center mb-5">
<img src={ftmServicesIcon} alt="" className="w-8 h-8"></img>
</div>
Expand All @@ -363,7 +363,7 @@ function Dashboard() {
</div>
</div>

<div className="w-[23.5%] min-h-[50%] p-6 mr-3 mb-4 pt-16 bg-white border border-gray-200 shadow cursor-pointer text-center rounded-xl" tabIndex="0" onKeyPress={(e) => onPressEnterKey(e, partnerCertificatesList())}>
<div className="w-[23.5%] min-h-[50%] p-6 mr-3 mb-4 pt-16 bg-white border border-gray-200 shadow cursor-pointer text-center rounded-xl">
<div className="flex justify-center mb-5">
<img src={authServiceIcon} alt="" className="w-8 h-8"></img>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import React, { useState, useEffect, useRef } from "react";
import React, { useState, useEffect } from "react";
import { useTranslation } from "react-i18next";
import { useNavigate } from "react-router-dom";
import { getUserProfile } from "../../../services/UserProfileService";
import { bgOfStatus, formatDate, getStatusCode, isLangRTL, getPartnerDomainType, handleMouseClickForDropdown, getPartnerManagerUrl } from "../../../utils/AppUtils";
import { bgOfStatus, formatDate, getStatusCode, isLangRTL, getPartnerDomainType, getPartnerManagerUrl } from "../../../utils/AppUtils";
import Title from "../../common/Title";
import fileUploadBlue from '../../../svg/file_upload_blue_icon.svg';
import fileUploadDisabled from '../../../svg/file_upload_disabled_icon.svg';
import somethingWentWrongIcon from '../../../svg/something_went_wrong_icon.svg';
import fileUpload from '../../../svg/file_upload_icon.svg';
import file from '../../../svg/file_icon.svg';
import UploadCertificate from "./../certificates/UploadCertificate";
import DownloadCertificateButton from "../../common/DownloadCertificateButton";
import ErrorMessage from "../../common/ErrorMessage";
import SuccessMessage from "../../common/SuccessMessage";
import { HttpService } from "../../../services/HttpService";
Expand All @@ -26,13 +25,7 @@ function ViewFtmChipDetails() {
const [errorCode, setErrorCode] = useState("");
const [errorMsg, setErrorMsg] = useState("");
const [successMsg, setSuccessMsg] = useState("");
const [showDropDownOptions, setShowDropDownOptions] = useState(false);
const [uploadCertificateData, setUploadCertificateData] = useState({});
const dropdownRef = useRef(null);

useEffect(() => {
handleMouseClickForDropdown(dropdownRef, () => setShowDropDownOptions(false))
}, [dropdownRef]);

useEffect(() => {
const selectedFtm = localStorage.getItem('selectedFtmData');
Expand Down Expand Up @@ -88,20 +81,6 @@ function ViewFtmChipDetails() {
}
}

const getMosipSignedCertificate = async (ftmDetails) => {
if (ftmDetails.status === 'approved') {
const response = await getCertificate(ftmDetails.ftmId);
if (response !== null) {
if (response.isMosipSignedCertificateExpired) {
setErrorMsg(t('partnerCertificatesList.certificateExpired'));
} else {
setSuccessMsg(t('viewFtmChipDetails.mosipSignedCertificateSuccessMsg'));
downloadCertificate(response.mosipSignedCertificateData, 'mosip_signed_certificate.cer')
}
}
}
}

const downloadCertificate = (certificateData, fileName) => {
const blob = new Blob([certificateData], { type: 'application/x-x509-ca-cert' });
const url = window.URL.createObjectURL(blob);
Expand Down Expand Up @@ -158,14 +137,6 @@ function ViewFtmChipDetails() {
setSuccessMsg("");
};

const viewFtmDownloadButtonStyle = {
outerDiv: `w-[18%] min-w-fit absolute py-2 px-1 ${isLoginLanguageRTL ? "origin-bottom-right left-[5.6rem] ml-2" : "origin-bottom-left right-[5.6rem] mr-2"} rounded-md bg-white shadow-lg ring-gray-50 border duration-700 max-520:right-[3rem]`
};

const mangeFtmDownloadButtonStyle = {
outerDiv: `w-[18%] min-w-fit absolute py-2 px-1 ${isLoginLanguageRTL ? "origin-bottom-right left-[13rem] ml-2" : "origin-bottom-left right-[13rem] mr-2"} rounded-md bg-white shadow-lg ring-gray-50 border duration-700 max-640:right-[5.5rem] max-520:right-[3.5rem]`
};

return (
<>
{errorMsg && (
Expand Down Expand Up @@ -273,31 +244,17 @@ function ViewFtmChipDetails() {

<div className=" flex space-x-2">
{ftmDetails.isViewFtmChipDetails && (
< DownloadCertificateButton
disableBtn={ftmDetails.status !== 'approved' && ftmDetails.status !== 'pending_approval'}
downloadDropdownRef={dropdownRef}
setShowDropDown={() => setShowDropDownOptions(!showDropDownOptions)}
showDropDown={showDropDownOptions}
onClickFirstOption={getOriginalCertificate}
onClickSecondOption={getMosipSignedCertificate}
requiredData={{ ...ftmDetails, disableSecondOption: ftmDetails.status !== 'approved' }}
styleSet={viewFtmDownloadButtonStyle}
id='download_btn'
/>
<button id='download_btn' disabled={ftmDetails.status !== 'approved' && ftmDetails.status !== 'pending_approval'} onClick={() => getOriginalCertificate(ftmDetails)}
className={`flex items-center text-center w-fit h-10 ${isLoginLanguageRTL ? "ml-5" : "mr-5"} ${(ftmDetails.status !== 'approved' && ftmDetails.status !== 'pending_approval') ? 'text-[#6f7070] border-gray-300 bg-white' : 'text-tory-blue bg-white border-blue-800'} text-xs px-[1.5rem] py-[1%] border font-semibold rounded-lg text-center`}>
{t('commons.download')}
</button>
)}
{ftmDetails.isManageFtmCertificate && (
<div className="flex space-x-2 max-640:flex-col max-640:space-y-2 max-640:space-x-0">
< DownloadCertificateButton
disableBtn={ftmDetails.isCertificateAvailable ? false : true}
downloadDropdownRef={dropdownRef}
setShowDropDown={() => setShowDropDownOptions(!showDropDownOptions)}
showDropDown={showDropDownOptions}
onClickFirstOption={getOriginalCertificate}
onClickSecondOption={getMosipSignedCertificate}
requiredData={{ ...ftmDetails, disableSecondOption: ftmDetails.status !== 'approved' }}
styleSet={mangeFtmDownloadButtonStyle}
id='download_btn'
/>
<button id='download_btn' disabled={!ftmDetails.isCertificateAvailable} onClick={() => getOriginalCertificate(ftmDetails)}
className={`flex items-center text-center w-fit h-10 ${isLoginLanguageRTL ? "ml-5" : "mr-5"} ${!ftmDetails.isCertificateAvailable ? 'text-[#6f7070] border-gray-300 bg-white' : 'text-tory-blue bg-white border-blue-800'} text-xs px-[1.5rem] py-[1%] border font-semibold rounded-lg text-center`}>
{t('commons.download')}
</button>
<button id="certificate_reupload_btn" onClick={clickOnUpload} className={`h-10 w-28 text-xs p-3 py-2 ${ftmDetails.isCertificateAvailable ? 'text-tory-blue bg-white border-blue-800' : 'bg-tory-blue text-snow-white'} border font-semibold rounded-md text-center`}>
{ftmDetails.isCertificateAvailable ? t('partnerCertificatesList.reUpload') : t('partnerCertificatesList.upload')}
</button>
Expand Down

0 comments on commit 02b8833

Please sign in to comment.