Skip to content

Commit

Permalink
feat(admin-ui): little refactoring to check empty object #437
Browse files Browse the repository at this point in the history
  • Loading branch information
syntrydy committed Sep 15, 2022
1 parent dd51235 commit 99f006d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
4 changes: 0 additions & 4 deletions admin-ui/app/utils/Util.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,3 @@ export function getNewColor() {
}
return color
}

export function isEmptyObject(obj){
return JSON.stringify(obj) === '{}';
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ 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'
import isEmpty from 'lodash/isEmpty'
const DOC_CATEGORY = 'openid_client'

const EMPTY = ''
Expand Down Expand Up @@ -33,31 +33,31 @@ function ClientSoftwarePanel({ client, scripts, formik, viewOnly }) {
label="fields.clientUri"
name="clientUri"
formik={formik}
value={isEmptyObject(client.clientUri) ? EMPTY : client.clientUri}
value={isEmpty(client.clientUri) ? EMPTY : client.clientUri}
doc_category={DOC_CATEGORY}
disabled={viewOnly}
/>
<GluuInputRow
label="fields.policy_uri"
name="policyUri"
formik={formik}
value={isEmptyObject(client.policyUri) ? EMPTY : client.policyUri}
value={isEmpty(client.policyUri) ? EMPTY : client.policyUri}
doc_category={DOC_CATEGORY}
disabled={viewOnly}
/>
<GluuInputRow
label="fields.logo_uri"
name="logoUri"
formik={formik}
value={isEmptyObject(client.logoUri) ? EMPTY : client.logoUri}
value={isEmpty(client.logoUri) ? EMPTY : client.logoUri}
doc_category={DOC_CATEGORY}
disabled={viewOnly}
/>
<GluuInputRow
label="fields.tosUri"
name="tosUri"
formik={formik}
value={isEmptyObject(client.tosUri) ? EMPTY : client.tosUri}
value={isEmpty(client.tosUri) ? EMPTY : client.tosUri}
doc_category={DOC_CATEGORY}
disabled={viewOnly}
/>
Expand Down

0 comments on commit 99f006d

Please sign in to comment.