Skip to content

Commit

Permalink
feat: refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
syntrydy committed May 25, 2022
1 parent 9f7b083 commit 8949ff5
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 33 deletions.
2 changes: 1 addition & 1 deletion admin-ui/app/routes/Apps/Gluu/GluuInputRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function GluuInputRow({
required,
lsize,
rsize,
doc_category
doc_category,
}) {
return (
<GluuTooltip doc_category={doc_category} doc_entry={name}>
Expand Down
61 changes: 30 additions & 31 deletions admin-ui/plugins/admin/components/UserManagement/UserClaimEntry.js
Original file line number Diff line number Diff line change
@@ -1,48 +1,47 @@
import React from 'react'
import { Col, FormGroup } from '../../../../app/components'
import GluuInputRow from '../../../../app/routes/Apps/Gluu/GluuInputRow'
import GluuSelectRow from '../../../../app/routes/Apps/Gluu/GluuSelectRow'
function UserClaimEntry({ data, isInput, key, formik }) {
function UserClaimEntry({ data, type, key, formik, handler }) {
return (
<div key={key}>
{isInput && (
<Col sm={10}>
<GluuInputRow
label={data.name}
name={data.id}
value={formik.values[data.id] || ''}
formik={formik}
lsize={4}
rsize={8}
/>
</Col>
{type === 'input' && (
<GluuInputRow
label={data.name}
name={data.id}
value={formik.values[data.id] || ''}
formik={formik}
lsize={3}
rsize={9}
/>
)}
{!isInput && (
<Col sm={10}>
<GluuSelectRow
label={data.name}
name={data.id}
value={formik.values[data.id] || ''}
values={data.attributes.values}
formik={formik}
required
lsize={3}
rsize={9}
/>
</Col>
{type === 'select' && (
<GluuSelectRow
label={data.name}
name={data.id}
value={formik.values[data.id] || ''}
values={data.attributes.values}
formik={formik}
required
lsize={3}
rsize={9}
/>
)}

<Col
sm={1}
<div
style={{
float: 'right',
justifyContent: 'center',
alignItems: 'center',
cursor: 'pointer',
padding: '5px',
width: '25px',
height: '25px',
marginTop: '-60px',
marginRight: '-25px',
}}
onClick={() => removeSelectedClaimsFromState(key)}
onClick={handler}
>
<i className={'fa fa-fw fa-close'}></i>
</Col>
</div>
</div>
)
}
Expand Down
4 changes: 3 additions & 1 deletion admin-ui/plugins/admin/components/UserManagement/UserForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ function UserForm({ formik }) {
}

const removeSelectedClaimsFromState = (id) => {
console.log('=================key: ' + id)
let tempList = [...selectedClaims]
let newList = tempList.filter((drink, index) => index !== id)
setSelectedClaims(newList)
Expand Down Expand Up @@ -88,7 +89,8 @@ function UserForm({ formik }) {
key={key}
data={data}
formik={formik}
isInput={true}
handler={removeSelectedClaimsFromState}
type={data.type}
/>
))}
<GluuFooter />
Expand Down

0 comments on commit 8949ff5

Please sign in to comment.