Skip to content

Commit

Permalink
fix(admin-ui): user and client page
Browse files Browse the repository at this point in the history
  • Loading branch information
mjatin-dev committed Nov 18, 2022
1 parent fbbabd0 commit f387806
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,20 @@ function ClientScriptPanel({ client, scripts, formik, viewOnly }) {
.filter((item) => item.scriptType == 'update_token')
.filter((item) => item.enabled)
.map((item) => ({ dn: item.dn, name: item.name }))
function getMapping(exiting, fullArray) {
if (!exiting) {
exiting = []
}
return fullArray.filter((item) => exiting.includes(item.dn))
}

return (
<Container>
<GluuTypeAheadForDn
name="spontaneousScopeScriptDns"
label="fields.spontaneous_scopes"
formik={formik}
value={client.spontaneousScopeScriptDns}
value={getMapping(client?.spontaneousScopeScriptDns,spontaneousScripts)}
options={spontaneousScripts}
doc_category={DOC_CATEGORY}
disabled={viewOnly}
Expand All @@ -48,7 +54,7 @@ function ClientScriptPanel({ client, scripts, formik, viewOnly }) {
name="updateTokenScriptDns"
label="fields.updateTokenScriptDns"
formik={formik}
value={client.updateTokenScriptDns}
value={getMapping(client?.updateTokenScriptDns, updateTokenScriptDns)}
options={updateTokenScriptDns}
doc_category={DOC_CATEGORY}
disabled={viewOnly}
Expand All @@ -57,7 +63,7 @@ function ClientScriptPanel({ client, scripts, formik, viewOnly }) {
name="postAuthnScripts"
label="fields.post_authn_scripts"
formik={formik}
value={client.postAuthnScripts}
value={getMapping(client?.postAuthnScripts, postScripts)}
options={postScripts}
doc_category={DOC_CATEGORY}
disabled={viewOnly}
Expand All @@ -66,7 +72,7 @@ function ClientScriptPanel({ client, scripts, formik, viewOnly }) {
name="introspectionScripts"
label="fields.introspection_scripts"
formik={formik}
value={client.introspectionScripts}
value={getMapping(client?.introspectionScripts, instrospectionScripts)}
options={instrospectionScripts}
doc_category={DOC_CATEGORY}
disabled={viewOnly}
Expand All @@ -75,7 +81,7 @@ function ClientScriptPanel({ client, scripts, formik, viewOnly }) {
name="ropcScripts"
label="fields.ropcScripts"
formik={formik}
value={client.ropcScripts}
value={getMapping(client?.ropcScripts, ropcScripts)}
options={ropcScripts}
doc_category={DOC_CATEGORY}
disabled={viewOnly}
Expand All @@ -84,7 +90,7 @@ function ClientScriptPanel({ client, scripts, formik, viewOnly }) {
name="consentGatheringScripts"
label="fields.consent_gathering_scripts"
formik={formik}
value={client.consentGatheringScripts}
value={getMapping(client?.consentGatheringScripts, consentScripts)}
options={consentScripts}
doc_category={DOC_CATEGORY}
disabled={viewOnly}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ function UserEditPage() {
userDetails.customAttributes[i].values[0],
).format('YYYY-MM-DD')
} else {
if (customAttribute[0].oxMultiValuedAttribute) {
if (customAttribute[0]?.oxMultiValuedAttribute) {
initialValues[userDetails.customAttributes[i].name] =
userDetails.customAttributes[i].values
} else {
Expand Down

0 comments on commit f387806

Please sign in to comment.