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-38450: Admin API review comments #1083

Merged
merged 2 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pmp-revamp-ui/public/i18n/ara.json
Original file line number Diff line number Diff line change
Expand Up @@ -1116,8 +1116,8 @@
"PMS_CERTIFICATE_ERROR_007": "معرف الشريك المحدد لا ينتمي إلى المستخدم. لذلك غير قادر على الحصول على شهادات الشريك الأصلية",
"PMS_CERTIFICATE_ERROR_008": "حدث خطأ أثناء جلب الشهادة.",
"PMS_CERTIFICATE_ERROR_009": "تعذر تنزيل الشهادة لشريك تم إلغاء تنشيطه",
"PMS_CERTIFICATE_ERROR_010": "خطأ أثناء جلب شهادات CA",
"PMS_CERTIFICATE_ERROR_011": "خطأ أثناء تنزيل شهادة CA",
"PMS_CERTIFICATE_ERROR_010": "خطأ أثناء جلب شهادات الثقة.",
"PMS_CERTIFICATE_ERROR_011": "خطأ أثناء تنزيل شهادة الثقة.",
"PMS_CERTIFICATE_ERROR_012": "معرف الشهادة فارغ أو فارغ",
"PMS_POLICY_ERROR_001": "مجموعة السياسات غير موجودة.",
"PMS_POLICY_ERROR_002": "حدث خطأ أثناء جلب سياسات الشركاء.",
Expand Down
4 changes: 2 additions & 2 deletions pmp-revamp-ui/public/i18n/eng.json
Original file line number Diff line number Diff line change
Expand Up @@ -1111,8 +1111,8 @@
"PMS_CERTIFICATE_ERROR_007": "The given partner ID does not belong to the user.So unable to get the original partner certificates",
"PMS_CERTIFICATE_ERROR_008": "Error while fetching certificate.",
"PMS_CERTIFICATE_ERROR_009": "Unable to download the certificate for a deactivated partner",
"PMS_CERTIFICATE_ERROR_010": "Error while fetching CA certificates.",
"PMS_CERTIFICATE_ERROR_011": "Error while downloading CA certificate.",
"PMS_CERTIFICATE_ERROR_010": "Error while fetching trust certificates.",
"PMS_CERTIFICATE_ERROR_011": "Error while downloading trust certificate.",
"PMS_CERTIFICATE_ERROR_012": "Certificate id is null or empty",
"PMS_POLICY_ERROR_001": "Policy Group does not exists.",
"PMS_POLICY_ERROR_002": "Error while fetching partner policies.",
Expand Down
4 changes: 2 additions & 2 deletions pmp-revamp-ui/public/i18n/fra.json
Original file line number Diff line number Diff line change
Expand Up @@ -1116,8 +1116,8 @@
"PMS_CERTIFICATE_ERROR_007": "L'ID de partenaire donné n'appartient pas à l'utilisateur. Impossible donc d'obtenir les certificats de partenaire d'origine",
"PMS_CERTIFICATE_ERROR_008": "Erreur lors de la récupération du certificat.",
"PMS_CERTIFICATE_ERROR_009": "Impossible de télécharger le certificat pour un partenaire désactivé",
"PMS_CERTIFICATE_ERROR_010": "Erreur lors de la récupération des certificats CA.",
"PMS_CERTIFICATE_ERROR_011": "Erreur lors du téléchargement du certificat CA.",
"PMS_CERTIFICATE_ERROR_010": "Erreur lors de la récupération des certificats de confiance.",
"PMS_CERTIFICATE_ERROR_011": "Erreur lors du téléchargement du certificat de confiance.",
"PMS_CERTIFICATE_ERROR_012": "L'ID du certificat est nul ou vide",
"PMS_POLICY_ERROR_001": "Le groupe de stratégies n existe pas.",
"PMS_POLICY_ERROR_002": "Erreur lors de la récupération des stratégies partenaires.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function CertificatesList({ certificateType, viewCertificateDetails, uploadCerti
if (filterAttributes.issuedTo) queryParams.append('issuedTo', filterAttributes.issuedTo);
if (filterAttributes.issuedBy) queryParams.append('issuedBy', filterAttributes.issuedBy);

const url = `${getPartnerManagerUrl('/partners/root-certificates', process.env.NODE_ENV)}?${queryParams.toString()}`;
const url = `${getPartnerManagerUrl('/trust-chain-certificates', process.env.NODE_ENV)}?${queryParams.toString()}`;
try {
fetchData ? setTableDataLoaded(false) : setDataLoaded(false);
const response = await HttpService.get(url);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ function AdminDevicesList({ title, subTitle, isLinkedDevicesList }) {
if (filterAttributes.sbiId || sbiId) queryParams.append('sbiId', filterAttributes.sbiId || sbiId);
if (filterAttributes.sbiVersion || sbiVersion) queryParams.append('sbiVersion', filterAttributes.sbiVersion || sbiVersion);

const url = `${getPartnerManagerUrl('/devicedetail/search/v2', process.env.NODE_ENV)}?${queryParams.toString()}`;
const url = `${getPartnerManagerUrl('/devicedetail/v2', process.env.NODE_ENV)}?${queryParams.toString()}`;
try {
fetchData ? setTableDataLoaded(false) : setDataLoaded(false);
const response = await HttpService.get(url);
Expand Down
2 changes: 1 addition & 1 deletion pmp-revamp-ui/src/pages/admin/partners/PartnersList.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ function PartnersList() {
else if (filters.status === 'deactivated') queryParams.append('isActive', false);
}

const url = `${getPartnerManagerUrl('/partners/v3', process.env.NODE_ENV)}?${queryParams.toString()}`;
const url = `${getPartnerManagerUrl('/admin-partners', process.env.NODE_ENV)}?${queryParams.toString()}`;
try {
triggerServerMethod ? setTableDataLoaded(false) : setDataLoaded(false);
const response = await HttpService.get(url);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function ViewPartnerDetails() {
const fetchData = async () => {
try {
setDataLoaded(false);
const response = await HttpService.get(getPartnerManagerUrl(`/partners/${selectedPartnerId}/v2`, process.env.NODE_ENV));
const response = await HttpService.get(getPartnerManagerUrl(`/admin-partners/${selectedPartnerId}`, process.env.NODE_ENV));
if (response) {
const responseData = response.data;
if (responseData && responseData.response) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import ErrorMessage from '../../common/ErrorMessage';
import { HttpService } from '../../../services/HttpService';
import FocusTrap from 'focus-trap-react';

function DeactivatePolicyPopup({ header, description, popupData, headerKeyName, closePopUp, onClickConfirm }) {
function DeactivatePolicyPopup({ header, description, popupData, headerKeyName, closePopUp, onClickConfirm, request }) {
const { t } = useTranslation();
const isLoginLanguageRTL = isLangRTL(getUserProfile().langCode);
const [errorCode, setErrorCode] = useState("");
Expand Down Expand Up @@ -49,12 +49,14 @@ function DeactivatePolicyPopup({ header, description, popupData, headerKeyName,
url: getPolicyManagerUrl(`/policies/group/${popupData.id}`, process.env.NODE_ENV),
method: 'patch',
baseURL: process.env.NODE_ENV !== 'production' ? '' : window._env_.REACT_APP_POLICY_MANAGER_API_BASE_URL,
data: request
});
} else if (popupData.isDeactivatePolicy) {
response = await HttpService({
url: getPolicyManagerUrl(`/policies/${popupData.policyId}`, process.env.NODE_ENV),
method: 'patch',
baseURL: process.env.NODE_ENV !== 'production' ? '' : window._env_.REACT_APP_POLICY_MANAGER_API_BASE_URL,
data: request
});
}
const responseData = response.data;
Expand Down
11 changes: 9 additions & 2 deletions pmp-revamp-ui/src/pages/admin/policyManager/PoliciesList.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { getUserProfile } from '../../../services/UserProfileService';
import {
isLangRTL, formatDate, handleMouseClickForDropdown, onPressEnterKey, getPolicyManagerUrl,
handleServiceErrors, resetPageNumber, onClickApplyFilter, setPageNumberAndPageSize, onResetFilter,
getStatusCode, bgOfStatus, escapeKeyHandler
getStatusCode, bgOfStatus, escapeKeyHandler,
createRequest
} from '../../../utils/AppUtils';
import ErrorMessage from '../../common/ErrorMessage';
import LoadingIcon from "../../common/LoadingIcon";
Expand Down Expand Up @@ -56,6 +57,7 @@ function PoliciesList({ policyType, createPolicyButtonName, createPolicy, subTit
const [showDeactivatePopup, setShowDeactivatePopup] = useState(false);
const [deactivatePolicyHeader, setDeactivatePolicyHeader] = useState();
const [deactivatePolicyDescription, setDeactivatePolicyDescription] = useState();
const [deactivateRequest, setDeactivateRequest] = useState({});
const [filterAttributes, setFilterAttributes] = useState({
policyId: null,
policyName: null,
Expand Down Expand Up @@ -100,7 +102,7 @@ function PoliciesList({ policyType, createPolicyButtonName, createPolicy, subTit
if (filterAttributes.policyGroupName) queryParams.append('policyGroupName', filterAttributes.policyGroupName);
if (filterAttributes.status) queryParams.append('status', filterAttributes.status);

const url = `${getPolicyManagerUrl('/policies/search/v2', process.env.NODE_ENV)}?${queryParams.toString()}`;
const url = `${getPolicyManagerUrl('/policies/v2', process.env.NODE_ENV)}?${queryParams.toString()}`;
try {
fetchData ? setTableDataLoaded(false) : setDataLoaded(false);
const response = await HttpService({
Expand Down Expand Up @@ -170,6 +172,10 @@ function PoliciesList({ policyType, createPolicyButtonName, createPolicy, subTit
setActionId(-1);
setDeactivatePolicyDescription('deactivatePolicyPopup.dataSharePolicyDescriptionMsg');
}
const request = createRequest({
status: "De-Activate",
}, "mosip.pms.deactivate.policy.patch", true);
setDeactivateRequest(request);
setShowDeactivatePopup(true);
document.body.style.overflow = "hidden";
}
Expand Down Expand Up @@ -419,6 +425,7 @@ function PoliciesList({ policyType, createPolicyButtonName, createPolicy, subTit
headerKeyName={policy.policyName}
closePopUp={closeDeactivatePopup}
onClickConfirm={(deactivationResponse) => onClickConfirmDeactivate(deactivationResponse, policy)}
request={deactivateRequest}
/>
)}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ function PolicyGroupList() {
status: null,
});
const [showDeactivatePolicyGroupPopup, setShowDeactivatePolicyGroupPopup] = useState(false);
const [deactivateRequest, setDeactivateRequest] = useState({});
const submenuRef = useRef([]);

useEffect(() => {
Expand Down Expand Up @@ -229,6 +230,10 @@ function PolicyGroupList() {
const showDeactivatePolicyGroup = (policyGroup) => {
if (policyGroup.isActive) {
setActionId(-1);
const request = createRequest({
status: "De-Activate",
}, "mosip.pms.deactivate.policy.group.patch", true);
setDeactivateRequest(request);
setShowDeactivatePolicyGroupPopup(true);
document.body.style.overflow = "hidden";
}
Expand Down Expand Up @@ -366,6 +371,7 @@ function PolicyGroupList() {
headerKeyName={policyGroup.name}
closePopUp={closePopup}
onClickConfirm={(deactivationResponse) => onClickConfirmDeactivate(deactivationResponse, policyGroup)}
request={deactivateRequest}
/>
)}
</div>
Expand Down
2 changes: 1 addition & 1 deletion pmp-revamp-ui/src/pages/dashboard/Dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ function Dashboard() {
queryParams.append('status', 'pending_approval')
queryParams.append('pageSize', '1');

const url = `${getPartnerManagerUrl('/devicedetail/search/v2', process.env.NODE_ENV)}?${queryParams.toString()}`;
const url = `${getPartnerManagerUrl('/devicedetail/v2', process.env.NODE_ENV)}?${queryParams.toString()}`;
try {
const response = await HttpService.get(url);
if (response) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function AddSbi() {
const fetchData = async () => {
try {
setDataLoaded(false);
const response = await HttpService.get(getPartnerManagerUrl('/partners/v4?status=approved&partnerType=Device_Provider', process.env.NODE_ENV));
const response = await HttpService.get(getPartnerManagerUrl('/partners/v3?status=approved&partnerType=Device_Provider', process.env.NODE_ENV));
if (response) {
const responseData = response.data;
if (responseData && responseData.response) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ function AddFtm() {
const fetchData = async () => {
try {
setDataLoaded(false);
const response = await HttpService.get(getPartnerManagerUrl('/partners/v4?status=approved&partnerType=FTM_Provider', process.env.NODE_ENV));
const response = await HttpService.get(getPartnerManagerUrl('/partners/v3?status=approved&partnerType=FTM_Provider', process.env.NODE_ENV));
if (response) {
const responseData = response.data;
if (responseData && responseData.response) {
Expand Down
2 changes: 1 addition & 1 deletion pmp-revamp-ui/src/pages/partner/policies/RequestPolicy.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function RequestPolicy() {
const fetchData = async () => {
try {
setDataLoaded(false);
const response = await HttpService.get(getPartnerManagerUrl('/partners/v4?status=approved&policyGroupAvailable=true', process.env.NODE_ENV));
const response = await HttpService.get(getPartnerManagerUrl('/partners/v3?status=approved&policyGroupAvailable=true', process.env.NODE_ENV));
if (response) {
const responseData = response.data;
if (responseData && responseData.response) {
Expand Down
4 changes: 2 additions & 2 deletions pmp-revamp-ui/src/utils/AppUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ export const getPartnerPolicyRequests = async (HttpService, setErrorCode, setErr

export const getApprovedAuthPartners = async (HttpService, setErrorCode, setErrorMsg, t) => {
try {
const response = await HttpService.get(getPartnerManagerUrl(`/partners/v4?status=approved&policyGroupAvailable=true&partnerType=Auth_Partner`, process.env.NODE_ENV));
const response = await HttpService.get(getPartnerManagerUrl(`/partners/v3?status=approved&policyGroupAvailable=true&partnerType=Auth_Partner`, process.env.NODE_ENV));
if (response && response.data) {
const responseData = response.data;
if (responseData.response) {
Expand Down Expand Up @@ -731,7 +731,7 @@ export const fetchDeviceSubTypeDropdownData = async (type, setErrorCode, setErro

export const downloadCaCertificate = async (HttpService, certificateId, certType, setErrorCode, setErrorMsg, errorMsg, setSuccessMsg, t) => {
try {
const response = await HttpService.get(getPartnerManagerUrl(`/partners/download-root-certificate/${certificateId}`, process.env.NODE_ENV));
const response = await HttpService.get(getPartnerManagerUrl(`/trust-chain-certificates/${certificateId}/certificateFile`, process.env.NODE_ENV));
if (response) {
const responseData = response.data;
if (responseData && responseData.response) {
Expand Down
Loading