Skip to content

Commit fdc5d14

Browse files
committed
feat(admin-ui): fix bugs #363 #361 #362
1 parent 42f6241 commit fdc5d14

File tree

5 files changed

+71
-20
lines changed

5 files changed

+71
-20
lines changed

app/routes/Apps/Gluu/styles/applicationstyle.js

+6
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,10 @@ export default {
1515
buttonStyle: {
1616
background: 'linear-gradient(90deg, #00C9FF 0%, #92FE9D 100%)',
1717
},
18+
healthDown:{
19+
background: 'linear-gradient(90deg, #fc575e 0%, #f7b42c 100%)'
20+
},
21+
healthUp:{
22+
content: ''
23+
}
1824
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ function ClientWizardForm({
308308
</CardBody>
309309
<CardBody className="p-5">
310310
{(() => {
311-
// setClient(formik.values)
311+
setClient(formik.values)
312312
switch (currentStep) {
313313
case sequence[0]:
314314
return (

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

+17-9
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,18 @@ import GluuRibbon from '../../../../app/routes/Apps/Gluu/GluuRibbon'
77
import useExitPrompt from '../../../../app/routes/Apps/Gluu/useExitPrompt'
88
import PropertyBuilder from './JsonPropertyBuilder'
99
import { connect } from 'react-redux'
10-
import { buildPayload } from '../../../../app/utils/PermChecker'
10+
import {
11+
buildPayload,
12+
hasPermission,
13+
PROPERTIES_WRITE,
14+
} from '../../../../app/utils/PermChecker'
1115
import {
1216
getJsonConfig,
1317
patchJsonConfig,
1418
} from '../../redux/actions/JsonConfigActions'
1519
import { FETCHING_JSON_PROPERTIES } from '../../common/Constants'
1620

17-
function ConfigPage({ configuration, loading, dispatch }) {
21+
function ConfigPage({ configuration, loading, dispatch, permissions }) {
1822
const lSize = 6
1923
const userAction = {}
2024
const [modal, setModal] = useState(false)
@@ -68,16 +72,20 @@ function ConfigPage({ configuration, loading, dispatch }) {
6872
/>
6973
))}
7074
<FormGroup row></FormGroup>
71-
<GluuCommitFooter saveHandler={toggle} />
75+
{hasPermission(permissions, PROPERTIES_WRITE) && (
76+
<GluuCommitFooter saveHandler={toggle} />
77+
)}
7278
<FormGroup row></FormGroup>
7379
<FormGroup row></FormGroup>
7480
<FormGroup row></FormGroup>
75-
<GluuCommitDialog
76-
handler={toggle}
77-
modal={modal}
78-
operations={patches}
79-
onAccept={submitForm}
80-
/>
81+
{hasPermission(permissions, PROPERTIES_WRITE) && (
82+
<GluuCommitDialog
83+
handler={toggle}
84+
modal={modal}
85+
operations={patches}
86+
onAccept={submitForm}
87+
/>
88+
)}
8189
</CardBody>
8290
</Card>
8391
</GluuLoader>

plugins/auth-server/components/Health/HealthPage.js

+45-8
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ import {
33
Container,
44
CardBody,
55
Card,
6+
Badge,
67
CardHeader,
78
FormGroup,
89
} from '../../../../app/components'
910
import { useTranslation } from 'react-i18next'
10-
11+
import applicationStyle from '../../../../app/routes/Apps/Gluu/styles/applicationstyle'
1112
import { buildPayload } from '../../../../app/utils/PermChecker'
1213
import { connect } from 'react-redux'
1314
import { getHealthStatus } from '../../redux/actions/HealthAction'
@@ -19,9 +20,27 @@ function HealthPage({ serverStatus, dbStatus, dispatch }) {
1920
const options = {}
2021

2122
useEffect(() => {
23+
fetchHealthInfo(userAction, options, dispatch)
24+
}, [])
25+
26+
function fetchHealthInfo() {
2227
buildPayload(userAction, 'GET Health Status', options)
2328
dispatch(getHealthStatus(userAction))
24-
}, [])
29+
}
30+
31+
function getColor(status) {
32+
return isUp(status) ? 'primary' : 'danger'
33+
}
34+
35+
function isUp(status) {
36+
if (status) {
37+
return (
38+
status.toUpperCase() === 'ONLINE'.toUpperCase() ||
39+
status.toUpperCase() === 'RUNNING'.toUpperCase()
40+
)
41+
}
42+
return false
43+
}
2544

2645
return (
2746
<Container>
@@ -31,17 +50,35 @@ function HealthPage({ serverStatus, dbStatus, dispatch }) {
3150
<FormGroup row />
3251
<FormGroup row />
3352
<CardBody>
34-
<Card className="mb-3">
35-
<CardHeader tag="h6" className="bg-success text-white">
53+
<Card className="mb-3" style={applicationStyle.buttonStyle}>
54+
<CardHeader tag="h6" className="text-white">
3655
{t('titles.oauth_server_status_title')}
3756
</CardHeader>
38-
<CardBody>{serverStatus}</CardBody>
57+
<CardBody
58+
style={
59+
isUp(serverStatus)
60+
? applicationStyle.healthUp
61+
: applicationStyle.healthDown
62+
}
63+
>
64+
{serverStatus && (
65+
<Badge color={getColor(serverStatus)}>{serverStatus}</Badge>
66+
)}
67+
</CardBody>
3968
</Card>
40-
<Card className="mb-3">
41-
<CardHeader tag="h6" className="bg-success text-white">
69+
<Card className="mb-3" style={applicationStyle.buttonStyle}>
70+
<CardHeader tag="h6" className="text-white">
4271
{t('titles.database_status_title')}
4372
</CardHeader>
44-
<CardBody>{dbStatus}</CardBody>
73+
<CardBody
74+
style={
75+
isUp(dbStatus)
76+
? applicationStyle.healthUp
77+
: applicationStyle.healthDown
78+
}
79+
>
80+
{dbStatus && <Badge color={getColor(dbStatus)}>{dbStatus}</Badge>}
81+
</CardBody>
4582
</Card>
4683
</CardBody>
4784
</Card>

plugins/auth-server/redux/api/HealthApi.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ export default class HealthApi {
33
this.api = api
44
}
55

6-
// Get Health Status
76
getHealthStatus = () => {
87
return new Promise((resolve, reject) => {
9-
this.api.getConfigHealthReady( (error, data) => {
8+
this.api.getAuthServerHealth((error, data) => {
109
if (error) {
10+
console.log(e);
1111
reject(error)
1212
} else {
1313
resolve(data)

0 commit comments

Comments
 (0)