Skip to content

Commit

Permalink
feat(admin-ui): unable to add description of an existing permission i…
Browse files Browse the repository at this point in the history
…n config-api #66
  • Loading branch information
syntrydy committed Feb 14, 2022
1 parent 246a7c9 commit 806f4fe
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
2 changes: 2 additions & 0 deletions admin-ui/app/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@
"client_encryption_signing": "Encryption/Signing",
"client_scripts": "Client Scripts",
"config_api_roles": "Config API Roles",
"config_api_permissions": "Config API Permissions",
"connectionUri": "Connection URI",
"custom_scripts": "All Custom Scripts",
"database_status_title": "Database status",
Expand All @@ -392,6 +393,7 @@
"public_keys": "Public Keys",
"profile_detail": "Profile Details",
"roles": "Config API Roles",
"permissions": "Config API Permissions",
"scopes": "OpenID/OAuth Scopes",
"scripts": "Custom Interception Scripts",
"schemaName": "Schema Name"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useEffect, useState } from 'react'
import MaterialTable from '@material-table/core';
import MaterialTable from '@material-table/core'
import { Paper } from '@material-ui/core'
import UiPermDetailPage from './UiPermDetailPage'
import { Badge } from 'reactstrap'
Expand Down Expand Up @@ -60,7 +60,7 @@ function UiPermListPage({ apiPerms, permissions, loading, dispatch }) {
}
return (
<Card>
<GluuRibbon title={t('titles.roles')} fromLeft />
<GluuRibbon title={t('titles.permissions')} fromLeft />
<CardBody>
<FormGroup row />
<FormGroup row />
Expand All @@ -73,7 +73,7 @@ function UiPermListPage({ apiPerms, permissions, loading, dispatch }) {
{
title: `${t('fields.name')}`,
field: 'permission',
editable:false,
editable: false,
width: '50%',
render: (rowData) => (
<Badge color="info">{rowData.permission}</Badge>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,14 @@ export default function apiPermissionReducer(state = INIT_STATE, action) {
return handleLoading()
case EDIT_PERMISSION_RESPONSE:
if (action.payload.data) {
let currentItems = [...state.items]
currentItems.filter(
(item) => item.permission === action.payload.data.permission,
)
currentItems.push(action.payload.data)
return {
...state,
items: [...state.items],
items: currentItems,
loading: false,
}
} else {
Expand Down
5 changes: 4 additions & 1 deletion admin-ui/plugins/admin/redux/reducers/ApiRoleReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,12 @@ export default function apiRoleReducer(state = INIT_STATE, action) {
return handleLoading()
case EDIT_ROLE_RESPONSE:
if (action.payload.data) {
let currentItems = [...state.items]
currentItems.filter((item) => item.role === action.payload.data.role)
currentItems.push(action.payload.data)
return {
...state,
items: [...state.items],
items: currentItems,
loading: false,
}
} else {
Expand Down

0 comments on commit 806f4fe

Please sign in to comment.