-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(admin-ui): design the layout for api role management #327
- Loading branch information
Showing
10 changed files
with
440 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import React from 'react' | ||
import MaterialTable from 'material-table' | ||
import UiRoleDetailPage from './UiRoleDetailPage' | ||
import { Badge } from 'reactstrap' | ||
import { connect } from 'react-redux' | ||
import { useTranslation } from 'react-i18next' | ||
import GluuViewWrapper from '../../../../app/routes/Apps/Gluu/GluuViewWrapper' | ||
import { | ||
hasPermission, | ||
buildPayload, | ||
SCRIPT_READ, | ||
} from '../../../../app/utils/PermChecker' | ||
|
||
function UiRoleListPage({ apiRoles, permissions, loading }) { | ||
const { t } = useTranslation() | ||
const pageSize = localStorage.getItem('paggingSize') || 10 | ||
|
||
return ( | ||
<React.Fragment> | ||
<GluuViewWrapper canShow={hasPermission(permissions, SCRIPT_READ)}> | ||
<MaterialTable | ||
columns={[ | ||
{ | ||
title: `${t('fields.name')}`, | ||
field: 'name', | ||
width: '20%', | ||
render: (rowData) => <Badge color="info">{rowData.name}</Badge>, | ||
}, | ||
{ title: `${t('fields.description')}`, field: 'description' }, | ||
]} | ||
data={apiRoles} | ||
isLoading={loading || false} | ||
title={t('titles.roles')} | ||
actions={[]} | ||
options={{ | ||
search: false, | ||
searchFieldAlignment: 'left', | ||
selection: false, | ||
pageSize: pageSize, | ||
rowStyle: (rowData) => ({ | ||
backgroundColor: rowData.enabled ? '#33AE9A' : '#FFF', | ||
}), | ||
headerStyle: { | ||
backgroundColor: '#03a96d', | ||
color: '#FFF', | ||
padding: '2px', | ||
textTransform: 'uppercase', | ||
fontSize: '18px', | ||
}, | ||
actionsColumnIndex: -1, | ||
}} | ||
detailPanel={(rowData) => { | ||
return <UiRoleDetailPage row={rowData} /> | ||
}} | ||
/> | ||
</GluuViewWrapper> | ||
</React.Fragment> | ||
) | ||
} | ||
|
||
const mapStateToProps = (state) => { | ||
return { | ||
apiRoles: state.apiRoleReducer.items, | ||
loading: state.apiRoleReducer.loading, | ||
permissions: state.authReducer.permissions, | ||
} | ||
} | ||
|
||
export default connect(mapStateToProps)(UiRoleListPage) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
export const roles = [ | ||
{ | ||
name: 'api-admin', | ||
description: | ||
'This role allows a user to access all list and search features available. Not possible for this role to perform edition nor deletion', | ||
scopes: [ | ||
'https://jans.io/oauth/config/attributes.readonly', | ||
'https://jans.io/oauth/config/acrs.readonly', | ||
], | ||
}, | ||
{ | ||
name: 'api-viewer', | ||
description: | ||
'This role allows a user to perform all possible actions on api objects', | ||
scopes: [ | ||
'https://jans.io/oauth/config/attributes.readonly', | ||
'https://jans.io/oauth/config/acrs.readonly', | ||
], | ||
}, | ||
{ | ||
name: 'api-editor', | ||
description: | ||
'This role allow a user to list, search, add and edit on all available objects excepts the configuration object which is critical for a running server', | ||
scopes: [ | ||
'https://jans.io/oauth/config/attributes.readonly', | ||
'https://jans.io/oauth/config/acrs.readonly', | ||
], | ||
}, | ||
{ | ||
name: 'api-manager', | ||
description: | ||
'This role allows a user to list, search, add, edit and delete all available objects include the configuration object(only in view mode). The user cannot edit nor delete the configuration object.', | ||
scopes: [ | ||
'https://jans.io/oauth/config/attributes.readonly', | ||
'https://jans.io/oauth/config/acrs.readonly', | ||
], | ||
}, | ||
] | ||
|
||
export default roles |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
export const SCRIPT = 'custom-script' | ||
export const SCRIPT = 'custom-script' | ||
export const API_ROLE = 'api-role' | ||
export const API_PERMISSION = 'api-permission' |
Oops, something went wrong.