Skip to content

Commit ec60500

Browse files
committed
fix(admin-ui): resolve all bugs displayed for admin-ui bug #308
1 parent b4d6521 commit ec60500

File tree

9 files changed

+69
-117
lines changed

9 files changed

+69
-117
lines changed

app/redux/reducers/AuthReducer.js

+13-21
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,18 @@ const reducerName = 'authReducer'
2626
export default function authReducer(state = INIT_STATE, action) {
2727
switch (action.type) {
2828
case GET_USER_LOCATION:
29-
return {
30-
...state,
31-
}
29+
return handleDefault()
3230
case GET_USER_LOCATION_RESPONSE:
3331
if (action.payload.location) {
3432
return {
3533
...state,
3634
location: action.payload.location,
3735
}
3836
} else {
39-
return {
40-
...state,
41-
}
37+
return handleDefault()
4238
}
4339
case GET_OAUTH2_CONFIG:
44-
return {
45-
...state,
46-
}
40+
return handleDefault()
4741
case GET_OAUTH2_CONFIG_RESPONSE:
4842
if (action.payload.config && action.payload.config != -1) {
4943
return {
@@ -59,9 +53,7 @@ export default function authReducer(state = INIT_STATE, action) {
5953
}
6054

6155
case USERINFO_REQUEST:
62-
return {
63-
...state,
64-
}
56+
return handleDefault()
6557
case USERINFO_RESPONSE:
6658
if (action.payload.uclaims) {
6759
return {
@@ -79,9 +71,7 @@ export default function authReducer(state = INIT_STATE, action) {
7971
}
8072

8173
case GET_API_ACCESS_TOKEN:
82-
return {
83-
...state,
84-
}
74+
return handleDefault()
8575

8676
case GET_API_ACCESS_TOKEN_RESPONSE:
8777
if (action.payload.accessToken) {
@@ -93,15 +83,17 @@ export default function authReducer(state = INIT_STATE, action) {
9383
isAuthenticated: true,
9484
}
9585
} else {
96-
return {
97-
...state,
98-
}
86+
return handleDefault()
9987
}
10088

10189
default:
102-
return {
103-
...state,
104-
}
90+
return handleDefault()
91+
}
92+
93+
function handleDefault() {
94+
return {
95+
...state,
96+
}
10597
}
10698
}
10799
reducerRegistry.register(reducerName, authReducer)

app/redux/reducers/FidoReducer.js

+19-18
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@ const reducerName = 'fidoReducer'
1616
export default function fidoReducer(state = INIT_STATE, action) {
1717
switch (action.type) {
1818
case GET_FIDO:
19-
return {
20-
...state,
21-
loading: true,
22-
}
19+
return handleLoading()
2320
case GET_FIDO_RESPONSE:
2421
if (action.payload.data) {
2522
return {
@@ -28,15 +25,10 @@ export default function fidoReducer(state = INIT_STATE, action) {
2825
loading: false,
2926
}
3027
} else {
31-
return {
32-
...state,
33-
}
28+
return handleDefault()
3429
}
3530
case PUT_FIDO:
36-
return {
37-
...state,
38-
loading: true,
39-
}
31+
return handleLoading()
4032
case PUT_FIDO_RESPONSE:
4133
if (action.payload.data) {
4234
return {
@@ -45,9 +37,7 @@ export default function fidoReducer(state = INIT_STATE, action) {
4537
loading: false,
4638
}
4739
} else {
48-
return {
49-
...state,
50-
}
40+
return handleDefault()
5141
}
5242

5343
case RESET:
@@ -57,10 +47,21 @@ export default function fidoReducer(state = INIT_STATE, action) {
5747
loading: INIT_STATE.loading,
5848
}
5949
default:
60-
return {
61-
...state,
62-
loading: false,
63-
}
50+
return handleDefault()
51+
}
52+
53+
function handleLoading() {
54+
return {
55+
...state,
56+
loading: true,
57+
}
58+
}
59+
60+
function handleDefault() {
61+
return {
62+
...state,
63+
loading: false,
64+
}
6465
}
6566
}
6667

app/redux/reducers/InitReducer.js

+14-24
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ const reducerName = 'initReducer'
2121
export default function initReducer(state = INIT_STATE, action) {
2222
switch (action.type) {
2323
case GET_SCRIPTS_FOR_STAT:
24-
return {
25-
...state,
26-
}
24+
return handleDefault()
2725

2826
case GET_SCRIPTS_FOR_STAT_RESPONSE:
2927
if (action.payload.data) {
@@ -32,25 +30,19 @@ export default function initReducer(state = INIT_STATE, action) {
3230
scripts: action.payload.data,
3331
}
3432
} else {
35-
return {
36-
...state,
37-
}
33+
return handleDefault()
3834
}
3935

4036
case GET_CLIENTS_FOR_STAT:
41-
return {
42-
...state,
43-
}
37+
return handleDefault()
4438
case GET_CLIENTS_FOR_STAT_RESPONSE:
4539
if (action.payload.data) {
4640
return {
4741
...state,
4842
clients: action.payload.data,
4943
}
5044
} else {
51-
return {
52-
...state,
53-
}
45+
return handleDefault()
5446
}
5547

5648
case GET_ATTRIBUTES_FOR_STAT:
@@ -61,30 +53,28 @@ export default function initReducer(state = INIT_STATE, action) {
6153
attributes: action.payload.data,
6254
}
6355
} else {
64-
return {
65-
...state,
66-
}
56+
return handleDefault()
6757
}
6858

6959
case GET_SCOPES_FOR_STAT:
70-
return {
71-
...state,
72-
}
60+
return handleDefault()
7361
case GET_SCOPES_FOR_STAT_RESPONSE:
7462
if (action.payload.data) {
7563
return {
7664
...state,
7765
scopes: action.payload.data,
7866
}
7967
} else {
80-
return {
81-
...state,
82-
}
68+
return handleDefault()
8369
}
8470
default:
85-
return {
86-
...state,
87-
}
71+
return handleDefault()
72+
}
73+
74+
function handleDefault() {
75+
return {
76+
...state,
77+
}
8878
}
8979
}
9080
reducerRegistry.register(reducerName, initReducer)

app/redux/reducers/JsonConfigReducer.js

+21-22
Original file line numberDiff line numberDiff line change
@@ -15,47 +15,46 @@ const reducerName = 'jsonConfigReducer'
1515
export default function jsonConfigReducer(state = INIT_STATE, action) {
1616
switch (action.type) {
1717
case GET_JSON_CONFIG:
18-
return {
19-
...state,
20-
loading: true,
21-
}
18+
return handleLoading()
2219
case GET_JSONCONFIG_RESPONSE:
2320
if (action.payload.data) {
2421
return {
2522
...state,
2623
configuration: action.payload.data,
2724
loading: false,
2825
}
29-
}
30-
else {
31-
return {
32-
...state,
33-
}
26+
} else {
27+
return handleDefault()
3428
}
3529

3630
case PATCH_JSON_CONFIG:
37-
return {
38-
...state,
39-
loading: true,
40-
}
31+
return handleLoading()
4132
case PATCH_JSONCONFIG_RESPONSE:
4233
if (action.payload.data) {
4334
return {
4435
...state,
4536
configuration: action.payload.data,
4637
loading: false,
4738
}
48-
}
49-
else {
50-
return {
51-
...state,
52-
}
39+
} else {
40+
return handleDefault()
5341
}
5442
default:
55-
return {
56-
...state,
57-
loading: false,
58-
}
43+
return handleDefault()
44+
}
45+
46+
function handleLoading() {
47+
return {
48+
...state,
49+
loading: true,
50+
}
51+
}
52+
53+
function handleDefault() {
54+
return {
55+
...state,
56+
loading: false,
57+
}
5958
}
6059
}
6160
reducerRegistry.register(reducerName, jsonConfigReducer)

app/routes/Apps/Gluu/GluuNameValuesProperty.js

-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ function GluuNameValuesProperty({
4141
return
4242
}
4343
for (var i = 0; i < value.length; i++) {
44-
var elm = value[i]
4544
var valueList = []
4645
var opts = []
4746
valueList = value[i].domains

plugins/admin/components/Configuration/LicenseDetailsPage.js

+1-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useEffect, useState } from 'react'
1+
import React, { useEffect} from 'react'
22
import { connect } from 'react-redux'
33
import LicenseDetailsForm from './LicenseDetailsForm'
44
import GluuLabel from '../../../../app/routes/Apps/Gluu/GluuLabel'
@@ -13,15 +13,9 @@ import GluuLoader from '../../../../app/routes/Apps/Gluu/GluuLoader'
1313
import Alert from '@material-ui/lab/Alert'
1414

1515
function LicenseDetailsPage({ item, loading, dispatch }) {
16-
const [validityPeriod, setValidityPeriod] = useState(
17-
!!item.validityPeriod ? new Date(item.validityPeriod) : new Date(),
18-
)
1916
useEffect(() => {
2017
dispatch(getLicenseDetails())
2118
}, [])
22-
useEffect(() => {
23-
setValidityPeriod(new Date(item.validityPeriod))
24-
}, [item.validityPeriod])
2519

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

3226
return (
3327
<React.Fragment>
34-
{/* <Container> */}
3528
<GluuLabel label="fields.licenseDetails" size={8} />
3629
<GluuLoader blocking={loading}>
3730
{item.licenseEnable ? (

plugins/auth-server/components/Configuration/ConfigPage.js

-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import GluuCommitDialog from '../../../../app/routes/Apps/Gluu/GluuCommitDialog'
66
import useExitPrompt from '../../../../app/routes/Apps/Gluu/useExitPrompt'
77
import PropertyBuilder from './JsonPropertyBuilder'
88
import { connect } from 'react-redux'
9-
import { useTranslation } from 'react-i18next'
109
import { buildPayload } from '../../../../app/utils/PermChecker'
1110
import {
1211
getJsonConfig,
@@ -15,7 +14,6 @@ import {
1514
import { FETCHING_JSON_PROPERTIES } from '../../common/Constants'
1615

1716
function ConfigPage({ configuration, loading, dispatch }) {
18-
const { t } = useTranslation()
1917
const lSize = 6
2018
const userAction = {}
2119
const [modal, setModal] = useState(false)

plugins/auth-server/components/Configuration/JsonPropertyBuilder.js

-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ function JsonPropertyBuilder({
3737
handler(patch)
3838
setShow(false)
3939
}
40-
const addHandler = () => {}
4140

4241
function isStringArray(item) {
4342
return (

0 commit comments

Comments
 (0)