Skip to content

Commit daa519f

Browse files
committed
feat(admin-ui): additional refactoring #412
1 parent 0176f02 commit daa519f

16 files changed

+71
-87
lines changed

admin-ui/app/routes/Apps/Gluu/GluuAutoCompleteWithAdd.js

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { FormGroup, Col, Row, Button, Input } from 'Components'
33
import { Typeahead } from 'react-bootstrap-typeahead'
44
import GluuLabel from '../Gluu/GluuLabel'
55
import GluuTooltip from './GluuTooltip'
6-
import applicationStyle from './styles/applicationstyle'
76
import { useTranslation } from 'react-i18next'
87
import { ThemeContext } from 'Context/theme/themeContext'
98

admin-ui/app/routes/Apps/Gluu/GluuCommitDialog.js

-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ const GluuCommitDialog = ({
102102
</FormGroup>
103103
</ModalBody>
104104
<ModalFooter>
105-
{/* <ClipLoader loading={loading} size={35} /> */}
106105
{active && (
107106
<Button color={`primary-${selectedTheme}`} onClick={handleAccept}>
108107
<i className="fa fa-check-circle mr-2"></i>

admin-ui/app/routes/Apps/Gluu/GluuLabel.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from 'react'
22
import { Label } from 'Components'
33
import ReactTooltip from 'react-tooltip'
44
import { useTranslation } from 'react-i18next'
5+
import applicationStyle from './styles/applicationstyle'
56

67
function GluuLabel({ label, required, size, doc_category, doc_entry, style }) {
78
const { t } = useTranslation()
@@ -15,7 +16,7 @@ function GluuLabel({ label, required, size, doc_category, doc_entry, style }) {
1516
<Label for={label} sm={getSize()} data-tip data-for={label} style={style}>
1617
<h5>
1718
{t(label)}
18-
{required && <span style={{ color: 'red', fontSize: '22px' }}> *</span>}
19+
{required && <span style={applicationStyle.fieldRequired}> *</span>}
1920
:
2021
</h5>
2122
{doc_category && (

admin-ui/app/routes/Apps/Gluu/GluuNameValuesProperty.js

-4
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,14 @@ import { createTheme, ThemeProvider } from '@material-ui/core/styles'
77

88
function GluuNameValuesProperty({
99
formik,
10-
name,
1110
label1,
1211
name1,
1312
placeholder1,
1413
label2,
1514
name2,
1615
placeholder2,
1716
value,
18-
inputId,
1917
options,
20-
validator,
21-
items,
2218
dataArr,
2319
}) {
2420
const [dataArray, setDataArray] = useState(dataArr)

admin-ui/app/routes/Apps/Gluu/GluuNavBar.js

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
Avatar,
66
AvatarAddOn,
77
DropdownToggle,
8-
NavbarThemeProvider,
98
Navbar,
109
Nav,
1110
NavItem,

admin-ui/app/routes/Apps/Gluu/GluuRemovableInputRow.js

+3-10
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import React from 'react'
22
import { Col, FormGroup, Input } from 'Components'
33
import GluuLabel from './GluuLabel'
44
import GluuTooltip from './GluuTooltip'
5+
import applicationStyle from './styles/applicationstyle'
6+
57
function GluuRemovableInputRow({
68
label,
79
name,
@@ -34,16 +36,7 @@ function GluuRemovableInputRow({
3436
/>
3537
</Col>
3638
<div
37-
style={{
38-
float: 'right',
39-
justifyContent: 'center',
40-
cursor: 'pointer',
41-
padding: '5px',
42-
width: '25px',
43-
height: '25px',
44-
marginTop: '0px',
45-
marginRight: '-10px',
46-
}}
39+
style={applicationStyle.removableInputRow}
4740
onClick={handler}
4841
>
4942
<i className={'fa fa-fw fa-close'} style={{ color: 'red' }}></i>

admin-ui/app/routes/Apps/Gluu/GluuRemovableSelectRow.js

+2-13
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import GluuLabel from './GluuLabel'
33
import { Col, FormGroup, CustomInput, InputGroup } from 'Components'
44
import { useTranslation } from 'react-i18next'
55
import GluuTooltip from './GluuTooltip'
6+
import applicationstyle from './styles/applicationstyle'
67

78
function GluuRemovableSelectRow({
89
label,
@@ -44,19 +45,7 @@ function GluuRemovableSelectRow({
4445
</CustomInput>
4546
</InputGroup>
4647
</Col>
47-
<div
48-
style={{
49-
float: 'right',
50-
justifyContent: 'center',
51-
cursor: 'pointer',
52-
padding: '5px',
53-
width: '25px',
54-
height: '25px',
55-
marginTop: '0px',
56-
marginRight: '-10px',
57-
}}
58-
onClick={handler}
59-
>
48+
<div style={applicationstyle.removableInputRow} onClick={handler}>
6049
<i className={'fa fa-fw fa-close'} style={{ color: 'red' }}></i>
6150
</div>
6251
</FormGroup>

admin-ui/app/routes/Apps/Gluu/GluuRemovableTypeAhead.js

+2-11
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ import { Col, FormGroup, CustomInput, InputGroup } from 'Components'
44
import { useTranslation } from 'react-i18next'
55
import GluuTooltip from './GluuTooltip'
66
import { Typeahead } from 'react-bootstrap-typeahead'
7+
import applicationstyle from './styles/applicationstyle'
78

89
function GluuRemovableTypeAhead({
910
label,
1011
name,
1112
value,
1213
formik,
13-
values,
1414
lsize,
1515
rsize,
1616
handler,
@@ -49,16 +49,7 @@ function GluuRemovableTypeAhead({
4949
</InputGroup>
5050
</Col>
5151
<div
52-
style={{
53-
float: 'right',
54-
justifyContent: 'center',
55-
cursor: 'pointer',
56-
padding: '5px',
57-
width: '25px',
58-
height: '25px',
59-
marginTop: '0px',
60-
marginRight: '-10px',
61-
}}
52+
style={applicationstyle.removableInputRow}
6253
onClick={handler}
6354
>
6455
<i className={'fa fa-fw fa-close'} style={{ color: 'red' }}></i>

admin-ui/app/routes/Apps/Gluu/styles/applicationstyle.js

+14
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,18 @@ export default {
3838
backgroundColor: '#F5F5F5',
3939
float: 'left',
4040
},
41+
fieldRequired: {
42+
color: 'red',
43+
fontSize: '22px',
44+
},
45+
removableInputRow: {
46+
float: 'right',
47+
justifyContent: 'center',
48+
cursor: 'pointer',
49+
padding: '5px',
50+
width: '25px',
51+
height: '25px',
52+
marginTop: '0px',
53+
marginRight: '-10px',
54+
},
4155
}

admin-ui/app/routes/Dashboards/DashboardPage.js

+46-29
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,18 @@ function DashboardPage({
7575
const currentMonth = date.getMonth() + 1
7676
const formattedMonth = currentMonth > 9 ? currentMonth : `0${currentMonth}`
7777
const yearMonth = `${currentYear}${formattedMonth}`
78-
const currentMonthData = statData.find(({ month }) => month.toString() === yearMonth)
78+
const currentMonthData = statData.find(
79+
({ month }) => month.toString() === yearMonth,
80+
)
7981

8082
const mau = currentMonthData?.mau
81-
const token = currentMonthData?.authz_code_access_token_count + currentMonthData?.client_credentials_access_token_count
83+
const token =
84+
currentMonthData?.authz_code_access_token_count +
85+
currentMonthData?.client_credentials_access_token_count
8286
if (mau) {
8387
setMauCount(mau)
8488
}
85-
if(token) {
89+
if (token) {
8690
setTokenCount(token)
8791
}
8892
}, [statData])
@@ -197,10 +201,7 @@ function DashboardPage({
197201
const StatusCard = () => {
198202
return (
199203
<Grid xs={12}>
200-
<Paper
201-
className={`${classes.statusContainer} ml-20`}
202-
elevation={3}
203-
>
204+
<Paper className={`${classes.statusContainer} ml-20`} elevation={3}>
204205
<div className={classes.userInfoText}>
205206
<div className={classes.statusText}>
206207
<Box display="flex" justifyContent="flex-start">
@@ -287,11 +288,7 @@ function DashboardPage({
287288
style={{ background: themeColors.dashboard.supportCard }}
288289
>
289290
<div style={{ zIndex: 2 }}>
290-
<img
291-
src={Logo}
292-
alt="logo"
293-
className={classes.supportLogo}
294-
/>
291+
<img src={Logo} alt="logo" className={classes.supportLogo} />
295292
<div className="mt-40">Gluu Services</div>
296293
<div className="mt-40">Community Support</div>
297294
<div className="mt-40">FAQ</div>
@@ -309,9 +306,7 @@ function DashboardPage({
309306
}}
310307
>
311308
<div className={classes.textVertical}>WORLD</div>
312-
<div className={`${classes.textVertical} text-center`}>
313-
WIDE
314-
</div>
309+
<div className={`${classes.textVertical} text-center`}>WIDE</div>
315310
<div className={`${classes.textVertical} text-right`}>
316311
SU<span className={`${classes.redText}`}>PP</span>ORT
317312
</div>
@@ -329,9 +324,7 @@ function DashboardPage({
329324
<div className={classes.root}>
330325
<Grid container className="px-40">
331326
<Grid item lg={breakDashboardCard ? 12 : 4} md={12}>
332-
<h3 className="txt-white">
333-
{t('dashboard.summary_title')}
334-
</h3>
327+
<h3 className="txt-white">{t('dashboard.summary_title')}</h3>
335328
<div className="mt-20">
336329
{summaryData.map((data, key) => (
337330
<Paper key={key} className={classes.summary}>
@@ -341,21 +334,27 @@ function DashboardPage({
341334
))}
342335
</div>
343336
</Grid>
344-
<Grid item lg={breakDashboardCard ? 6 : 4} md={6} xs={12} style={{ width: '100%' }}>
337+
<Grid
338+
item
339+
lg={breakDashboardCard ? 6 : 4}
340+
md={6}
341+
xs={12}
342+
style={{ width: '100%' }}
343+
>
345344
<Paper
346345
className={`${classes.dashboardCard} top-minus-40`}
347346
elevation={0}
348347
spacing={2}
349348
>
350349
<Grid className={classes.flex} container>
351-
<Grid
352-
item
353-
xs={12}
354-
className={isMobile ? 'mt-20' : ''}
355-
>
350+
<Grid item xs={12} className={isMobile ? 'mt-20' : ''}>
356351
<Paper
357352
className={classes.userInfo}
358-
style={isTabletOrMobile || breakDashboardCard ? { marginLeft: 0 } : {}}
353+
style={
354+
isTabletOrMobile || breakDashboardCard
355+
? { marginLeft: 0 }
356+
: {}
357+
}
359358
elevation={3}
360359
>
361360
<div className={classes.userInfoTitle}>
@@ -386,19 +385,31 @@ function DashboardPage({
386385
</Grid>
387386
</Paper>
388387
</Grid>
389-
<Grid item lg={breakDashboardCard ? 6 : 4} md={6} xs={12} style={{ width: '100%' }}>
388+
<Grid
389+
item
390+
lg={breakDashboardCard ? 6 : 4}
391+
md={6}
392+
xs={12}
393+
style={{ width: '100%' }}
394+
>
390395
<StatusCard />
391396
</Grid>
392397
</Grid>
393398
<Grid container className={`px-40`}>
394399
<Grid lg={12} xs={12}>
395-
<h3 className="text-white">{t('dashboard.access_tokens_graph')}</h3>
400+
<h3 className="text-white">
401+
{t('dashboard.access_tokens_graph')}
402+
</h3>
396403
{isTabletOrMobile ? (
397404
<Grid container className={`${classes.whiteBg}`}>
398405
<Grid
399406
xs={12}
400407
item
401-
style={isTabletOrMobile ? { marginLeft: 40 } : { marginLeft: 40, marginBottom: 40 }}
408+
style={
409+
isTabletOrMobile
410+
? { marginLeft: 40 }
411+
: { marginLeft: 40, marginBottom: 40 }
412+
}
402413
>
403414
<div>{t('dashboard.select_date_range')}</div>
404415
<DateRange />
@@ -409,7 +420,13 @@ function DashboardPage({
409420
style={isMobile ? mobileChartStyle : {}}
410421
item
411422
>
412-
<div className={isTabletOrMobile ? classes.chartContainerTable : classes.chartContainer}>
423+
<div
424+
className={
425+
isTabletOrMobile
426+
? classes.chartContainerTable
427+
: classes.chartContainer
428+
}
429+
>
413430
<DashboardChart />
414431
</div>
415432
</Grid>

admin-ui/app/routes/License/LicenseDetailsPage.test.js

-5
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@ import i18n from '../../i18n'
77
import { I18nextProvider } from 'react-i18next'
88
import license from "./license"
99

10-
const permissions = [
11-
'https://jans.io/oauth/config/attributes.readonly',
12-
'https://jans.io/oauth/config/attributes.write',
13-
'https://jans.io/oauth/config/attributes.delete',
14-
]
1510
const INIT_LICENSE_DETAIL_STATE = {
1611
item: license,
1712
loading: false,

admin-ui/plugins/auth-server/components/Clients/ClientBasicPanel.js

-7
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,6 @@ const ClientBasicPanel = ({
5353
)
5454
const [showClientSecret, setShowClientSecret] = useState(false)
5555

56-
function handleExpirable() {
57-
setExpirable(!expirable)
58-
}
59-
6056
function getScopeMapping(exitingScopes, scopes) {
6157
if (!exitingScopes) {
6258
exitingScopes = []
@@ -67,9 +63,6 @@ const ClientBasicPanel = ({
6763
function uriValidator(uri) {
6864
return uri
6965
}
70-
function postUriValidator(uri) {
71-
return uri
72-
}
7366
function handleClickShowClientSecret() {
7467
setShowClientSecret(!showClientSecret)
7568
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { SIMPLE_PASSWORD_AUTH, FETCHING_SCRIPTS } from 'Plugins/auth-server/comm
2424
import { getAcrsConfig, editAcrs } from 'Plugins/auth-server/redux/actions/AcrsActions'
2525
import { getScripts } from 'Redux/actions/InitActions'
2626

27-
function ConfigPage({ acrs, scripts, configuration, loading, dispatch, permissions }) {
27+
function ConfigPage({ acrs, scripts, configuration, dispatch, permissions }) {
2828
const { t } = useTranslation()
2929
const lSize = 6
3030
const userAction = {}

admin-ui/plugins/auth-server/components/Scopes/ScopeDetailPage.js

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { useTranslation } from 'react-i18next'
66
import { ThemeContext } from 'Context/theme/themeContext'
77

88
function ScopeDetailPage({ row }) {
9-
console.log("========================="+JSON.stringify(row))
109
const { t } = useTranslation()
1110
const theme = useContext(ThemeContext)
1211
const selectedTheme = theme.state.theme

admin-ui/plugins/auth-server/components/Scopes/ScopeListPage.js

-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ function ScopeListPage({ scopes, permissions, loading, dispatch }) {
5757
const selectedTheme = theme.state.theme
5858
const themeColors = getThemeColor(selectedTheme)
5959
const bgThemeColor = { background: themeColors.background }
60-
const classes = styles()
6160

6261
SetTitle(t('titles.scopes'))
6362

admin-ui/plugins/schema/components/Person/AttributeAddPage.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react'
22
import { connect } from 'react-redux'
33
import { useHistory } from 'react-router-dom'
4-
import { Container, CardBody, Card } from 'Components'
4+
import { CardBody, Card } from 'Components'
55
import AttributeForm from './AttributeForm'
66
import { addAttribute } from 'Plugins/schema/redux/actions/AttributeActions'
77
import applicationStyle from 'Routes/Apps/Gluu/styles/applicationstyle'

0 commit comments

Comments
 (0)