Skip to content

Commit

Permalink
fix(admin-ui): show roles on form
Browse files Browse the repository at this point in the history
  • Loading branch information
mjatin-dev committed Jul 7, 2022
1 parent 44e4a36 commit e9917a2
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
4 changes: 2 additions & 2 deletions admin-ui/app/routes/Apps/Gluu/GluuRemovableTypeAhead.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ function GluuRemovableTypeAhead({
doc_category,
options,
isDirect,
allowNew = true,
}) {
const { t } = useTranslation()
return (
Expand All @@ -30,11 +31,10 @@ function GluuRemovableTypeAhead({
<Col sm={rsize - 1}>
<InputGroup>
<Typeahead
allowNew
allowNew={allowNew}
emptyLabel=""
labelKey={name}
onChange={(selected) => {
console.log('SELECTED', selected)
if (formik) {
formik.setFieldValue(name, selected)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ function UserAddPage() {
let valE = []
if (values[key]) {
for (let i in values[key]) {
valE.push(values[key][i][key])
if (typeof values[key][i] == 'object') {
valE.push(values[key][i][key])
} else {
valE.push(values[key][i])
}
}
}
obj = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,30 @@ import GluuRemovableInputRow from '../../../../app/routes/Apps/Gluu/GluuRemovabl
import GluuRemovableSelectRow from '../../../../app/routes/Apps/Gluu/GluuRemovableSelectRow'
import GluuRemovableTypeAhead from '../../../../app/routes/Apps/Gluu/GluuRemovableTypeAhead'
import { countries } from '../../common/countries'
import { useSelector } from 'react-redux'

function UserClaimEntry({ data, type, entry, formik, handler }) {
const doHandle = () => {
handler(data.name)
}
const roles = useSelector((state) => state.apiRoleReducer.items)
const rolesToBeShown = roles.map((data) => data.role)

return (
<div key={entry}>
{data.oxMultiValuedAttribute && (
<GluuRemovableTypeAhead
label={data.displayName}
name={data.name}
allowNew={data.name != 'jansAdminUIRole'}
value={formik.values[data.name] || []}
formik={formik}
isDirect={true}
options={formik.values[data.name] || []}
options={
data.name == 'jansAdminUIRole'
? rolesToBeShown
: formik.values[data.name] || []
}
handler={doHandle}
doc_category={data.description}
lsize={3}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@ import {
ROLE_WRITE,
} from '../../../../app/utils/PermChecker'
import GluuCommitDialog from '../../../../app/routes/Apps/Gluu/GluuCommitDialog'

import { getRoles } from '../../../admin/redux/actions/ApiRoleActions'
function UserList(props) {
const dispatch = useDispatch()
let opt = {}
useEffect(() => {
opt['limit'] = 0
dispatch(getUsers({}))
dispatch(getAttributes(opt))
dispatch(getRoles())
}, [])

const usersList = useSelector((state) => state.userReducer.items)
Expand Down

0 comments on commit e9917a2

Please sign in to comment.