From ee374050ebf8accbfc4630f7008c7436d7ca0df9 Mon Sep 17 00:00:00 2001 From: Thomas Gasmyr Date: Thu, 15 Sep 2022 10:02:23 +0100 Subject: [PATCH] feat(admin-ui): fix [object object] on client basic and software panel #437 --- admin-ui/app/utils/Util.js | 4 ++++ .../auth-server/components/Clients/ClientBasicPanel.js | 4 ++-- .../components/Clients/ClientSoftwarePanel.js | 10 ++++++---- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/admin-ui/app/utils/Util.js b/admin-ui/app/utils/Util.js index ccc207688..bc8bff735 100644 --- a/admin-ui/app/utils/Util.js +++ b/admin-ui/app/utils/Util.js @@ -14,3 +14,7 @@ export function getNewColor() { } return color } + +export function isEmptyObject(obj){ + return JSON.stringify(obj) === '{}'; +} \ No newline at end of file diff --git a/admin-ui/plugins/auth-server/components/Clients/ClientBasicPanel.js b/admin-ui/plugins/auth-server/components/Clients/ClientBasicPanel.js index b89d5af19..de3f37474 100644 --- a/admin-ui/plugins/auth-server/components/Clients/ClientBasicPanel.js +++ b/admin-ui/plugins/auth-server/components/Clients/ClientBasicPanel.js @@ -70,7 +70,7 @@ const ClientBasicPanel = ({ function handleMouseDownClientSecret(event) { event.preventDefault() } - +console.log("============Client=========== "+ JSON.stringify(client)) return ( {client.inum && ( @@ -93,7 +93,7 @@ const ClientBasicPanel = ({ label="fields.client_name" name="clientName" formik={formik} - value={client.clientName || client.displayName} + value={client.displayName} doc_category={DOC_CATEGORY} disabled={viewOnly} /> diff --git a/admin-ui/plugins/auth-server/components/Clients/ClientSoftwarePanel.js b/admin-ui/plugins/auth-server/components/Clients/ClientSoftwarePanel.js index c71c61327..388b9af5c 100644 --- a/admin-ui/plugins/auth-server/components/Clients/ClientSoftwarePanel.js +++ b/admin-ui/plugins/auth-server/components/Clients/ClientSoftwarePanel.js @@ -3,8 +3,10 @@ import { Col, Container, FormGroup } from 'Components' import GluuInputRow from 'Routes/Apps/Gluu/GluuInputRow' import GluuTypeAheadWithAdd from 'Routes/Apps/Gluu/GluuTypeAheadWithAdd' import { useTranslation } from 'react-i18next' +import { isEmptyObject } from 'Utils/Util' const DOC_CATEGORY = 'openid_client' +const EMPTY = '' function ClientSoftwarePanel({ client, scripts, formik, viewOnly }) { const { t } = useTranslation() @@ -31,7 +33,7 @@ function ClientSoftwarePanel({ client, scripts, formik, viewOnly }) { label="fields.clientUri" name="clientUri" formik={formik} - value={client.clientUri} + value={isEmptyObject(client.clientUri) ? EMPTY : client.clientUri} doc_category={DOC_CATEGORY} disabled={viewOnly} /> @@ -39,7 +41,7 @@ function ClientSoftwarePanel({ client, scripts, formik, viewOnly }) { label="fields.policy_uri" name="policyUri" formik={formik} - value={client.policyUri} + value={isEmptyObject(client.policyUri) ? EMPTY : client.policyUri} doc_category={DOC_CATEGORY} disabled={viewOnly} /> @@ -47,7 +49,7 @@ function ClientSoftwarePanel({ client, scripts, formik, viewOnly }) { label="fields.logo_uri" name="logoUri" formik={formik} - value={client.logoUri} + value={isEmptyObject(client.logoUri) ? EMPTY : client.logoUri} doc_category={DOC_CATEGORY} disabled={viewOnly} /> @@ -55,7 +57,7 @@ function ClientSoftwarePanel({ client, scripts, formik, viewOnly }) { label="fields.tosUri" name="tosUri" formik={formik} - value={client.tosUri} + value={isEmptyObject(client.tosUri) ? EMPTY : client.tosUri} doc_category={DOC_CATEGORY} disabled={viewOnly} />