Skip to content

Commit

Permalink
MOSIP-37610: UI Enhancements Applicable for all Partners and Partner …
Browse files Browse the repository at this point in the history
…Admin screens

Signed-off-by: Anil_Kumar_Majji <[email protected]>
  • Loading branch information
Anil-kumar-Majji committed Jan 9, 2025
1 parent baa178e commit 5ed27ed
Show file tree
Hide file tree
Showing 20 changed files with 174 additions and 187 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,6 @@ function AdminApiKeysList() {
}
};

const closeDeactivatePopup = () => {
setActionId(-1);
setShowDeactivatePopup(false);
document.body.style.overflow = "auto";
};

const deactivateApiKey = (selectedApiKeyData) => {
if (selectedApiKeyData.status === "activated") {
Expand All @@ -173,10 +168,16 @@ function AdminApiKeysList() {
status: "De-Active"
});
setDeactivateRequest(request);
setActionId(-1);
setShowDeactivatePopup(true);
document.body.style.overflow = "hidden";
}
}
};

const closeDeactivatePopup = () => {
setShowDeactivatePopup(false);
document.body.style.overflow = "auto";
};

const onClickConfirmDeactivate = (deactivationResponse, selectedApiKey) => {
if (deactivationResponse !== "") {
Expand Down Expand Up @@ -308,19 +309,19 @@ function AdminApiKeysList() {
<p id="api_key_list_deactivate_btn" className={`py-1.5 px-4 ${isLoginLanguageRTL ? "pl-10" : "pr-10"} ${apiKey.status === 'activated' ? "text-[#3E3E3E]" : "text-[#A5A5A5]"}`}>{t("partnerList.deActivate")}</p>
<img src={apiKey.status === 'activated' ? deactivateIcon : disableDeactivateIcon} alt="" className={`${isLoginLanguageRTL ? "pl-2" : "pr-2"}`} />
</div>
{showDeactivatePopup && (
<DeactivatePopup
closePopUp={closeDeactivatePopup}
onClickConfirm={(deactivationResponse) => onClickConfirmDeactivate(deactivationResponse, apiKey)}
popupData={apiKey}
request={deactivateRequest}
headerMsg="adminDeactivateApiKey.title"
descriptionMsg="adminDeactivateApiKey.description"
headerKeyName={apiKey.apiKeyLabel}
/>
)}
</div>
)}
{showDeactivatePopup && (
<DeactivatePopup
closePopUp={closeDeactivatePopup}
onClickConfirm={(deactivationResponse) => onClickConfirmDeactivate(deactivationResponse, apiKey)}
popupData={apiKey}
request={deactivateRequest}
headerMsg="adminDeactivateApiKey.title"
descriptionMsg="adminDeactivateApiKey.description"
headerKeyName={apiKey.apiKeyLabel}
/>
)}
</div>
</td>
</tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ function AdminOidcClientsList() {
});
setDeactivateRequest(request);
setShowDeactivatePopup(true);
setActionId(-1);
document.body.style.overflow = "hidden";
} else {
setErrorMsg(t('deactivateOidc.errorInOidcDetails'));
Expand All @@ -218,7 +219,6 @@ function AdminOidcClientsList() {
};

const closeDeactivatePopup = () => {
setActionId(-1);
setShowDeactivatePopup(false);
document.body.style.overflow = "auto";
};
Expand Down Expand Up @@ -352,11 +352,11 @@ function AdminOidcClientsList() {
<p id="oidc_clients_list_deactivate_btn" className={`py-1.5 px-4 ${isLoginLanguageRTL ? "pl-10" : "pr-10"} ${client.status === 'ACTIVE' ? "text-[#3E3E3E]" : "text-[#A5A5A5]"}`}>{t("partnerList.deActivate")}</p>
<img src={client.status === 'ACTIVE' ? deactivateIcon : disableDeactivateIcon} alt="" className={`${isLoginLanguageRTL ? "pl-2" : "pr-2"}`} />
</div>
{showDeactivatePopup && (
<DeactivatePopup closePopUp={closeDeactivatePopup} onClickConfirm={(deactivationResponse) => onClickConfirmDeactivate(deactivationResponse, client)} popupData={client} request={deactivateRequest} headerMsg='deactivateOidc.header' descriptionMsg='deactivateOidc.description' headerKeyName={client.clientNameEng} />
)}
</div>
)}
{showDeactivatePopup && (
<DeactivatePopup closePopUp={closeDeactivatePopup} onClickConfirm={(deactivationResponse) => onClickConfirmDeactivate(deactivationResponse, client)} popupData={client} request={deactivateRequest} headerMsg='deactivateOidc.header' descriptionMsg='deactivateOidc.description' headerKeyName={client.clientNameEng} />
)}
</div>
</td>
</tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,6 @@ function CertificatesList({ certificateType, viewCertificateDetails, uploadCerti
navigate('/partnermanagement/admin/certificates/upload-trust-certificate')
};

const showDeactivateCertificate = () => {

};

const onClickDownload = (certificate) => {
if (certificate.status === true) {
downloadCaCertificate(HttpService, certificate.certId, certificateType, setErrorCode, setErrorMsg, errorMsg, setSuccessMsg, t);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,14 @@ function AdminDevicesList({ title, subTitle, isLinkedDevicesList }) {

const approveRejectDeviceDetails = (device) => {
if (device.status === 'pending_approval') {
setActionId(-1);
setShowDeviceDetailApproveRejectPopup(true);
document.body.style.overflow = "hidden";
}
};

const onClickApproveReject = (responseData, status, selectedDevice) => {
if (responseData) {
setActionId(-1);
setShowDeviceDetailApproveRejectPopup(false);
// Update the specific row in the state with the new status
setDevicesList((prevList) =>
Expand All @@ -189,7 +189,6 @@ function AdminDevicesList({ title, subTitle, isLinkedDevicesList }) {
};

const closeApproveRejectPopup = () => {
setActionId(-1);
setShowDeviceDetailApproveRejectPopup(false);
document.body.style.overflow = "auto";
};
Expand All @@ -200,6 +199,7 @@ function AdminDevicesList({ title, subTitle, isLinkedDevicesList }) {
status: "De-Activate",
}, "mosip.pms.deactivate.device.patch", true);
setDeactivateRequest(request);
setActionId(-1);
setShowDeactivatePopup(true);
document.body.style.overflow = "hidden";
}
Expand All @@ -208,7 +208,6 @@ function AdminDevicesList({ title, subTitle, isLinkedDevicesList }) {

const onClickConfirmDeactivate = (deactivationResponse, selectedDevice) => {
if (deactivationResponse && !deactivationResponse.isActive) {
setActionId(-1);
setShowDeactivatePopup(false);
// Update the specific row in the state with the new status
setDevicesList((prevList) =>
Expand All @@ -220,7 +219,6 @@ function AdminDevicesList({ title, subTitle, isLinkedDevicesList }) {
};

const closeDeactivatePopup = () => {
setActionId(-1);
setShowDeactivatePopup(false);
document.body.style.overflow = "auto";
};
Expand Down Expand Up @@ -287,10 +285,7 @@ function AdminDevicesList({ title, subTitle, isLinkedDevicesList }) {
)}
<div className="flex-col mt-5">
<div className="flex justify-between mb-5 max-470:flex-col">
<Title
title={title}
backLink='/partnermanagement'
/>
<Title title={title} backLink='/partnermanagement' />
</div>
<DeviceProviderServicesTab
activeSbi={isLinkedDevicesList ? true: false}
Expand Down Expand Up @@ -384,16 +379,6 @@ function AdminDevicesList({ title, subTitle, isLinkedDevicesList }) {
<p id="device_list_approve_reject_option" className={`py-1.5 px-4 ${device.status === 'pending_approval' ? 'text-[#3E3E3E] cursor-pointer' : 'text-[#A5A5A5] cursor-default'} ${isLoginLanguageRTL ? "pl-10" : "pr-10"}`}>{t("approveRejectPopup.approveReject")}</p>
<img src={device.status === 'pending_approval' ? approveRejectIcon : disabledApproveRejectIcon} alt="" className={`${isLoginLanguageRTL ? "pl-2" : "pr-2"}`} />
</div>
{showDeviceDetailApproveRejectPopup && (
<ApproveRejectPopup
popupData={{ ...device, isDeviceRequest: true }}
closePopUp={closeApproveRejectPopup}
approveRejectResponse={(responseData, status) => onClickApproveReject(responseData, status, device)}
title={`${device.make} | ${device.model}`}
header={t('deviceApproveRejectPopup.header')}
description={t('deviceApproveRejectPopup.description')}
/>
)}
<hr className="h-px bg-gray-100 border-0 mx-1" />
<div role='button' className="flex justify-between hover:bg-gray-100" onClick={() => viewDeviceDetails(device)} tabIndex="0" onKeyDown={(e) => onPressEnterKey(e, () => viewDeviceDetails(device))}>
<p id="device_list_view_option" className={`py-1.5 px-4 cursor-pointer text-[#3E3E3E] ${isLoginLanguageRTL ? "pl-10" : "pr-10"}`}>{t("partnerList.view")}</p>
Expand All @@ -404,11 +389,21 @@ function AdminDevicesList({ title, subTitle, isLinkedDevicesList }) {
<p id="device_list_deactivate_option" className={`py-1.5 px-4 ${isLoginLanguageRTL ? "pl-10" : "pr-10"} ${device.status === 'approved' ? "text-[#3E3E3E]" : "text-[#A5A5A5]"}`}>{t("partnerList.deActivate")}</p>
<img src={device.status === 'approved' ? deactivateIcon : disableDeactivateIcon} alt="" className={`${isLoginLanguageRTL ? "pl-2" : "pr-2"}`} />
</div>
{showDeactivatePopup && (
<DeactivatePopup closePopUp={closeDeactivatePopup} onClickConfirm={(deactivationResponse) => onClickConfirmDeactivate(deactivationResponse, device)} popupData={{ ...device, isDeactivateDevice: true }} request={deactivateRequest} headerMsg='deactivateDevicePopup.headerMsg' descriptionMsg='deactivateDevicePopup.descriptionForAdmin' />
)}
</div>
)}
{showDeviceDetailApproveRejectPopup && (
<ApproveRejectPopup
popupData={{ ...device, isDeviceRequest: true }}
closePopUp={closeApproveRejectPopup}
approveRejectResponse={(responseData, status) => onClickApproveReject(responseData, status, device)}
title={`${device.make} | ${device.model}`}
header={t('deviceApproveRejectPopup.header')}
description={t('deviceApproveRejectPopup.description')}
/>
)}
{showDeactivatePopup && (
<DeactivatePopup closePopUp={closeDeactivatePopup} onClickConfirm={(deactivationResponse) => onClickConfirmDeactivate(deactivationResponse, device)} popupData={{ ...device, isDeactivateDevice: true }} request={deactivateRequest} headerMsg='deactivateDevicePopup.headerMsg' descriptionMsg='deactivateDevicePopup.descriptionForAdmin' />
)}
</div>
</td>
</tr>
Expand Down
Loading

0 comments on commit 5ed27ed

Please sign in to comment.