Skip to content

Commit

Permalink
fix(admin-ui): resolve all bugs displayed for admin-ui bug #308
Browse files Browse the repository at this point in the history
  • Loading branch information
syntrydy committed Nov 26, 2021
1 parent b4d6521 commit ec60500
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 117 deletions.
34 changes: 13 additions & 21 deletions app/redux/reducers/AuthReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,18 @@ const reducerName = 'authReducer'
export default function authReducer(state = INIT_STATE, action) {
switch (action.type) {
case GET_USER_LOCATION:
return {
...state,
}
return handleDefault()
case GET_USER_LOCATION_RESPONSE:
if (action.payload.location) {
return {
...state,
location: action.payload.location,
}
} else {
return {
...state,
}
return handleDefault()
}
case GET_OAUTH2_CONFIG:
return {
...state,
}
return handleDefault()
case GET_OAUTH2_CONFIG_RESPONSE:
if (action.payload.config && action.payload.config != -1) {
return {
Expand All @@ -59,9 +53,7 @@ export default function authReducer(state = INIT_STATE, action) {
}

case USERINFO_REQUEST:
return {
...state,
}
return handleDefault()
case USERINFO_RESPONSE:
if (action.payload.uclaims) {
return {
Expand All @@ -79,9 +71,7 @@ export default function authReducer(state = INIT_STATE, action) {
}

case GET_API_ACCESS_TOKEN:
return {
...state,
}
return handleDefault()

case GET_API_ACCESS_TOKEN_RESPONSE:
if (action.payload.accessToken) {
Expand All @@ -93,15 +83,17 @@ export default function authReducer(state = INIT_STATE, action) {
isAuthenticated: true,
}
} else {
return {
...state,
}
return handleDefault()
}

default:
return {
...state,
}
return handleDefault()
}

function handleDefault() {
return {
...state,
}
}
}
reducerRegistry.register(reducerName, authReducer)
37 changes: 19 additions & 18 deletions app/redux/reducers/FidoReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ const reducerName = 'fidoReducer'
export default function fidoReducer(state = INIT_STATE, action) {
switch (action.type) {
case GET_FIDO:
return {
...state,
loading: true,
}
return handleLoading()
case GET_FIDO_RESPONSE:
if (action.payload.data) {
return {
Expand All @@ -28,15 +25,10 @@ export default function fidoReducer(state = INIT_STATE, action) {
loading: false,
}
} else {
return {
...state,
}
return handleDefault()
}
case PUT_FIDO:
return {
...state,
loading: true,
}
return handleLoading()
case PUT_FIDO_RESPONSE:
if (action.payload.data) {
return {
Expand All @@ -45,9 +37,7 @@ export default function fidoReducer(state = INIT_STATE, action) {
loading: false,
}
} else {
return {
...state,
}
return handleDefault()
}

case RESET:
Expand All @@ -57,10 +47,21 @@ export default function fidoReducer(state = INIT_STATE, action) {
loading: INIT_STATE.loading,
}
default:
return {
...state,
loading: false,
}
return handleDefault()
}

function handleLoading() {
return {
...state,
loading: true,
}
}

function handleDefault() {
return {
...state,
loading: false,
}
}
}

Expand Down
38 changes: 14 additions & 24 deletions app/redux/reducers/InitReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ const reducerName = 'initReducer'
export default function initReducer(state = INIT_STATE, action) {
switch (action.type) {
case GET_SCRIPTS_FOR_STAT:
return {
...state,
}
return handleDefault()

case GET_SCRIPTS_FOR_STAT_RESPONSE:
if (action.payload.data) {
Expand All @@ -32,25 +30,19 @@ export default function initReducer(state = INIT_STATE, action) {
scripts: action.payload.data,
}
} else {
return {
...state,
}
return handleDefault()
}

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

case GET_ATTRIBUTES_FOR_STAT:
Expand All @@ -61,30 +53,28 @@ export default function initReducer(state = INIT_STATE, action) {
attributes: action.payload.data,
}
} else {
return {
...state,
}
return handleDefault()
}

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

function handleDefault() {
return {
...state,
}
}
}
reducerRegistry.register(reducerName, initReducer)
43 changes: 21 additions & 22 deletions app/redux/reducers/JsonConfigReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,47 +15,46 @@ const reducerName = 'jsonConfigReducer'
export default function jsonConfigReducer(state = INIT_STATE, action) {
switch (action.type) {
case GET_JSON_CONFIG:
return {
...state,
loading: true,
}
return handleLoading()
case GET_JSONCONFIG_RESPONSE:
if (action.payload.data) {
return {
...state,
configuration: action.payload.data,
loading: false,
}
}
else {
return {
...state,
}
} else {
return handleDefault()
}

case PATCH_JSON_CONFIG:
return {
...state,
loading: true,
}
return handleLoading()
case PATCH_JSONCONFIG_RESPONSE:
if (action.payload.data) {
return {
...state,
configuration: action.payload.data,
loading: false,
}
}
else {
return {
...state,
}
} else {
return handleDefault()
}
default:
return {
...state,
loading: false,
}
return handleDefault()
}

function handleLoading() {
return {
...state,
loading: true,
}
}

function handleDefault() {
return {
...state,
loading: false,
}
}
}
reducerRegistry.register(reducerName, jsonConfigReducer)
1 change: 0 additions & 1 deletion app/routes/Apps/Gluu/GluuNameValuesProperty.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ function GluuNameValuesProperty({
return
}
for (var i = 0; i < value.length; i++) {
var elm = value[i]
var valueList = []
var opts = []
valueList = value[i].domains
Expand Down
9 changes: 1 addition & 8 deletions plugins/admin/components/Configuration/LicenseDetailsPage.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useState } from 'react'
import React, { useEffect} from 'react'
import { connect } from 'react-redux'
import LicenseDetailsForm from './LicenseDetailsForm'
import GluuLabel from '../../../../app/routes/Apps/Gluu/GluuLabel'
Expand All @@ -13,15 +13,9 @@ import GluuLoader from '../../../../app/routes/Apps/Gluu/GluuLoader'
import Alert from '@material-ui/lab/Alert'

function LicenseDetailsPage({ item, loading, dispatch }) {
const [validityPeriod, setValidityPeriod] = useState(
!!item.validityPeriod ? new Date(item.validityPeriod) : new Date(),
)
useEffect(() => {
dispatch(getLicenseDetails())
}, [])
useEffect(() => {
setValidityPeriod(new Date(item.validityPeriod))
}, [item.validityPeriod])

function handleSubmit(data) {
if (data) {
Expand All @@ -31,7 +25,6 @@ function LicenseDetailsPage({ item, loading, dispatch }) {

return (
<React.Fragment>
{/* <Container> */}
<GluuLabel label="fields.licenseDetails" size={8} />
<GluuLoader blocking={loading}>
{item.licenseEnable ? (
Expand Down
2 changes: 0 additions & 2 deletions plugins/auth-server/components/Configuration/ConfigPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import GluuCommitDialog from '../../../../app/routes/Apps/Gluu/GluuCommitDialog'
import useExitPrompt from '../../../../app/routes/Apps/Gluu/useExitPrompt'
import PropertyBuilder from './JsonPropertyBuilder'
import { connect } from 'react-redux'
import { useTranslation } from 'react-i18next'
import { buildPayload } from '../../../../app/utils/PermChecker'
import {
getJsonConfig,
Expand All @@ -15,7 +14,6 @@ import {
import { FETCHING_JSON_PROPERTIES } from '../../common/Constants'

function ConfigPage({ configuration, loading, dispatch }) {
const { t } = useTranslation()
const lSize = 6
const userAction = {}
const [modal, setModal] = useState(false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ function JsonPropertyBuilder({
handler(patch)
setShow(false)
}
const addHandler = () => {}

function isStringArray(item) {
return (
Expand Down
Loading

0 comments on commit ec60500

Please sign in to comment.