Skip to content

Commit

Permalink
fix(admin-ui): misc changes #663
Browse files Browse the repository at this point in the history
  • Loading branch information
mjatin-dev committed Dec 20, 2022
1 parent 7ab3c3f commit 4c36576
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ const ClientBasicPanel = ({
label="fields.client_name"
name="clientName"
formik={formik}
value={client.displayName}
value={client.clientName}
doc_category={DOC_CATEGORY}
disabled={viewOnly}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ function ClientEditPage({
dispatch(getOidcDiscovery())
}, [])
useEffect(() => {
if (saveOperationFlag && !errorInSaveOperationFlag)
console.log("Save operation flag",saveOperationFlag)
if (saveOperationFlag)
navigate('/auth-server/clients')
}, [saveOperationFlag])

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useContext } from 'react'
import React, { useState, useContext, useRef } from 'react'
import { Wizard, Card, CardFooter, CardBody, Form, Button } from 'Components'
import ClientBasic from './ClientBasicPanel'
import ClientAdvanced from './ClientAdvancedPanel'
Expand All @@ -14,7 +14,7 @@ import ClientLogoutPanel from './ClientLogoutPanel'
import ClientSoftwarePanel from './ClientSoftwarePanel'
import ClientCibaParUmaPanel from './ClientCibaParUmaPanel'
import ClientEncryptionSigningPanel from './ClientEncryptionSigningPanel'

import {toast} from 'react-toastify'
const sequence = [
'Basic',
'Tokens',
Expand All @@ -37,6 +37,7 @@ function ClientWizardForm({
oidcConfiguration,
umaResources,
}) {
const formRef = useRef();
const { t } = useTranslation()
const theme = useContext(ThemeContext)
const selectedTheme = theme.state.theme
Expand Down Expand Up @@ -81,7 +82,12 @@ function ClientWizardForm({
setCurrentStep(sequence[sequence.indexOf(currentStep) - 1])
}
function nextStep() {
setCurrentStep(sequence[sequence.indexOf(currentStep) + 1])
if(formRef && formRef.current && formRef.current.values.redirectUris.length > 0){
setCurrentStep(sequence[sequence.indexOf(currentStep) + 1])
}else{
toast.info("Please add atleast 1 redirect URL");
}

}
function isComplete(stepId) {
return sequence.indexOf(stepId) < sequence.indexOf(currentStep)
Expand Down Expand Up @@ -210,6 +216,7 @@ function ClientWizardForm({
<React.Fragment>
<Card style={applicationStyle.mainCard}>
<Formik
innerRef={formRef}
initialValues={initialValues}
onSubmit={(values) => {
values['action_message'] = commitMessage
Expand Down Expand Up @@ -247,7 +254,12 @@ function ClientWizardForm({
values.jansAuthSignedRespAlg
values[ATTRIBUTE].jansAuthEncRespAlg = values.jansAuthEncRespAlg
values[ATTRIBUTE].jansAuthEncRespEnc = values.jansAuthEncRespEnc
customOnSubmit(JSON.parse(JSON.stringify(values)))
if(values?.redirectUris && values?.redirectUris.length <= 0){

}else{
customOnSubmit(JSON.parse(JSON.stringify(values)))
}

}}
>
{(formik) => (
Expand Down
4 changes: 2 additions & 2 deletions admin-ui/plugins/auth-server/redux/sagas/OIDCSaga.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ export function* addNewClient({ payload }) {
addAdditionalData(audit, CREATE, OIDC, payload)
const api = yield* newFunction()
const data = yield call(api.addNewOpenIdClient, payload.action.action_data)
yield put(updateToast(true, 'success'))
yield put(addClientResponse(data))
yield put(updateToast(true, 'success'))
yield call(postUserAction, audit)
} catch (e) {
yield put(updateToast(true, 'error'))
Expand All @@ -91,8 +91,8 @@ export function* editAClient({ payload }) {
postBody['client'] = payload.action.action_data
const api = yield* newFunction()
const data = yield call(api.editAClient, postBody)
yield put(updateToast(true, 'success'))
yield put(editClientResponse(data))
yield put(updateToast(true, 'success'))
yield call(postUserAction, audit)
} catch (e) {
yield put(updateToast(true, 'error'))
Expand Down
10 changes: 8 additions & 2 deletions admin-ui/plugins/services/redux/api/LdapApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,23 @@ export default class LdapApi {

// update Ldap Config
updateLdapConfig = (input) => {
let options = {
gluuLdapConfiguration:input
}
return new Promise((resolve, reject) => {
this.api.putConfigDatabaseLdap(input, (error, data) => {
this.api.putConfigDatabaseLdap(options, (error, data) => {
handleResponse(error, reject, resolve, data)
})
})
}

// Add Ldap Config
addLdapConfig = (input) => {
let options = {
gluuLdapConfiguration:input.ldap
}
return new Promise((resolve, reject) => {
this.api.postConfigDatabaseLdap(input.ldap, (error, data) => {
this.api.postConfigDatabaseLdap(options, (error, data) => {
handleResponse(error, reject, resolve, data)
})
})
Expand Down
7 changes: 7 additions & 0 deletions admin-ui/plugins/services/redux/sagas/LdapSaga.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
deleteLdapResponse,
testLdapResponse,
} from '../actions/LdapActions'
import {updateToast} from 'Redux/actions/ToastAction'
import { getAPIAccessToken } from 'Redux/actions/AuthActions'
import { LDAP } from '../audit/Resources'
import {
Expand Down Expand Up @@ -63,9 +64,11 @@ export function* addLdap({ payload }) {
addAdditionalData(audit, CREATE, LDAP, payload)
const api = yield* newFunction()
const data = yield call(api.addLdapConfig, payload.data.action_data)
yield put(updateToast(true, 'success'))
yield put(addLdapResponse(data))
yield call(postUserAction, audit)
} catch (e) {
yield put(updateToast(true, 'error'))
yield put(addLdapResponse(null))
if (isFourZeroOneError(e)) {
const jwt = yield select((state) => state.authReducer.userinfo_jwt)
Expand All @@ -80,9 +83,11 @@ export function* editLdap({ payload }) {
addAdditionalData(audit, UPDATE, LDAP, payload)
const api = yield* newFunction()
const data = yield call(api.updateLdapConfig, payload.data.action_data)
yield put(updateToast(true, 'success'))
yield put(editLdapResponse(data))
yield call(postUserAction, audit)
} catch (e) {
yield put(updateToast(true, 'error'))
console.log(e)
yield put(editLdapResponse(null))
if (isFourZeroOneError(e)) {
Expand All @@ -99,9 +104,11 @@ export function* deleteLdap({ payload }) {
addAdditionalData(audit, DELETION, LDAP, payload)
const api = yield* newFunction()
yield call(api.deleteLdapConfig, payload.configId)
yield put(updateToast(true, 'success'))
yield put(deleteLdapResponse(payload.configId))
yield call(postUserAction, audit)
} catch (e) {
yield put(updateToast(true, 'error'))
yield put(deleteLdapResponse(null))
if (isFourZeroOneError(e)) {
const jwt = yield select((state) => state.authReducer.userinfo_jwt)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,12 @@ function UserList(props) {
dispatch(getAttributesRoot({pattern:usedAttributes.toString(), limit:100}))
}
},[usersList])
console.log("USER READ",USER_READ)
console.log("USER PERM",permissions)
return (
<GluuLoader blocking={loading}>
<Card style={applicationStyle.mainCard}>
<CardBody>
<GluuViewWrapper canShow={hasPermission(permissions, USER_READ)}>
{usersList.length > 0 && (
{usersList?.length > 0 && (
<MaterialTable
key={limit}
components={{
Expand Down

0 comments on commit 4c36576

Please sign in to comment.