Skip to content

Commit 87eb557

Browse files
committed
feat(admin-ui): fix issues with material list #43
1 parent 8bffd11 commit 87eb557

File tree

3 files changed

+53
-52
lines changed

3 files changed

+53
-52
lines changed

admin-ui/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
},
117117
"dependencies": {
118118
"@babel/polyfill": "^7.4.4",
119-
"@material-table/core": "^4.3.18",
119+
"@material-table/core": "^4.3.31",
120120
"@material-ui/core": "^4.12.3",
121121
"@material-ui/icons": "^4.11.2",
122122
"@material-ui/lab": "^4.0.0-alpha.60",

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

+38-38
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import React, { useState, useEffect } from 'react'
2-
import MaterialTable from '@material-table/core';
2+
import MaterialTable from '@material-table/core'
33
import { useHistory } from 'react-router-dom'
44
import { connect } from 'react-redux'
55
import { Paper } from '@material-ui/core'
6-
import { Badge } from 'reactstrap'
7-
import { Card, CardBody, FormGroup } from '../../../../app/components'
6+
import { Card, CardBody, FormGroup, Badge } from '../../../../app/components'
87
import GluuRibbon from '../../../../app/routes/Apps/Gluu/GluuRibbon'
98
import GluuDialog from '../../../../app/routes/Apps/Gluu/GluuDialog'
109
import ClientDetailPage from '../Clients/ClientDetailPage'
@@ -47,6 +46,41 @@ function ClientListPage({ clients, permissions, scopes, loading, dispatch }) {
4746
const [item, setItem] = useState({})
4847
const [modal, setModal] = useState(false)
4948
const toggle = () => setModal(!modal)
49+
const tableColumns = [
50+
{
51+
title: `${t('fields.inum')}`,
52+
field: 'inum',
53+
hidden: true,
54+
sorting: true,
55+
searchable: true,
56+
},
57+
{ title: `${t('fields.client_name')}`, field: 'clientName' },
58+
{
59+
title: `${t('fields.application_type')}`,
60+
field: 'applicationType',
61+
},
62+
{ title: `${t('fields.subject_type')}`, field: 'subjectType' },
63+
{
64+
title: `${t('fields.status')}`,
65+
field: 'disabled',
66+
type: 'boolean',
67+
render: (rowData) => (
68+
<Badge color={getBadgeTheme(rowData.disabled)}>
69+
{getClientStatus(rowData.disabled)}
70+
</Badge>
71+
),
72+
},
73+
{
74+
title: `${t('fields.is_trusted_client')}`,
75+
field: 'trustedClient',
76+
type: 'boolean',
77+
render: (rowData) => (
78+
<Badge color={getTrustedTheme(rowData.trustedClient)}>
79+
{rowData.trustedClient ? t('options.yes') : t('options.no')}
80+
</Badge>
81+
),
82+
},
83+
]
5084
useEffect(() => {
5185
makeOptions()
5286
buildPayload(userAction, FETCHING_OIDC_CLIENTS, options)
@@ -192,41 +226,7 @@ function ClientListPage({ clients, permissions, scopes, loading, dispatch }) {
192226
components={{
193227
Container: (props) => <Paper {...props} elevation={0} />,
194228
}}
195-
columns={[
196-
{
197-
title: `${t('fields.inum')}`,
198-
field: 'inum',
199-
hidden: true,
200-
sorting: true,
201-
searchable: true,
202-
},
203-
{ title: `${t('fields.client_name')}`, field: 'clientName' },
204-
{
205-
title: `${t('fields.application_type')}`,
206-
field: 'applicationType',
207-
},
208-
{ title: `${t('fields.subject_type')}`, field: 'subjectType' },
209-
{
210-
title: `${t('fields.status')}`,
211-
field: 'disabled',
212-
type: 'boolean',
213-
render: (rowData) => (
214-
<Badge color={getBadgeTheme(rowData.disabled)}>
215-
{getClientStatus(rowData.disabled)}
216-
</Badge>
217-
),
218-
},
219-
{
220-
title: `${t('fields.is_trusted_client')}`,
221-
field: 'trustedClient',
222-
type: 'boolean',
223-
render: (rowData) => (
224-
<Badge color={getTrustedTheme(rowData.trustedClient)}>
225-
{rowData.trustedClient ? t('options.yes') : t('options.no')}
226-
</Badge>
227-
),
228-
},
229-
]}
229+
columns={tableColumns}
230230
data={clients}
231231
isLoading={loading}
232232
title=""

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

+14-13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useState, useEffect } from 'react'
2-
import MaterialTable from '@material-table/core';
2+
import MaterialTable from '@material-table/core'
33
import { Paper } from '@material-ui/core'
44
import { useHistory } from 'react-router-dom'
55
import { connect } from 'react-redux'
@@ -47,6 +47,17 @@ function ScopeListPage({ scopes, permissions, loading, dispatch }) {
4747
const [pattern, setPattern] = useState(null)
4848
const toggle = () => setModal(!modal)
4949

50+
const tableColumns = [
51+
{ title: `${t('fields.inum')}`, field: 'inum' },
52+
{ title: `${t('fields.displayname')}`, field: 'displayName' },
53+
{ title: `${t('fields.description')}`, field: 'description' },
54+
{
55+
title: `${t('fields.scope_type')}`,
56+
field: 'scopeType',
57+
render: (rowData) => <Badge color="primary">{rowData.scopeType}</Badge>,
58+
},
59+
]
60+
5061
useEffect(() => {
5162
makeOptions()
5263
buildPayload(userAction, FETCHING_SCOPES, options)
@@ -162,23 +173,13 @@ function ScopeListPage({ scopes, permissions, loading, dispatch }) {
162173
components={{
163174
Container: (props) => <Paper {...props} elevation={0} />,
164175
}}
165-
columns={[
166-
{ title: `${t('fields.inum')}`, field: 'inum' },
167-
{ title: `${t('fields.displayname')}`, field: 'displayName' },
168-
{ title: `${t('fields.description')}`, field: 'description' },
169-
{
170-
title: `${t('fields.scope_type')}`,
171-
field: 'scopeType',
172-
render: (rowData) => (
173-
<Badge color="primary">{rowData.scopeType}</Badge>
174-
),
175-
},
176-
]}
176+
columns={tableColumns}
177177
data={scopes}
178178
isLoading={loading}
179179
title=""
180180
actions={myActions}
181181
options={{
182+
columnsButton: true,
182183
search: true,
183184
searchFieldAlignment: 'left',
184185
selection: false,

0 commit comments

Comments
 (0)