Skip to content

Commit

Permalink
feat: Add has expired column in the api keys table (#3433)
Browse files Browse the repository at this point in the history
  • Loading branch information
novakzaballa committed Feb 28, 2024
1 parent 02c59d2 commit 3f83130
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions frontend/web/components/AdminAPIKeys.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,16 @@ export class CreateAPIKey extends PureComponent {
org_id: AccountStore.getOrganisation().id,
prefix: prefix,
}).then((res) => {
this.setState({
expiry_date: res.data.expiry_date,
is_admin: res.data.is_admin,
name: res.data.name,
})
getRolesMasterAPIKeyWithMasterAPIKeyRoles(getStore(), {
org_id: AccountStore.getOrganisation().id,
prefix: prefix,
}).then((rolesData) => {
this.setState({
expiry_date: res.data.expiry_date,
is_admin: res.data.is_admin,
name: res.data.name,
roles: rolesData.data.results,
})
})
Expand Down Expand Up @@ -401,6 +403,7 @@ export default class AdminAPIKeys extends PureComponent {

render() {
const apiKeys = this.state.apiKeys && this.state.apiKeys.results
console.log('DEBUG: apiKeys:', apiKeys)
const showRoleManagementEnabled = Utils.getFlagsmithHasFeature(
'show_role_management',
)
Expand Down Expand Up @@ -451,6 +454,7 @@ export default class AdminAPIKeys extends PureComponent {
<Flex className='table-column px-3'>API Keys</Flex>
<Flex className='table-column'>Created</Flex>
<Flex className='table-column'>Is Admin</Flex>
<Flex className='table-column'>Active</Flex>
<div
className='table-column text-center'
style={{ width: '80px' }}
Expand Down Expand Up @@ -481,6 +485,23 @@ export default class AdminAPIKeys extends PureComponent {
<Flex className='table-column fs-small lh-sm'>
<Switch checked={v.is_admin} disabled={true} />
</Flex>
<Flex className='table-column fs-small lh-sm'>
{v.has_expired ? (
<div className='ml-1'>
<Tooltip title={<Icon name='close-circle' />}>
{'This API key has expired'}
</Tooltip>
</div>
) : (
<span className='ml-1'>
<Icon
name='checkmark-circle'
fill='#27AB95'
width={28}
/>
</span>
)}
</Flex>
<div
className='table-column text-center'
style={{ width: '80px' }}
Expand Down

0 comments on commit 3f83130

Please sign in to comment.