Skip to content

Commit

Permalink
MOSIP-33225: Now sub menus are navigating to resp. page. (#454)
Browse files Browse the repository at this point in the history
Signed-off-by: Anil_Kumar_Majji <[email protected]>
  • Loading branch information
Anil-kumar-Majji authored Jun 13, 2024
1 parent 8e1bfca commit 9ccccd6
Show file tree
Hide file tree
Showing 6 changed files with 264 additions and 63 deletions.
66 changes: 49 additions & 17 deletions pmp-reactjs-ui/public/i18n/eng.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
"policyNameDescription": "Policy Name Description",
"comments": "Comments",
"adminComments": "Admin Comments",
"partnerComments" : "Partner's Comments",
"partnerComments": "Partner's Comments",
"back": "Back",
"createdOn": "Created On"
},
Expand All @@ -157,8 +157,8 @@
"errorInFetchingPolicyNames": "There is some error in fetching the policy names. Try again later!",
"errorInMapPolicy": "While requesting a policy, we have encountered with an error",
"policySuccessHeader": "Policy Submitted Successfully!",
"policySuccessMsg":"Policy request process has been successfully submitted. Approval is pending with admin.",
"info":"Only those partner IDs whose partner certificate is uploaded is available in the dropdown. If you don't find your partner ID, please upload partner certificate first",
"policySuccessMsg": "Policy request process has been successfully submitted. Approval is pending with admin.",
"info": "Only those partner IDs whose partner certificate is uploaded is available in the dropdown. If you don't find your partner ID, please upload partner certificate first",
"commentTooLong": "Comments should not allow more than 500 characters.",
"specialCharNotAllowed": "Special characters are not allowed."
},
Expand All @@ -182,14 +182,14 @@
"createOidcClient": {
"createOidcClient": "Create OIDC Client",
"help": "Help",
"selectPartnerId":"Select Partner ID",
"selectPartnerId": "Select Partner ID",
"devicePartner": "Device Partner",
"policyGroupGoesHere": "Policy Group Goes Here",
"policyNameToolTip": "Make sure to request policy for given partner ID in POLICIES screen first. Only those policies in APPROVED status is available in dropdown.",
"policyNamePlaceHolder":"Select policy for which OIDC Client ID is required",
"policyNamePlaceHolder": "Select policy for which OIDC Client ID is required",
"selectPolicyName": "Select Policy Name",
"name": "Name",
"enterNameForOidcClient":"Enter a name for OIDC Client",
"enterNameForOidcClient": "Enter a name for OIDC Client",
"publicKey": "Public Key",
"publicKeyToolTip": "Only JWK format is allowed",
"publicKeyPlaceHolder": "Enter public key in JWK format only",
Expand All @@ -207,17 +207,17 @@
"errorInCreateOIDC": "While requesting OIDC Client, we have encountered with an error",
"invalidJwkFormat": "Invalid JWK format",
"invalidUrl": "Invalid URL format. URL must start with http:// or https://",
"partnerIdTooltip":"Only those Authentication Partner IDs whose partner certificate is uploaded is available in the dropdown. If you don't find your partner ID, please upload partner certificate first"
"partnerIdTooltip": "Only those Authentication Partner IDs whose partner certificate is uploaded is available in the dropdown. If you don't find your partner ID, please upload partner certificate first"
},
"oidcClientsList": {
"partnerId":"Partner ID",
"policyGroup":"Policy Group",
"policyName":"Policy Name",
"partnerId": "Partner ID",
"policyGroup": "Policy Group",
"policyName": "Policy Name",
"oidcClientName": "OIDC Client Name",
"createdDate":"Created Date",
"createdDate": "Created Date",
"status": "Status",
"oidcClientId":"OIDC Client ID",
"action":"Action",
"oidcClientId": "OIDC Client ID",
"action": "Action",
"listOfOidcClientRequests": "List of OIDC Client Requests",
"createOidcClient": "Create OIDC Client",
"filterBtn": "Filter",
Expand All @@ -226,13 +226,45 @@
"deActivate": "Deactivate",
"copy": "Copy",
"copied": "Copied!",
"selectPartnerId":"Select Partner ID",
"selectPartnerId": "Select Partner ID",
"selectOidcClientType": "Select OIDC Client",
"selectPolicyGroup":"Select Policy Group",
"selectPolicyName":"Select Policy Name",
"selectStatus":"Select Status",
"selectPolicyGroup": "Select Policy Group",
"selectPolicyName": "Select Policy Name",
"selectStatus": "Select Status",
"errorInOidcClientsList": "While fetching OIDC Clients List, we have encountered with an error."
},
"viewOidcClientDetails": {
"viewOidcClientDetails": "View OIDC Client Details",
"authenticationServiceSection": "Authentication Services",
"createdOn":"Created On",
"oidcClientId":"OIDC Client ID",
"partnerId":"Partner ID",
"partnerIdAlias": "Partner ID Alias",
"partnerType":"Partner Type",
"policyGroup":"Policy Group",
"policyName":"Policy Name",
"policyGroupDescription":"Policy Group Description",
"policyNameDescription":"Policy Name Description",
"name":"Name",
"publicKey":"Public Key",
"logoUri": "Logo URI",
"redirectUri": "Redirect URI",
"grantTypes":"Grant Types",
"adminComment":"Admin Comments",
"adminName": "Admin Name",
"commentsOfAdmin": "Comments of Admin",
"partnersComment": "Partner's Comment",
"commentOfPartner": ""

},
"editOidcClient": {
"editOidcClient": "Edit OIDC Client",
"authenticationServiceSection": "Authentication Services"
},
"deactivateOidcClient": {
"deactivateOidcClient": "Deactivate OIDC Client",
"authenticationServiceSection": "Authentication Services"
},
"serverError": {
"PMS_COR_001": "Missing Input Parameter",
"PMS_PRT_002": " Policy group does not exist",
Expand Down
16 changes: 16 additions & 0 deletions pmp-reactjs-ui/src/AppRoutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import RequestPolicyConfirmation from './pages/policies/RequestPolicyConfirmatio
import OidcClientsList from './pages/authenticationServices/OidcClientsList.js';
import CreateOidcClient from './pages/authenticationServices/CreateOidcClient.js';
import CreateOidcClientConfirmation from './pages/authenticationServices/CreateOidcClientConfirmation.js';
import ViewOidcClientDetails from './pages/authenticationServices/ViewOidcClientDetails.js';
import EditOidcClient from './pages/authenticationServices/EditOidcClient.js';
import DeactivateOidcClient from './pages/authenticationServices/DeactivateOidcClient.js';

function AppRoutes() {

Expand Down Expand Up @@ -57,7 +60,20 @@ function AppRoutes() {
{
path: 'createOidcClientConfirmation',
element: <GuardedRoute><MainLayout><CreateOidcClientConfirmation/></MainLayout></GuardedRoute>,
},
{
path: 'viewOidcClienDetails',
element: <GuardedRoute><MainLayout><ViewOidcClientDetails/></MainLayout></GuardedRoute>,
},
{
path: 'editOidcClient',
element: <GuardedRoute><MainLayout><EditOidcClient/></MainLayout></GuardedRoute>,
},
{
path: 'deactivateOidcClient',
element: <GuardedRoute><MainLayout><DeactivateOidcClient/></MainLayout></GuardedRoute>,
}

],
},
])
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import React from "react";
import { useState, useEffect } from "react";
import { useNavigate } from "react-router-dom";
import { useTranslation } from "react-i18next";
import { getUserProfile } from "../../services/UserProfileService";
import { isLangRTL } from "../../utils/AppUtils";
import backArrow from "../../svg/back_arrow.svg";
import { formatDate, moveToOidcClientsList } from "../../utils/AppUtils";

function DeactivateOidcClient() {
const { t } = useTranslation();
const isLoginLanguageRTL = isLangRTL(getUserProfile().langCode);
const navigate = useNavigate();
const [oidcClientDetails, setOidcClientDetails] = useState([]);

useEffect(() => {
const clientData = localStorage.getItem('selectedClientData');
if (clientData) {
try {
const selectedClient = JSON.parse(clientData);
setOidcClientDetails(selectedClient);
} catch (error) {
navigate('/partnermanagement/authenticationServices/oidcClientsList');
console.error('Error in viewOidcClientDetails page :', error);
}
} else {
navigate('/partnermanagement/authenticationServices/oidcClientsList');
}
}, [navigate]);

const moveToHome = () => {
navigate("/partnermanagement");
};

return (
<>
<div className={`flex-col w-full p-5 bg-anti-flash-white h-full font-inter mb-[2%] ${isLoginLanguageRTL ? "mr-[8%]" : "ml-[8%]"} overflow-x-scroll`}>
<div className="flex justify-between mb-5">
<div className="flex items-center gap-x-2">
<img
src={backArrow}
alt=""
onClick={() => moveToOidcClientsList(navigate)}
className={`cursor-pointer ${isLoginLanguageRTL ? "rotate-180" : null}`}
/>
<div className="flex-col">
<h1 className="font-bold text-lg text-md text-dark-blue">
{t("deactivateOidcClient.deactivateOidcClient")}
</h1>
<div className="flex space-x-1">
<p
onClick={() => moveToHome()}
className="font-semibold text-tory-blue text-xs cursor-pointer"
>
{t("commons.home")} /
</p>
<p onClick={() => moveToOidcClientsList(navigate)} className="font-semibold text-tory-blue text-xs cursor-pointer">
{t("deactivateOidcClient.authenticationServiceSection")}
</p>
</div>
</div>
</div>
</div>
</div>
</>
)
}

export default DeactivateOidcClient;
69 changes: 69 additions & 0 deletions pmp-reactjs-ui/src/pages/authenticationServices/EditOidcClient.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import React from "react";
import { useState, useEffect } from "react";
import { useNavigate } from "react-router-dom";
import { useTranslation } from "react-i18next";
import { getUserProfile } from "../../services/UserProfileService";
import { isLangRTL } from "../../utils/AppUtils";
import backArrow from "../../svg/back_arrow.svg";
import { formatDate, moveToOidcClientsList } from "../../utils/AppUtils";

function EditOidcClient() {
const { t } = useTranslation();
const isLoginLanguageRTL = isLangRTL(getUserProfile().langCode);
const navigate = useNavigate();
const [oidcClientDetails, setOidcClientDetails] = useState([]);

useEffect(() => {
const clientData = localStorage.getItem('selectedClientData');
if (clientData) {
try {
const selectedClient = JSON.parse(clientData);
setOidcClientDetails(selectedClient);
} catch (error) {
navigate('/partnermanagement/authenticationServices/oidcClientsList');
console.error('Error in viewOidcClientDetails page :', error);
}
} else {
navigate('/partnermanagement/authenticationServices/oidcClientsList');
}
}, [navigate]);

const moveToHome = () => {
navigate("/partnermanagement");
};

return (
<>
<div className={`flex-col w-full p-5 bg-anti-flash-white h-full font-inter mb-[2%] ${isLoginLanguageRTL ? "mr-[8%]" : "ml-[8%]"} overflow-x-scroll`}>
<div className="flex justify-between mb-5">
<div className="flex items-center gap-x-2">
<img
src={backArrow}
alt=""
onClick={() => moveToOidcClientsList(navigate)}
className={`cursor-pointer ${isLoginLanguageRTL ? "rotate-180" : null}`}
/>
<div className="flex-col">
<h1 className="font-bold text-lg text-md text-dark-blue">
{t("editOidcClient.editOidcClient")}
</h1>
<div className="flex space-x-1">
<p
onClick={() => moveToHome()}
className="font-semibold text-tory-blue text-xs cursor-pointer"
>
{t("commons.home")} /
</p>
<p onClick={() => moveToOidcClientsList(navigate)} className="font-semibold text-tory-blue text-xs cursor-pointer">
{t("editOidcClient.authenticationServiceSection")}
</p>
</div>
</div>
</div>
</div>
</div>
</>
)
}

export default EditOidcClient;
Loading

0 comments on commit 9ccccd6

Please sign in to comment.