Skip to content

Commit

Permalink
Mosip-33215 : Implemented Sorting, Copy ID pop-up, Pagination & Filte…
Browse files Browse the repository at this point in the history
…rs in OIDC Clients List (#442)

* MOSIP-33725: Implemented Sorting & Pagination in OIDC Clients Listtablular

Signed-off-by: Anil_Kumar_Majji <[email protected]>

* MOSIP-33215: Implemented Copy ID Pop-up

Signed-off-by: Anil_Kumar_Majji <[email protected]>

* MOSIP-33215: Implemented filters in OIDC Clients List

Signed-off-by: Anil_Kumar_Majji <[email protected]>

* MOSIP-33215: Updated text in all the languages

Signed-off-by: Anil_Kumar_Majji <[email protected]>

---------

Signed-off-by: Anil_Kumar_Majji <[email protected]>
  • Loading branch information
Anil-kumar-Majji authored Jun 11, 2024
1 parent d907ff3 commit f38450b
Show file tree
Hide file tree
Showing 8 changed files with 351 additions and 22 deletions.
23 changes: 23 additions & 0 deletions pmp-reactjs-ui/public/i18n/ara.json
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,29 @@
"commentBoxDesc": "اذكر الغرض من طلب عميل OIDC",
"errorInCreateOIDC": "أثناء طلب عميل OIDC، واجهنا خطأ"
},
"oidcClientsList": {
"partnerId":"معرف الشريك",
"policyGroup":"مجموعة السياسات",
"policyName":"اسم السياسة",
"oidcClientName": "اسم عميل OIDC",
"createdDate":"تاريخ الإنشاء",
"status": "حالة",
"oidcClientId":"معرف عميل OIDC",
"action":"فعل",
"listOfOidcClientRequests": "قائمة طلبات عملاء OIDC",
"createOidcClient": "إنشاء عميل OIDC",
"filterBtn": "منقي",
"view": "منظر",
"edit": "يحرر",
"deActivate": "إلغاء التنشيط",
"copy": "ينسخ",
"copied": "نسخ",
"selectPartnerId":"حدد معرف الشريك",
"selectOidcClientType": "حدد عميل OIDC",
"selectPolicyGroup":"حدد مجموعة السياسات",
"selectPolicyName":"حدد اسم السياسة",
"selectStatus":"حدد الحالة"
},
"serverError": {
"PMS_COR_001": "معلمة الإدخال مفقود",
"PMS_PRT_002": " مجموعة السياسة غير موجود",
Expand Down
11 changes: 9 additions & 2 deletions pmp-reactjs-ui/public/i18n/eng.json
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@
"partnerId":"Partner ID",
"policyGroup":"Policy Group",
"policyName":"Policy Name",
"oidcClientname": "OIDC Client Name",
"oidcClientName": "OIDC Client Name",
"createdDate":"Created Date",
"status": "Status",
"oidcClientId":"OIDC Client ID",
Expand All @@ -216,7 +216,14 @@
"filterBtn": "Filter",
"view": "View",
"edit": "Edit",
"deActivate": "Deactivate"
"deActivate": "Deactivate",
"copy": "Copy",
"copied": "Copied!",
"selectPartnerId":"Select Partner ID",
"selectOidcClientType": "Select OIDC Client",
"selectPolicyGroup":"Select Policy Group",
"selectPolicyName":"Select Policy Name",
"selectStatus":"Select Status"
},
"serverError": {
"PMS_COR_001": "Missing Input Parameter",
Expand Down
23 changes: 23 additions & 0 deletions pmp-reactjs-ui/public/i18n/fra.json
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,29 @@
"commentBoxDesc": "Mentionner le but de la demande du client OIDC",
"errorInCreateOIDC": "Lors de la demande du client OIDC, nous avons rencontré une erreur"
},
"oidcClientsList": {
"partnerId":"ID partenaire",
"policyGroup":"Groupe de politiques",
"policyName":"Nom de la politique",
"oidcClientName": "Nom du client OIDC",
"createdDate":"Date de création",
"status": "Statut",
"oidcClientId":"ID client OIDC",
"action":"Action",
"listOfOidcClientRequests": "Liste des demandes des clients OIDC",
"createOidcClient": "Créer un client OIDC",
"filterBtn": "Filtre",
"view": "Voir",
"edit": "Modifier",
"deActivate": "Désactiver",
"copy": "Copie",
"copied": "Copié!",
"selectPartnerId":"Sélectionnez l'ID du partenaire",
"selectOidcClientType": "Sélectionnez le client OIDC",
"selectPolicyGroup":"Sélectionnez un groupe de stratégies",
"selectPolicyName":"Sélectionnez le nom de la stratégie",
"selectStatus":"Sélectionnez le statut"
},
"serverError": {
"PMS_COR_001": "Paramètre d'entrée manquant",
"PMS_PRT_002": "Le groupe de stratégies n'existe pas",
Expand Down
51 changes: 51 additions & 0 deletions pmp-reactjs-ui/src/pages/authenticationServices/CopyIdPopUp.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import React, { useState } from 'react';
import { useTranslation } from 'react-i18next';
import { getUserProfile } from '../../services/UserProfileService';
import { isLangRTL } from '../../utils/AppUtils';
import close_icon from '../../svg/close_icon.svg';

function CopyIdPopUp({ closePopUp, policyName, partnerId }) {
const [copied, setCopied] = useState(false);
const { t } = useTranslation();
const isLoginLanguageRTL = isLangRTL(getUserProfile().langCode);

const copyId = () => {
setCopied(!copied);
};
const dismiss = () => {
policyName='';
partnerId='';
closePopUp(false);
}

return (
<div className="fixed inset-0 flex items-center justify-center bg-black bg-opacity-[16%] z-50 font-inter">
<div className={`bg-white w-[20%] mx-auto rounded-lg shadow-lg h-[35%]`}>
<header className={`flex justify-between p-[5%]`}>
<div className={`flex-col`}>
<h1 className={`font-bold text-md text-[#333333]`}>{policyName}</h1>
<p className={`text-xs font-bold text-[#717171]`}># {partnerId}</p>
</div>
<img src={close_icon} className={`h-7`} onClick={() => dismiss()} />
</header>
<hr className={`py-[4%]`} />
<div className={` flex-col text-center items-center`}>
<h1 className={`text-[#6A6A6A] font-bold opacity-8 mb-[0.5%]`}>{t('oidcClientsList.oidcClientId')}</h1>
<p className={`font-bold text-xs`}>4fcqta1MRkzMnG5nEkbGPlBZmbJFRenR-sPCUWHEdsA</p>
<button type="button" onClick={() => copyId()} className={`flex items-center justify-center gap-x-2 mt-[7%] border-2 py-[3%] w-[40%] rounded-2xl ${copied ? "text-[#FFFFFF] bg-[#1447B2] border-0" : "text-[#1447B2] border-[#1447B2]"} ${isLoginLanguageRTL ? "mr-20" : "ml-20"} cursor-pointer`}>
<svg xmlns="http://www.w3.org/2000/svg"
width="13.808" height="16.481" viewBox="0 0 13.808 16.481">
<path id="content_copy_FILL0_wght300_GRAD0_opsz24"
d="M154.728-846.637a1.555,1.555,0,0,1-1.143-.468,1.555,1.555,0,0,1-.468-1.143V-858.39a1.554,1.554,0,0,1,.468-1.143,1.554,1.554,0,0,1,1.143-.468H162.2a1.554,1.554,0,0,1,1.143.468,1.555,1.555,0,0,1,.468,1.143v10.142a1.555,1.555,0,0,1-.468,1.143,1.555,1.555,0,0,1-1.143.468Zm0-1.336H162.2a.261.261,0,0,0,.188-.086.261.261,0,0,0,.086-.188V-858.39a.261.261,0,0,0-.086-.188.261.261,0,0,0-.188-.086h-7.469a.261.261,0,0,0-.188.086.261.261,0,0,0-.086.188v10.142a.261.261,0,0,0,.086.188A.261.261,0,0,0,154.728-847.974Zm-3.118,4.454a1.555,1.555,0,0,1-1.143-.468A1.555,1.555,0,0,1,150-845.13v-11.478h1.336v11.478a.261.261,0,0,0,.086.188.261.261,0,0,0,.188.086h8.806v1.336Zm2.844-4.454v0Z"
transform="translate(-150 860)" fill={`${copied ? "#FFFFFF" :"#1447b2" }`}/>
</svg>

{!copied ? "Copy" : "Copied!"}
</button>
</div>
</div>
</div>
)
}

export default CopyIdPopUp;
110 changes: 110 additions & 0 deletions pmp-reactjs-ui/src/pages/authenticationServices/OidcClientsFilter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
import { useState, useEffect } from "react";
import DropdownComponent from '../common/fields/DropdownComponent.js';
import { useTranslation } from 'react-i18next';
import { getStatusCode } from "../../utils/AppUtils.js";

function OidcClientsFilter({ filteredOidcClientsList, onFilterChange }) {
const { t } = useTranslation();
const [partnerIdData, setPartnerIdData] = useState([]);
const [oidcClientNameData, setOidcClientNameData] = useState([]);
const [policyGroupData, setpolicyGroupData] = useState([]);
const [policyNameData, setPolicyNameData] = useState([]);
const [statusData, setStatusData] = useState([]);

useEffect(() => {
const getData = (fieldName) => {
let dataArr = [];
dataArr.push({
fieldCode: "",
fieldValue: ""
});
filteredOidcClientsList.forEach(item => {
let alreadyAdded = false;
dataArr.forEach(item1 => {
if (item1.fieldValue === item[fieldName]) {
alreadyAdded = true;
}
});
if (!alreadyAdded) {
if (fieldName === "status") {
dataArr.push({
fieldCode: getStatusCode(item[fieldName], t),
fieldValue: item[fieldName]
});
} else {
dataArr.push({
fieldCode: item[fieldName],
fieldValue: item[fieldName]
});
}
}
});
return dataArr;
}
const fetchData = async () => {
setPartnerIdData(getData('partnerId'));
setOidcClientNameData(getData('oidcClientName'));
setpolicyGroupData(getData('policyGroup'));
setPolicyNameData(getData('policyName'));
setStatusData(getData('status'));
};
fetchData();
}, [filteredOidcClientsList, t]);

const onFilterChangeEvent = (fieldName, selectedFilter) => {
onFilterChange(fieldName, selectedFilter);
}

const styles = {
dropdownButton: "!text-[#343434]"
}

return (
<>
<div className="flex w-full p-2 justify-start bg-gray-50 flex-wrap">
<DropdownComponent
fieldName='partnerId'
dropdownDataList={partnerIdData}
onDropDownChangeEvent={onFilterChangeEvent}
fieldNameKey='oidcClientsList.partnerId'
placeHolderKey='oidcClientsList.selectPartnerId'
styleSet={styles}>
</DropdownComponent>
<DropdownComponent
fieldName='policyGroup'
dropdownDataList={policyGroupData}
onDropDownChangeEvent={onFilterChangeEvent}
fieldNameKey='oidcClientsList.policyGroup'
placeHolderKey='oidcClientsList.selectPolicyGroup'
styleSet={styles}>
</DropdownComponent>
<DropdownComponent
fieldName='oidcClientName'
dropdownDataList={oidcClientNameData}
onDropDownChangeEvent={onFilterChangeEvent}
fieldNameKey='oidcClientsList.oidcClientName'
placeHolderKey='oidcClientsList.selectOidcClientType'
styleSet={styles}>
</DropdownComponent>
<DropdownComponent
fieldName='policyName'
dropdownDataList={policyNameData}
onDropDownChangeEvent={onFilterChangeEvent}
fieldNameKey='oidcClientsList.policyName'
placeHolderKey='oidcClientsList.selectPolicyName'
styleSet={styles}>
</DropdownComponent>
<DropdownComponent
fieldName='status'
dropdownDataList={statusData}
onDropDownChangeEvent={onFilterChangeEvent}
fieldNameKey='oidcClientsList.status'
placeHolderKey='oidcClientsList.selectStatus'
styleSet={styles}>
</DropdownComponent>
</div>
</>
)
}

export default OidcClientsFilter;
Loading

0 comments on commit f38450b

Please sign in to comment.