@@ -9,49 +9,75 @@ import { ReturnScopes } from './ReturnScopes';
99import GetCredentialContext from '../GetCredentialContext' ;
1010import { CardImsOrgID } from '../Card/CardImsOrgID' ;
1111
12- const ReturnCredentialDetails = ( {
13- clientDetails,
14- clientIdDetails,
15- clientSecretDetails,
16- organizationDetails,
17- scopesDetails,
18- apiKeyDetails,
19- allowedOriginsDetails,
20- organizationName,
21- allowedOrigins,
22- response,
23- imsOrgID
24- } ) => {
12+ const ReturnCredentialDetails = ( { clientDetails, clientIdDetails, clientSecretDetails, organizationDetails, scopesDetails, apiKeyDetails, allowedOriginsDetails, organizationName, allowedOrigins, response, imsOrgID } ) => {
2513
2614 const { selectedOrganization } = useContext ( GetCredentialContext ) ;
15+ console . log ( 'clientDetails' , clientDetails ?. orderBy )
16+
17+ const splitedOrderBy = clientDetails ?. orderBy ? clientDetails ?. orderBy ?. split ( ',' ) : [ ] ;
18+ console . log ( 'splitedOrderBy' , splitedOrderBy )
2719
2820 const componentsMap = {
29- APIKey : < ReturnAPIKey returnCredentialDetails = { clientDetails } returnAPIKey = { apiKeyDetails } apiKey = { response ?. workspaces [ 0 ] ?. credentials [ 0 ] ?. clientId } /> ,
30- AllowedOrigins : < ReturnAllowedOrigins returnCredentialDetails = { clientDetails } allowedOrigins = { allowedOriginsDetails } returnAllowedOrigins = { allowedOrigins } /> ,
31- ImsOrgID : < CardImsOrgID returnCredentialDetails = { clientDetails } cardImsOrgID = { imsOrgID } imsOrgId = { selectedOrganization ?. code } /> ,
32- OrganizationName : < ReturnOrganizationName returnCredentialDetails = { clientDetails } returnOrganizationName = { organizationDetails } organization = { organizationName ?. name } /> ,
33- ClientId : < ReturnClientId returnCredentialDetails = { clientDetails } returnClientId = { clientIdDetails } clientId = { response ?. workspaces [ 0 ] ?. credentials [ 0 ] ?. clientId } /> ,
34- ClientSecret : < ReturnClientSecret returnCredentialDetails = { clientDetails } returnClientSecret = { clientSecretDetails } response = { response } /> ,
35- Scopes : < ReturnScopes returnCredentialDetails = { clientDetails } returnScopes = { scopesDetails } />
21+ APIKey : apiKeyDetails && < ReturnAPIKey returnCredentialDetails = { clientDetails } returnAPIKey = { apiKeyDetails } apiKey = { response ?. workspaces [ 0 ] ?. credentials [ 0 ] ?. clientId } /> ,
22+ AllowedOrigins : allowedOrigins && < ReturnAllowedOrigins returnCredentialDetails = { clientDetails } allowedOrigins = { allowedOriginsDetails } returnAllowedOrigins = { allowedOrigins } /> ,
23+ ImsOrgID : imsOrgID && < CardImsOrgID returnCredentialDetails = { clientDetails } cardImsOrgID = { imsOrgID } imsOrgId = { selectedOrganization ?. code } /> ,
24+ OrganizationName : organizationDetails && < ReturnOrganizationName returnCredentialDetails = { clientDetails } returnOrganizationName = { organizationDetails } organization = { organizationName ?. name } /> ,
25+ ClientId : clientIdDetails && < ReturnClientId returnCredentialDetails = { clientDetails } returnClientId = { clientIdDetails } clientId = { response ?. workspaces [ 0 ] ?. credentials [ 0 ] ?. clientId } /> ,
26+ ClientSecret : clientSecretDetails && < ReturnClientSecret returnCredentialDetails = { clientDetails } returnClientSecret = { clientSecretDetails } response = { response } /> ,
27+ Scopes : scopesDetails && < ReturnScopes returnCredentialDetails = { clientDetails } returnScopes = { scopesDetails } />
3628 } ;
3729
38- const splitedOrderBy = clientDetails ?. orderBy ?. split ( ',' ) || [ ] ;
39- const orderedComponents = splitedOrderBy . length > 0
40- ? splitedOrderBy ?. map ( key => componentsMap [ key ] )
41- : Object . values ( componentsMap ) ?. map ( key => componentsMap [ key ] ) ;
42-
43- return (
44- < div
45- css = { css `
46- display : flex;
47- flex-direction : column;
30+ console . log ( ' Object.values(componentsMap) ' , Object . values ( componentsMap ) )
31+
32+ return (
33+ < div css = { css `
34+ display : flex;
35+ flex-direction : column;
4836 gap : 32px ;
49- ` }
50- >
51- < h4 className = "spectrum-Heading spectrum-Heading--sizeS" > { clientDetails ?. heading } </ h4 >
52- { orderedComponents }
53- </ div >
54- ) ;
55- } ;
37+ ` } >
38+
39+ < h4 className = "spectrum-Heading spectrum-Heading--sizeS" > { clientDetails ?. heading } </ h4 >
40+ {
41+ splitedOrderBy ?. length > 0 ?
42+ < >
43+ { splitedOrderBy ?. map ( ( list ) => {
44+ if ( list === "APIKey" ) {
45+ return apiKeyDetails && < ReturnAPIKey returnCredentialDetails = { clientDetails } returnAPIKey = { apiKeyDetails } apiKey = { response ?. workspaces [ 0 ] ?. credentials [ 0 ] ?. clientId } />
46+ }
47+ if ( list === "AllowedOrigins" ) {
48+ return allowedOrigins && < ReturnAllowedOrigins returnCredentialDetails = { clientDetails } allowedOrigins = { allowedOriginsDetails } returnAllowedOrigins = { allowedOrigins } />
49+ }
50+ if ( list === "ImsOrgID" ) {
51+ return imsOrgID && < CardImsOrgID returnCredentialDetails = { clientDetails } cardImsOrgID = { imsOrgID } imsOrgId = { selectedOrganization ?. code } />
52+ }
53+ if ( list === "OrganizationName" ) {
54+ return organizationDetails && < ReturnOrganizationName returnCredentialDetails = { clientDetails } returnOrganizationName = { organizationDetails } organization = { organizationName ?. name } />
55+ }
56+ if ( list === "ClientId" ) {
57+ return clientIdDetails && < ReturnClientId returnCredentialDetails = { clientDetails } returnClientId = { clientIdDetails } clientId = { response ?. workspaces [ 0 ] ?. credentials [ 0 ] ?. clientId } />
58+ }
59+ if ( list === "ClientSecret" ) {
60+ return clientSecretDetails && < ReturnClientSecret returnCredentialDetails = { clientDetails } returnClientSecret = { clientSecretDetails } response = { response } />
61+ }
62+ if ( list === "Scopes" ) {
63+ return scopesDetails && < ReturnScopes returnCredentialDetails = { clientDetails } returnScopes = { scopesDetails } />
64+ }
65+ } ) }
66+ </ > :
67+ < >
68+ { apiKeyDetails && < ReturnAPIKey returnCredentialDetails = { clientDetails } returnAPIKey = { apiKeyDetails } apiKey = { response ?. workspaces [ 0 ] ?. credentials [ 0 ] ?. clientId } /> }
69+ { allowedOrigins && < ReturnAllowedOrigins returnCredentialDetails = { clientDetails } allowedOrigins = { allowedOriginsDetails } returnAllowedOrigins = { allowedOrigins } /> }
70+ { clientIdDetails && < ReturnClientId returnCredentialDetails = { clientDetails } returnClientId = { clientIdDetails } clientId = { response ?. workspaces [ 0 ] ?. credentials [ 0 ] ?. clientId } /> }
71+ { clientSecretDetails && < ReturnClientSecret returnCredentialDetails = { clientDetails } returnClientSecret = { clientSecretDetails } response = { response } /> }
72+ { organizationDetails && < ReturnOrganizationName returnCredentialDetails = { clientDetails } returnOrganizationName = { organizationDetails } organization = { organizationName ?. name } /> }
73+ { scopesDetails && < ReturnScopes returnCredentialDetails = { clientDetails } returnScopes = { scopesDetails } /> }
74+ { imsOrgID && < CardImsOrgID returnCredentialDetails = { clientDetails } cardImsOrgID = { imsOrgID } imsOrgId = { selectedOrganization ?. code } /> }
75+
76+ </ >
77+ }
78+
79+ </ div >
80+ )
81+ }
5682
5783export { ReturnCredentialDetails } ;
0 commit comments