Skip to content
This repository was archived by the owner on Mar 23, 2019. It is now read-only.

Commit 80c5ea0

Browse files
authored
Enhance peformance of the Roles table (#257)
1 parent f7ffe25 commit 80c5ea0

File tree

2 files changed

+28
-24
lines changed

2 files changed

+28
-24
lines changed

src/components/RolesTable/index.jsx

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@ import { camelCase } from 'change-case/change-case';
77
import { withStyles } from '@material-ui/core/styles';
88
import TableRow from '@material-ui/core/TableRow';
99
import TableCell from '@material-ui/core/TableCell';
10-
import ListItemText from '@material-ui/core/ListItemText';
1110
import Typography from '@material-ui/core/Typography';
1211
import LinkIcon from 'mdi-react/LinkIcon';
13-
import TableCellListItem from '../TableCellListItem';
1412
import { role } from '../../utils/prop-types';
1513
import sort from '../../utils/sort';
1614
import DataTable from '../DataTable';
@@ -20,11 +18,18 @@ const sorted = pipe(
2018
map(({ roleId }) => roleId)
2119
);
2220

23-
@withStyles({
21+
@withStyles(theme => ({
22+
tableCell: {
23+
textDecoration: 'none',
24+
},
2425
listItemCell: {
26+
display: 'flex',
27+
justifyContent: 'space-between',
2528
width: '100%',
29+
padding: theme.spacing.unit,
30+
...theme.mixins.hover,
2631
},
27-
})
32+
}))
2833
export default class RolesTable extends Component {
2934
static defaultProps = {
3035
searchTerm: null,
@@ -99,20 +104,16 @@ export default class RolesTable extends Component {
99104
onHeaderClick={this.handleHeaderClick}
100105
renderRow={({ roleId }) => (
101106
<TableRow key={roleId}>
102-
<TableCell>
103-
<TableCellListItem
104-
className={classes.listItemCell}
105-
dense
106-
button
107-
component={Link}
107+
<TableCell padding="dense">
108+
<Link
109+
className={classes.tableCell}
108110
to={`/auth/roles/${encodeURIComponent(roleId)}`}
109111
>
110-
<ListItemText
111-
disableTypography
112-
primary={<Typography>{roleId}</Typography>}
113-
/>
114-
<LinkIcon size={iconSize} />
115-
</TableCellListItem>
112+
<div className={classes.listItemCell}>
113+
<Typography>{roleId}</Typography>
114+
<LinkIcon size={iconSize} />
115+
</div>
116+
</Link>
116117
</TableCell>
117118
</TableRow>
118119
)}

src/views/Roles/ViewRoles/index.jsx

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import React, { PureComponent, Fragment } from 'react';
33
import { graphql } from 'react-apollo';
44
import Spinner from '@mozilla-frontend-infra/components/Spinner';
55
import { withStyles } from '@material-ui/core/styles';
6+
import Tooltip from '@material-ui/core/Tooltip';
67
import PlusIcon from 'mdi-react/PlusIcon';
78
import Dashboard from '../../../components/Dashboard';
89
import Search from '../../../components/Search';
@@ -56,14 +57,16 @@ export default class ViewRoles extends PureComponent {
5657
{!roles && loading && <Spinner loading />}
5758
<ErrorPanel error={error} />
5859
{roles && <RolesTable searchTerm={roleSearch} roles={roles} />}
59-
<Button
60-
onClick={this.handleCreate}
61-
variant="fab"
62-
color="secondary"
63-
className={classes.plusIcon}
64-
>
65-
<PlusIcon />
66-
</Button>
60+
<Tooltip title="Create Role">
61+
<Button
62+
onClick={this.handleCreate}
63+
variant="fab"
64+
color="secondary"
65+
className={classes.plusIcon}
66+
>
67+
<PlusIcon />
68+
</Button>
69+
</Tooltip>
6770
</Fragment>
6871
</Dashboard>
6972
);

0 commit comments

Comments
 (0)