diff --git a/UI/src/components/role-editor/actions.js b/UI/src/components/role-editor/actions.js index 6bdab36..4f17431 100644 --- a/UI/src/components/role-editor/actions.js +++ b/UI/src/components/role-editor/actions.js @@ -1,10 +1,11 @@ import { Set } from 'immutable' import * as UIActions from '../../actions/ui' -import { getViewMap } from '../role-picker/actions' +import { getViewMap, setup } from '../role-picker/actions' import uuidv4 from 'uuid/v4' import superagent from 'superagent' -export const constructView = id => (dispatch, getState) => { +export const constructView = id => async (dispatch, getState) => { + await setup(id)(dispatch) const server = getState().servers.get(id) let { viewMap, hasSafeRoles } = getViewMap(server) diff --git a/UI/src/components/role-editor/index.js b/UI/src/components/role-editor/index.js index 77f1640..6af2fe7 100644 --- a/UI/src/components/role-editor/index.js +++ b/UI/src/components/role-editor/index.js @@ -113,6 +113,11 @@ class RoleEditor extends Component { render () { const { server } = this.props + + if (server == null) { + return null + } + if (server.getIn(['perms', 'canManageRoles']) !== true) { return } diff --git a/UI/src/components/role-picker/actions.js b/UI/src/components/role-picker/actions.js index b259ae5..c7eaecb 100644 --- a/UI/src/components/role-picker/actions.js +++ b/UI/src/components/role-picker/actions.js @@ -6,8 +6,6 @@ export const setup = id => async dispatch => { const rsp = await superagent.get(`/api/server/${id}`) const data = rsp.body - console.log(data) - dispatch({ type: Symbol.for('server: set'), data: { @@ -20,7 +18,6 @@ export const setup = id => async dispatch => { export const getViewMap = server => { const roles = server.get('roles') - const categories = server.get('categories') const allRoles = server.get('roles').filter(v => v.get('safe')).map(r => r.get('id')).toSet()