Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MOSIP-37610: reverted action menu close after popup is opened #1084

Merged
merged 6 commits into from
Jan 10, 2025
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,13 @@ function AdminApiKeysList() {
status: "De-Active"
});
setDeactivateRequest(request);
setActionId(-1);
setShowDeactivatePopup(true);
document.body.style.overflow = "hidden";
}
};

const closeDeactivatePopup = () => {
setActionId(-1);
setShowDeactivatePopup(false);
document.body.style.overflow = "auto";
};
Expand All @@ -183,7 +183,6 @@ function AdminApiKeysList() {
if (deactivationResponse !== "") {
setActionId(-1);
setShowDeactivatePopup(false);
// Update the specific row in the state with the new status
setApiKeysList((prevList) =>
prevList.map(apiKey =>
(apiKey.apiKeyLabel === selectedApiKey.apiKeyLabel && apiKey.policyId === selectedApiKey.policyId && apiKey.partnerId === selectedApiKey.partnerId) ? { ...apiKey, status: "deactivated" } : apiKey
Expand Down Expand Up @@ -309,19 +308,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,7 +197,6 @@ function AdminOidcClientsList() {
});
setDeactivateRequest(request);
setShowDeactivatePopup(true);
setActionId(-1);
document.body.style.overflow = "hidden";
} else {
setErrorMsg(t('deactivateOidc.errorInOidcDetails'));
Expand All @@ -209,7 +208,6 @@ function AdminOidcClientsList() {
if (deactivationResponse && deactivationResponse.status === "INACTIVE") {
setActionId(-1);
setShowDeactivatePopup(false);
// Update the specific row in the state with the new status
setOidcClientsList((prevList) =>
prevList.map(client =>
client.clientId === selectedClient.clientId ? { ...client, status: "INACTIVE" } : client
Expand All @@ -219,6 +217,7 @@ function AdminOidcClientsList() {
};

const closeDeactivatePopup = () => {
setActionId(-1);
setShowDeactivatePopup(false);
document.body.style.overflow = "auto";
};
Expand Down Expand Up @@ -352,11 +351,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,16 +169,15 @@ 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) =>
prevList.map(deviceItem =>
deviceItem.deviceId === selectedDevice.deviceId ? { ...deviceItem, status: getApproveRejectStatus(status), isActive: updateActiveState(status) } : deviceItem
Expand All @@ -189,6 +188,7 @@ function AdminDevicesList({ title, subTitle, isLinkedDevicesList }) {
};

const closeApproveRejectPopup = () => {
setActionId(-1);
setShowDeviceDetailApproveRejectPopup(false);
document.body.style.overflow = "auto";
};
Expand All @@ -199,7 +199,6 @@ 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 @@ -219,6 +218,7 @@ function AdminDevicesList({ title, subTitle, isLinkedDevicesList }) {
};

const closeDeactivatePopup = () => {
setActionId(-1);
setShowDeactivatePopup(false);
document.body.style.overflow = "auto";
};
Expand Down Expand Up @@ -285,10 +285,10 @@ 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}
activeSbi={isLinkedDevicesList ? true : false}
sbiListPath='/partnermanagement/admin/device-provider-services/sbi-list'
activeDevice={isLinkedDevicesList ? false : true}
devicesListPath='/partnermanagement/admin/device-provider-services/devices-list'
Expand Down Expand Up @@ -379,6 +379,16 @@ 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 @@ -389,21 +399,11 @@ 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
Loading