Skip to content

Commit

Permalink
fix dashboard pagination plus role + user name displayed
Browse files Browse the repository at this point in the history
  • Loading branch information
pablopareja committed Dec 23, 2019
1 parent 04f7e48 commit 59c2355
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
6 changes: 5 additions & 1 deletion components/dashboards/table/DashboardsTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,11 @@ class DashboardsTable extends PureComponent {

this.setState({
loading: false,
dashboards,
dashboards: dashboards.map(_dashboard => ({
..._dashboard,
owner: _dashboard.user ? _dashboard.user.name || (_dashboard.user.email || '').split('@')[0] : '',
role: _dashboard.user ? _dashboard.user.role || '' : ''
})),
pagination: nextPagination
});
})
Expand Down
11 changes: 3 additions & 8 deletions services/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,12 @@ export const fetchDashboards = (params = {
},
params
}).then((response) => {
const { status, statusText, data } = response;
const { dashboards, meta } = data;

if (status >= 300) {
logger.error('Error fetching dashboards:', `${status}: ${statusText}`);
throw new Error(statusText);
}
const { data } = response;
const { meta } = data;

if (_meta) {
return {
dashboards: WRISerializer({ data: dashboards }),
dashboards: WRISerializer(data),
meta
};
}
Expand Down

0 comments on commit 59c2355

Please sign in to comment.