From 2fdd3fa45d5a5f6f8b43da46413df722208a34d0 Mon Sep 17 00:00:00 2001 From: BaskarMitrah Date: Wed, 9 Oct 2024 12:52:20 +0530 Subject: [PATCH] Fix : Showed card details as dynamically based on Orderby --- .../GetCredential/Card/CardClientDetails.js | 60 ++++++------------- .../GetCredential/CredentialDetailsCard.js | 2 - .../Return/ReturnCredentialDetails.js | 56 +++++++++++------ src/pages/credential/GetCredentialApiKey.js | 10 ++-- 4 files changed, 61 insertions(+), 67 deletions(-) diff --git a/src/@adobe/gatsby-aio-theme/components/GetCredential/Card/CardClientDetails.js b/src/@adobe/gatsby-aio-theme/components/GetCredential/Card/CardClientDetails.js index 46c5158c..208eb98b 100644 --- a/src/@adobe/gatsby-aio-theme/components/GetCredential/Card/CardClientDetails.js +++ b/src/@adobe/gatsby-aio-theme/components/GetCredential/Card/CardClientDetails.js @@ -22,57 +22,33 @@ const CardClientDetails = ({ response, imsOrgID, }) => { - const { selectedOrganization } = useContext(GetCredentialContext); + const componentsMap = { + APIKey: , + ClientId: , + AllowedOrigins: , + ClientSecret: , + OrganizationName: , + Scopes: , + ImsOrgID: + }; + + const splitedOrderBy = clientDetails?.orderBy?.split(',') || []; + const orderedComponents = splitedOrderBy.length > 0 + ? splitedOrderBy.map(component => componentsMap[component]) + : Object.values(componentsMap); + return (
+ `} + >

{clientDetails?.heading}

- - {apiKeyDetails && ( - - )} - {clientIdDetails && ( - - )} - {allowedOrigins && ( - - )} - {clientSecretDetails && ( - - )} - {organizationDetails && ( - - )} - {scopesDetails && } - {imsOrgID && ( - - )} + {orderedComponents}
); }; diff --git a/src/@adobe/gatsby-aio-theme/components/GetCredential/CredentialDetailsCard.js b/src/@adobe/gatsby-aio-theme/components/GetCredential/CredentialDetailsCard.js index 14db12f9..127a9e92 100644 --- a/src/@adobe/gatsby-aio-theme/components/GetCredential/CredentialDetailsCard.js +++ b/src/@adobe/gatsby-aio-theme/components/GetCredential/CredentialDetailsCard.js @@ -144,8 +144,6 @@ export const CredentialDetailsCard = ({ } - - {isCollapse && <>
{ +const ReturnCredentialDetails = ({ + clientDetails, + clientIdDetails, + clientSecretDetails, + organizationDetails, + scopesDetails, + apiKeyDetails, + allowedOriginsDetails, + organizationName, + allowedOrigins, + response, + imsOrgID +}) => { const { selectedOrganization } = useContext(GetCredentialContext); - console.log('clientDetails', clientDetails) - return ( -
+ const componentsMap = { + APIKey: , + AllowedOrigins: , + ImsOrgID: , + OrganizationName: , + ClientId: , + ClientSecret: , + Scopes: + }; -

{clientDetails?.heading}

+ const splitedOrderBy = clientDetails?.orderBy?.split(',') || []; + const orderedComponents = splitedOrderBy.length > 0 + ? splitedOrderBy.map(key => componentsMap[key]) + : Object.values(componentsMap); - {apiKeyDetails && } - {allowedOrigins && } - {clientIdDetails && } - {clientSecretDetails && } - {organizationDetails && } - {scopesDetails && } - {imsOrgID && } + return ( +
+

{clientDetails?.heading}

+ {orderedComponents}
- ) -} + ); +}; export { ReturnCredentialDetails }; diff --git a/src/pages/credential/GetCredentialApiKey.js b/src/pages/credential/GetCredentialApiKey.js index bb607610..48c578a6 100644 --- a/src/pages/credential/GetCredentialApiKey.js +++ b/src/pages/credential/GetCredentialApiKey.js @@ -59,10 +59,10 @@ const GetCredentialApiKey = () => { - - - + + + @@ -80,10 +80,10 @@ const GetCredentialApiKey = () => { - + + -