Skip to content

Commit

Permalink
fix(admin-ui): changed naming conventions
Browse files Browse the repository at this point in the history
  • Loading branch information
mjatin-dev committed Jul 6, 2022
1 parent 44e4a36 commit 66fe216
Show file tree
Hide file tree
Showing 9 changed files with 89 additions and 92 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ import UserForm from './UserForm'
import GluuAlert from '../../../../app/routes/Apps/Gluu/GluuAlert'
import { useTranslation } from 'react-i18next'
import { useFormik } from 'formik'
import {
createNewUser,
redirectToListPage,
} from '../../redux/actions/UserActions'
import { createUser, redirectToListPage } from '../../redux/actions/UserActions'
import { useDispatch, useSelector } from 'react-redux'
import moment from 'moment'
function UserAddPage() {
Expand Down Expand Up @@ -72,7 +69,7 @@ function UserAddPage() {
givenName: values.givenName || '',
customAttributes: customAttributes,
}
dispatch(createNewUser(submitableValues))
dispatch(createUser(submitableValues))
}

useEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import UserForm from './UserForm'
import GluuAlert from '../../../../app/routes/Apps/Gluu/GluuAlert'
import { useTranslation } from 'react-i18next'
import { useFormik } from 'formik'
import { updateExistingUser } from '../../redux/actions/UserActions'
import { updateUser } from '../../redux/actions/UserActions'
import { useDispatch, useSelector } from 'react-redux'
import moment from 'moment'
import { getPersistenceType } from '../../../services/redux/actions/PersistenceActions'
Expand Down Expand Up @@ -101,7 +101,7 @@ function UserEditPage() {
]
}

dispatch(updateExistingUser(submitableValues))
dispatch(updateUser(submitableValues))
}

const initialValues = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import GluuLoader from '../../../../app/routes/Apps/Gluu/GluuLoader'
import GluuCommitDialog from '../../../../app/routes/Apps/Gluu/GluuCommitDialog'
import applicationstyle from '../../../../app/routes/Apps/Gluu/styles/applicationstyle'
import { Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap'
import { updateUserPassword } from '../../redux/actions/UserActions'
import { changeUserPassword } from '../../redux/actions/UserActions'
function UserForm({ formik }) {
const dispatch = useDispatch()
const { t } = useTranslation()
Expand All @@ -31,7 +31,7 @@ function UserForm({ formik }) {
userPassword: formik.values.userPassword,
inum: userDetails.inum,
}
dispatch(updateUserPassword(submitableValue))
dispatch(changeUserPassword(submitableValue))
toggleChangePasswordModal()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
getUsers,
setSelectedUserData,
redirectToListPage,
deleteExistingUser,
deleteUser,
} from '../../redux/actions/UserActions'

import { getAttributes } from '../../../schema/redux/actions/AttributeActions'
Expand Down Expand Up @@ -73,7 +73,7 @@ function UserList(props) {
}, [redirectToUserListPage])

function handleUserDelete(row) {
dispatch(deleteExistingUser(row.inum))
dispatch(deleteUser(row.inum))
}

if (hasPermission(permissions, ROLE_WRITE)) {
Expand Down
48 changes: 24 additions & 24 deletions admin-ui/plugins/user-management/redux/actions/UserActions.js
Original file line number Diff line number Diff line change
@@ -1,64 +1,64 @@
import {
UM_GET_USERS,
UM_UPDATE_USERS_RESPONSE,
UM_UPDATE_LOADING,
UM_CREATE_NEW_USER,
UM_SELECTED_USER_DATA,
UM_UPDATE_EXISTING_USER,
UM_REDIRECT_TO_LIST,
UM_DELETE_EXISTING_USER,
UM_UPDATE_PASSWORD,
GET_USERS,
GET_USERS_RESPONSE,
USERS_LOADING,
CREATE_NEW_USER,
SELECTED_USER_DATA,
UPDATE_USER,
REDIRECT_TO_USERS_LIST,
DELETE_USER,
CHANGE_USERS_PASSWORD,
} from './types'

export const getUsers = (action) => ({
type: UM_GET_USERS,
type: GET_USERS,
payload: { action },
})

export const setSelectedUserData = (action) => ({
type: UM_SELECTED_USER_DATA,
type: SELECTED_USER_DATA,
payload: action,
})

export const updateUserResponse = (action) => ({
type: UM_UPDATE_USERS_RESPONSE,
export const getUserResponse = (action) => ({
type: GET_USERS_RESPONSE,
payload: { action },
})
export const UMupdateUserLoading = (action) => ({
type: UM_UPDATE_LOADING,
export const usersLoading = (action) => ({
type: USERS_LOADING,
payload: action,
})

export const createNewUser = (action) => {
export const createUser = (action) => {
return {
type: UM_CREATE_NEW_USER,
type: CREATE_NEW_USER,
payload: action,
}
}

export const redirectToListPage = (action) => {
return {
type: UM_REDIRECT_TO_LIST,
type: REDIRECT_TO_USERS_LIST,
payload: action,
}
}

export const updateExistingUser = (action) => {
export const updateUser = (action) => {
return {
type: UM_UPDATE_EXISTING_USER,
type: UPDATE_USER,
payload: action,
}
}
export const updateUserPassword = (action) => {
export const changeUserPassword = (action) => {
return {
type: UM_UPDATE_PASSWORD,
type: CHANGE_USERS_PASSWORD,
payload: action,
}
}

export const deleteExistingUser = (inum) => {
export const deleteUser = (inum) => {
return {
type: UM_DELETE_EXISTING_USER,
type: DELETE_USER,
payload: inum,
}
}
18 changes: 9 additions & 9 deletions admin-ui/plugins/user-management/redux/actions/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ export const RESET = 'RESET'

// User Management

export const UM_GET_USERS = 'UM_GET_USERS'
export const UM_UPDATE_USERS_RESPONSE = 'UM_UPDATE_USERS_RESPONSE'
export const UM_UPDATE_LOADING = 'UM_UPDATE_LOADING'
export const UM_CREATE_NEW_USER = 'UM_CREATE_NEW_USER'
export const UM_UPDATE_EXISTING_USER = 'UM_UPDATE_EXISTING_USER'
export const UM_SELECTED_USER_DATA = 'UM_SELECTED_USER_DATA'
export const UM_REDIRECT_TO_LIST = 'UM_REDIRECT_TO_LIST'
export const UM_DELETE_EXISTING_USER = 'UM_DELETE_EXISTING_USER'
export const UM_UPDATE_PASSWORD = 'UM_UPDATE_PASSWORD'
export const GET_USERS = 'GET_USERS'
export const GET_USERS_RESPONSE = 'GET_USERS_RESPONSE'
export const USERS_LOADING = 'USERS_LOADING'
export const CREATE_NEW_USER = 'CREATE_NEW_USER'
export const UPDATE_USER = 'UPDATE_USER'
export const SELECTED_USER_DATA = 'SELECTED_USER_DATA'
export const REDIRECT_TO_USERS_LIST = 'REDIRECT_TO_USERS_LIST'
export const DELETE_USER = 'DELETE_USER'
export const CHANGE_USERS_PASSWORD = 'CHANGE_USERS_PASSWORD'
2 changes: 1 addition & 1 deletion admin-ui/plugins/user-management/redux/api/UserApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default class UserApi {
})
}

updateUserPassword = (data) => {
changeUserPassword = (data) => {
const options = {}
options['userPatchRequest'] = data
return new Promise((resolve, reject) => {
Expand Down
36 changes: 18 additions & 18 deletions admin-ui/plugins/user-management/redux/reducers/UserReducer.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {
UM_UPDATE_USERS_RESPONSE,
UM_UPDATE_LOADING,
UM_GET_USERS,
UM_SELECTED_USER_DATA,
UM_REDIRECT_TO_LIST,
UM_CREATE_NEW_USER,
UM_UPDATE_EXISTING_USER,
UM_DELETE_EXISTING_USER,
UM_UPDATE_PASSWORD,
GET_USERS_RESPONSE,
USERS_LOADING,
GET_USERS,
SELECTED_USER_DATA,
REDIRECT_TO_USERS_LIST,
CREATE_NEW_USER,
UPDATE_USER,
DELETE_USER,
CHANGE_USERS_PASSWORD,
} from '../actions/types'
import reducerRegistry from '../../../../app/redux/reducers/ReducerRegistry'

Expand All @@ -21,47 +21,47 @@ const reducerName = 'userReducer'

export default function userReducer(state = INIT_STATE, action) {
switch (action.type) {
case UM_GET_USERS:
case GET_USERS:
return {
...state,
loading: true,
}
case UM_CREATE_NEW_USER:
case CREATE_NEW_USER:
return {
...state,
loading: true,
}
case UM_UPDATE_PASSWORD:
case CHANGE_USERS_PASSWORD:
return {
...state,
loading: true,
}
case UM_UPDATE_EXISTING_USER:
case UPDATE_USER:
return {
...state,
loading: true,
}
case UM_DELETE_EXISTING_USER:
case DELETE_USER:
return {
...state,
loading: true,
}
case UM_REDIRECT_TO_LIST:
case REDIRECT_TO_USERS_LIST:
return {
...state,
redirectToUserListPage: action.payload,
}
case UM_UPDATE_LOADING:
case USERS_LOADING:
return {
...state,
loading: action.payload,
}
case UM_SELECTED_USER_DATA:
case SELECTED_USER_DATA:
return {
...state,
selectedUserData: action.payload,
}
case UM_UPDATE_USERS_RESPONSE:
case GET_USERS_RESPONSE:
return {
...state,
loading: false,
Expand Down
Loading

0 comments on commit 66fe216

Please sign in to comment.