Skip to content

Commit

Permalink
fix(admin-ui): gentle push
Browse files Browse the repository at this point in the history
  • Loading branch information
mjatin-dev committed Sep 20, 2022
1 parent 7b26106 commit 4820508
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 49 deletions.
80 changes: 40 additions & 40 deletions admin-ui/app/redux/reducers/InitReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,55 +20,55 @@ const reducerName = 'initReducer'

export default function initReducer(state = INIT_STATE, action) {
switch (action.type) {
case GET_SCRIPTS_FOR_STAT:
return handleDefault()

case GET_SCRIPTS_FOR_STAT_RESPONSE:
if (action.payload.data) {
return {
...state,
scripts: action.payload.data,
}
} else {
case GET_SCRIPTS_FOR_STAT:
return handleDefault()
}

case GET_CLIENTS_FOR_STAT:
return handleDefault()
case GET_CLIENTS_FOR_STAT_RESPONSE:
if (action.payload.data) {
return {
...state,
clients: action.payload.data,
case GET_SCRIPTS_FOR_STAT_RESPONSE:
if (action.payload.data) {
return {
...state,
scripts: action.payload.data,
}
} else {
return handleDefault()
}
} else {

case GET_CLIENTS_FOR_STAT:
return handleDefault()
}
case GET_CLIENTS_FOR_STAT_RESPONSE:
if (action.payload.data) {
return {
...state,
clients: action.payload.data,
}
} else {
return handleDefault()
}

case GET_ATTRIBUTES_FOR_STAT:
case GET_ATTRIBUTES_FOR_STAT_RESPONSE:
if (action.payload.data) {
return {
...state,
attributes: action.payload.data,
case GET_ATTRIBUTES_FOR_STAT:
case GET_ATTRIBUTES_FOR_STAT_RESPONSE:
if (action.payload.data) {
return {
...state,
attributes: action.payload.data.entries,
}
} else {
return handleDefault()
}
} else {
return handleDefault()
}

case GET_SCOPES_FOR_STAT:
return handleDefault()
case GET_SCOPES_FOR_STAT_RESPONSE:
if (action.payload.data) {
return {
...state,
scopes: action.payload.data,
case GET_SCOPES_FOR_STAT:
return handleDefault()
case GET_SCOPES_FOR_STAT_RESPONSE:
if (action.payload.data) {
return {
...state,
scopes: action.payload.data,
}
} else {
return handleDefault()
}
} else {
default:
return handleDefault()
}
default:
return handleDefault()
}

function handleDefault() {
Expand Down
2 changes: 1 addition & 1 deletion admin-ui/plugins/admin/redux/api/RoleApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default class RoleApi {
}
getRoles = () => {
return new Promise((resolve, reject) => {
this.api.getAllAdminuiRoles((error, data) => {
this.api.getAdminuiRole('adminUIRoles', (error, data) => {
handleResponse(error, reject, resolve, data)
})
})
Expand Down
18 changes: 11 additions & 7 deletions admin-ui/plugins/auth-server/components/Scopes/ScopeAddPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,25 @@ import ScopeForm from './ScopeForm'
import { addScope } from 'Plugins/auth-server/redux/actions/ScopeActions'
import { buildPayload } from 'Utils/PermChecker'
import GluuLoader from 'Routes/Apps/Gluu/GluuLoader'
import {
getAttributes,
getScripts
} from 'Redux/actions/InitActions'
import { getAttributes, getScripts } from 'Redux/actions/InitActions'
import GluuAlert from 'Routes/Apps/Gluu/GluuAlert'
import { useTranslation } from 'react-i18next'
import applicationStyle from 'Routes/Apps/Gluu/styles/applicationstyle'

function ScopeAddPage({ scripts, dispatch, attributes, loading, saveOperationFlag, errorInSaveOperationFlag }) {
function ScopeAddPage({
scripts,
dispatch,
attributes,
loading,
saveOperationFlag,
errorInSaveOperationFlag,
}) {
const userAction = {}
const navigate =useNavigate()
const navigate = useNavigate()
const { t } = useTranslation()
useEffect(() => {
if (attributes.length === 0) {
buildPayload(userAction, 'Fetch attributes', {})
buildPayload(userAction, 'Fetch attributes', { limit: 100 })
dispatch(getAttributes(userAction))
}
if (scripts.length === 0) {
Expand Down
4 changes: 3 additions & 1 deletion admin-ui/plugins/schema/redux/api/AttributeApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ export default class AttributeApi {
}

editAnAttribute = (data) => {
let options = {}
options['gluuAttribute'] = data
return new Promise((resolve, reject) => {
this.api.putAttributes(data, (error, data) => {
this.api.putAttributes(options, (error, data) => {
handleResponse(error, reject, resolve, data)
})
})
Expand Down

0 comments on commit 4820508

Please sign in to comment.