|
1 | 1 | import React, { useState, useEffect } from 'react'
|
2 |
| -import MaterialTable from '@material-table/core'; |
| 2 | +import MaterialTable from '@material-table/core' |
3 | 3 | import { useHistory } from 'react-router-dom'
|
4 | 4 | import { connect } from 'react-redux'
|
5 | 5 | 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' |
8 | 7 | import GluuRibbon from '../../../../app/routes/Apps/Gluu/GluuRibbon'
|
9 | 8 | import GluuDialog from '../../../../app/routes/Apps/Gluu/GluuDialog'
|
10 | 9 | import ClientDetailPage from '../Clients/ClientDetailPage'
|
@@ -47,6 +46,41 @@ function ClientListPage({ clients, permissions, scopes, loading, dispatch }) {
|
47 | 46 | const [item, setItem] = useState({})
|
48 | 47 | const [modal, setModal] = useState(false)
|
49 | 48 | 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 | + ] |
50 | 84 | useEffect(() => {
|
51 | 85 | makeOptions()
|
52 | 86 | buildPayload(userAction, FETCHING_OIDC_CLIENTS, options)
|
@@ -192,41 +226,7 @@ function ClientListPage({ clients, permissions, scopes, loading, dispatch }) {
|
192 | 226 | components={{
|
193 | 227 | Container: (props) => <Paper {...props} elevation={0} />,
|
194 | 228 | }}
|
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} |
230 | 230 | data={clients}
|
231 | 231 | isLoading={loading}
|
232 | 232 | title=""
|
|
0 commit comments