Skip to content

Commit

Permalink
fix: Fix authorized users list
Browse files Browse the repository at this point in the history
  • Loading branch information
leoliu committed Jul 6, 2020
1 parent 1ccbaac commit 65e2985
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 13 deletions.
33 changes: 20 additions & 13 deletions src/pages/access/containers/Roles/Detail/AuthorizedUsers/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,37 @@
* along with KubeSphere Console. If not, see <https://www.gnu.org/licenses/>.
*/

import { isEmpty } from 'lodash'
import React from 'react'
import { toJS } from 'mobx'
import { inject, observer } from 'mobx-react'
import { Table } from '@pitrix/lego-ui'

import { getLocalTime } from 'utils'
import { ROLE_QUERY_KEY } from 'utils/constants'
import { Card, Status } from 'components/Base'
import { Panel, Status } from 'components/Base'
import Table from 'components/Tables/Base'

import UserStore from 'stores/user'

import styles from './index.scss'

@inject('detailStore')
@observer
export default class AuthorizedUsers extends React.Component {
store = new UserStore()

componentDidMount() {
this.fetchData()
}

fetchData = (params = {}) => {
const { name, namespace, workspace, cluster } = this.props.match.params
const { module } = this.props.detailStore
this.store.fetchList({
[ROLE_QUERY_KEY[module]]: name,
namespace,
workspace,
cluster,
...params,
})
}

Expand Down Expand Up @@ -73,22 +79,23 @@ export default class AuthorizedUsers extends React.Component {
]

render() {
const { data, isLoading } = toJS(this.store.list)
const { data, total, page, limit, isLoading } = toJS(this.store.list)

const isEmptyList = isEmpty(data) && !isLoading
const pagination = { total, page, limit }

return (
<Card
title={t('Authorized Users')}
isEmpty={isEmptyList}
empty={t('No authorized users')}
>
<Panel title={t('Authorized Users')}>
<Table
dataSource={data}
className={styles.table}
data={data}
columns={this.getColumns()}
loading={isLoading}
pagination={pagination}
isLoading={isLoading}
onFetch={this.fetchData}
hideCustom
hideHeader
/>
</Card>
</Panel>
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.table {
box-shadow: none;
margin: -12px;
}

0 comments on commit 65e2985

Please sign in to comment.