Skip to content

Commit 4c36576

Browse files
committed
fix(admin-ui): misc changes #663
1 parent 7ab3c3f commit 4c36576

File tree

7 files changed

+37
-13
lines changed

7 files changed

+37
-13
lines changed

admin-ui/plugins/auth-server/components/Clients/ClientBasicPanel.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ const ClientBasicPanel = ({
9393
label="fields.client_name"
9494
name="clientName"
9595
formik={formik}
96-
value={client.displayName}
96+
value={client.clientName}
9797
doc_category={DOC_CATEGORY}
9898
disabled={viewOnly}
9999
/>

admin-ui/plugins/auth-server/components/Clients/ClientEditPage.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ function ClientEditPage({
4747
dispatch(getOidcDiscovery())
4848
}, [])
4949
useEffect(() => {
50-
if (saveOperationFlag && !errorInSaveOperationFlag)
50+
console.log("Save operation flag",saveOperationFlag)
51+
if (saveOperationFlag)
5152
navigate('/auth-server/clients')
5253
}, [saveOperationFlag])
5354

admin-ui/plugins/auth-server/components/Clients/ClientWizardForm.js

+16-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useState, useContext } from 'react'
1+
import React, { useState, useContext, useRef } from 'react'
22
import { Wizard, Card, CardFooter, CardBody, Form, Button } from 'Components'
33
import ClientBasic from './ClientBasicPanel'
44
import ClientAdvanced from './ClientAdvancedPanel'
@@ -14,7 +14,7 @@ import ClientLogoutPanel from './ClientLogoutPanel'
1414
import ClientSoftwarePanel from './ClientSoftwarePanel'
1515
import ClientCibaParUmaPanel from './ClientCibaParUmaPanel'
1616
import ClientEncryptionSigningPanel from './ClientEncryptionSigningPanel'
17-
17+
import {toast} from 'react-toastify'
1818
const sequence = [
1919
'Basic',
2020
'Tokens',
@@ -37,6 +37,7 @@ function ClientWizardForm({
3737
oidcConfiguration,
3838
umaResources,
3939
}) {
40+
const formRef = useRef();
4041
const { t } = useTranslation()
4142
const theme = useContext(ThemeContext)
4243
const selectedTheme = theme.state.theme
@@ -81,7 +82,12 @@ function ClientWizardForm({
8182
setCurrentStep(sequence[sequence.indexOf(currentStep) - 1])
8283
}
8384
function nextStep() {
84-
setCurrentStep(sequence[sequence.indexOf(currentStep) + 1])
85+
if(formRef && formRef.current && formRef.current.values.redirectUris.length > 0){
86+
setCurrentStep(sequence[sequence.indexOf(currentStep) + 1])
87+
}else{
88+
toast.info("Please add atleast 1 redirect URL");
89+
}
90+
8591
}
8692
function isComplete(stepId) {
8793
return sequence.indexOf(stepId) < sequence.indexOf(currentStep)
@@ -210,6 +216,7 @@ function ClientWizardForm({
210216
<React.Fragment>
211217
<Card style={applicationStyle.mainCard}>
212218
<Formik
219+
innerRef={formRef}
213220
initialValues={initialValues}
214221
onSubmit={(values) => {
215222
values['action_message'] = commitMessage
@@ -247,7 +254,12 @@ function ClientWizardForm({
247254
values.jansAuthSignedRespAlg
248255
values[ATTRIBUTE].jansAuthEncRespAlg = values.jansAuthEncRespAlg
249256
values[ATTRIBUTE].jansAuthEncRespEnc = values.jansAuthEncRespEnc
250-
customOnSubmit(JSON.parse(JSON.stringify(values)))
257+
if(values?.redirectUris && values?.redirectUris.length <= 0){
258+
259+
}else{
260+
customOnSubmit(JSON.parse(JSON.stringify(values)))
261+
}
262+
251263
}}
252264
>
253265
{(formik) => (

admin-ui/plugins/auth-server/redux/sagas/OIDCSaga.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ export function* addNewClient({ payload }) {
6969
addAdditionalData(audit, CREATE, OIDC, payload)
7070
const api = yield* newFunction()
7171
const data = yield call(api.addNewOpenIdClient, payload.action.action_data)
72-
yield put(updateToast(true, 'success'))
7372
yield put(addClientResponse(data))
73+
yield put(updateToast(true, 'success'))
7474
yield call(postUserAction, audit)
7575
} catch (e) {
7676
yield put(updateToast(true, 'error'))
@@ -91,8 +91,8 @@ export function* editAClient({ payload }) {
9191
postBody['client'] = payload.action.action_data
9292
const api = yield* newFunction()
9393
const data = yield call(api.editAClient, postBody)
94-
yield put(updateToast(true, 'success'))
9594
yield put(editClientResponse(data))
95+
yield put(updateToast(true, 'success'))
9696
yield call(postUserAction, audit)
9797
} catch (e) {
9898
yield put(updateToast(true, 'error'))

admin-ui/plugins/services/redux/api/LdapApi.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,23 @@ export default class LdapApi {
1616

1717
// update Ldap Config
1818
updateLdapConfig = (input) => {
19+
let options = {
20+
gluuLdapConfiguration:input
21+
}
1922
return new Promise((resolve, reject) => {
20-
this.api.putConfigDatabaseLdap(input, (error, data) => {
23+
this.api.putConfigDatabaseLdap(options, (error, data) => {
2124
handleResponse(error, reject, resolve, data)
2225
})
2326
})
2427
}
2528

2629
// Add Ldap Config
2730
addLdapConfig = (input) => {
31+
let options = {
32+
gluuLdapConfiguration:input.ldap
33+
}
2834
return new Promise((resolve, reject) => {
29-
this.api.postConfigDatabaseLdap(input.ldap, (error, data) => {
35+
this.api.postConfigDatabaseLdap(options, (error, data) => {
3036
handleResponse(error, reject, resolve, data)
3137
})
3238
})

admin-ui/plugins/services/redux/sagas/LdapSaga.js

+7
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
deleteLdapResponse,
1212
testLdapResponse,
1313
} from '../actions/LdapActions'
14+
import {updateToast} from 'Redux/actions/ToastAction'
1415
import { getAPIAccessToken } from 'Redux/actions/AuthActions'
1516
import { LDAP } from '../audit/Resources'
1617
import {
@@ -63,9 +64,11 @@ export function* addLdap({ payload }) {
6364
addAdditionalData(audit, CREATE, LDAP, payload)
6465
const api = yield* newFunction()
6566
const data = yield call(api.addLdapConfig, payload.data.action_data)
67+
yield put(updateToast(true, 'success'))
6668
yield put(addLdapResponse(data))
6769
yield call(postUserAction, audit)
6870
} catch (e) {
71+
yield put(updateToast(true, 'error'))
6972
yield put(addLdapResponse(null))
7073
if (isFourZeroOneError(e)) {
7174
const jwt = yield select((state) => state.authReducer.userinfo_jwt)
@@ -80,9 +83,11 @@ export function* editLdap({ payload }) {
8083
addAdditionalData(audit, UPDATE, LDAP, payload)
8184
const api = yield* newFunction()
8285
const data = yield call(api.updateLdapConfig, payload.data.action_data)
86+
yield put(updateToast(true, 'success'))
8387
yield put(editLdapResponse(data))
8488
yield call(postUserAction, audit)
8589
} catch (e) {
90+
yield put(updateToast(true, 'error'))
8691
console.log(e)
8792
yield put(editLdapResponse(null))
8893
if (isFourZeroOneError(e)) {
@@ -99,9 +104,11 @@ export function* deleteLdap({ payload }) {
99104
addAdditionalData(audit, DELETION, LDAP, payload)
100105
const api = yield* newFunction()
101106
yield call(api.deleteLdapConfig, payload.configId)
107+
yield put(updateToast(true, 'success'))
102108
yield put(deleteLdapResponse(payload.configId))
103109
yield call(postUserAction, audit)
104110
} catch (e) {
111+
yield put(updateToast(true, 'error'))
105112
yield put(deleteLdapResponse(null))
106113
if (isFourZeroOneError(e)) {
107114
const jwt = yield select((state) => state.authReducer.userinfo_jwt)

admin-ui/plugins/user-management/components/UserManagement/UserList.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -191,14 +191,12 @@ function UserList(props) {
191191
dispatch(getAttributesRoot({pattern:usedAttributes.toString(), limit:100}))
192192
}
193193
},[usersList])
194-
console.log("USER READ",USER_READ)
195-
console.log("USER PERM",permissions)
196194
return (
197195
<GluuLoader blocking={loading}>
198196
<Card style={applicationStyle.mainCard}>
199197
<CardBody>
200198
<GluuViewWrapper canShow={hasPermission(permissions, USER_READ)}>
201-
{usersList.length > 0 && (
199+
{usersList?.length > 0 && (
202200
<MaterialTable
203201
key={limit}
204202
components={{

0 commit comments

Comments
 (0)