Newer
Older
piotr.kupczyk@id.ethz.ch
committed
import _ from 'lodash'
import React from 'react'
import autoBind from 'auto-bind'
import { withStyles } from '@material-ui/core/styles'
import Grid from '@src/js/components/common/grid/Grid.jsx'
piotr.kupczyk@id.ethz.ch
committed
import UserLink from '@src/js/components/common/link/UserLink.jsx'
piotr.kupczyk@id.ethz.ch
committed
import logger from '@src/js/common/logger.js'
const styles = () => ({})
class UsersGrid extends React.PureComponent {
constructor(props) {
super(props)
autoBind(this)
}
render() {
logger.log(logger.DEBUG, 'UsersGrid.render')
const {
id,
rows,
selectedRowId,
onSelectedRowChange,
controllerRef
} = this.props
return (
<Grid
id={id}
controllerRef={controllerRef}
header='Users'
columns={[
{
name: 'userId',
label: 'User Id',
sort: 'asc',
getValue: ({ row }) => row.userId.value,
renderValue: ({ value }) => {
piotr.kupczyk@id.ethz.ch
committed
return <UserLink userId={value} />
piotr.kupczyk@id.ethz.ch
committed
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
}
},
{
name: 'firstName',
label: 'First Name',
getValue: ({ row }) => row.firstName.value
},
{
name: 'lastName',
label: 'Last Name',
getValue: ({ row }) => row.lastName.value
},
{
name: 'email',
label: 'Email',
getValue: ({ row }) => row.email.value
},
{
name: 'space',
label: 'Home Space',
getValue: ({ row }) => row.space.value
},
{
name: 'active',
label: 'Active',
getValue: ({ row }) => row.active.value
}
]}
rows={rows}
selectedRowId={selectedRowId}
onSelectedRowChange={onSelectedRowChange}
/>
)
}
}
export default _.flow(withStyles(styles))(UsersGrid)