fix: namespace show name join id
This commit is contained in:
parent
23a44df512
commit
25eb5580a6
@ -89,8 +89,10 @@ class NewPermissions extends React.Component {
|
||||
placeholder={locale.resourcePlaceholder}
|
||||
style={{ width: '100%' }}
|
||||
>
|
||||
{namespaces.map(({ namespaceShowName }) => (
|
||||
<Option value={namespaceShowName}>{namespaceShowName}</Option>
|
||||
{namespaces.map(({ namespace, namespaceShowName }) => (
|
||||
<Option value={namespace}>
|
||||
{namespaceShowName} {namespace ? `(${namespace})` : ''}
|
||||
</Option>
|
||||
))}
|
||||
</Select>
|
||||
</FormItem>
|
||||
|
@ -16,12 +16,19 @@ import PropTypes from 'prop-types';
|
||||
import { Button, Dialog, Pagination, Table, ConfigProvider } from '@alifd/next';
|
||||
import { connect } from 'react-redux';
|
||||
import { getPermissions, createPermission, deletePermission } from '../../../reducers/authority';
|
||||
import { getNamespaces } from '../../../reducers/namespace';
|
||||
import RegionGroup from '../../../components/RegionGroup';
|
||||
import NewPermissions from './NewPermissions';
|
||||
|
||||
import './PermissionsManagement.scss';
|
||||
|
||||
@connect(state => ({ permissions: state.authority.permissions }), { getPermissions })
|
||||
@connect(
|
||||
state => ({
|
||||
permissions: state.authority.permissions,
|
||||
namespaces: state.namespace.namespaces,
|
||||
}),
|
||||
{ getPermissions, getNamespaces }
|
||||
)
|
||||
@ConfigProvider.config
|
||||
class PermissionsManagement extends React.Component {
|
||||
static displayName = 'PermissionsManagement';
|
||||
@ -29,7 +36,9 @@ class PermissionsManagement extends React.Component {
|
||||
static propTypes = {
|
||||
locale: PropTypes.object,
|
||||
permissions: PropTypes.object,
|
||||
namespaces: PropTypes.object,
|
||||
getPermissions: PropTypes.func,
|
||||
getNamespaces: PropTypes.func,
|
||||
};
|
||||
|
||||
constructor(props) {
|
||||
@ -44,6 +53,7 @@ class PermissionsManagement extends React.Component {
|
||||
|
||||
componentDidMount() {
|
||||
this.getPermissions();
|
||||
this.props.getNamespaces();
|
||||
}
|
||||
|
||||
getPermissions() {
|
||||
@ -72,7 +82,7 @@ class PermissionsManagement extends React.Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
const { permissions, locale } = this.props;
|
||||
const { permissions, namespaces = [], locale } = this.props;
|
||||
const { loading, pageSize, pageNo, createPermissionVisible } = this.state;
|
||||
return (
|
||||
<>
|
||||
@ -84,7 +94,18 @@ class PermissionsManagement extends React.Component {
|
||||
</div>
|
||||
<Table dataSource={permissions.pageItems} loading={loading} maxBodyHeight={476} fixedHeader>
|
||||
<Table.Column title={locale.role} dataIndex="role" />
|
||||
<Table.Column title={locale.resource} dataIndex="resource" />
|
||||
<Table.Column
|
||||
title={locale.resource}
|
||||
dataIndex="resource"
|
||||
cell={value => {
|
||||
const [item = {}] = namespaces.filter(({ namespace }) => {
|
||||
const [itemNamespace] = value.split(':');
|
||||
return itemNamespace === namespace;
|
||||
});
|
||||
const { namespaceShowName = '', namespace = '' } = item;
|
||||
return namespaceShowName + (namespace ? ` (${namespace})` : '');
|
||||
}}
|
||||
/>
|
||||
<Table.Column
|
||||
title={locale.action}
|
||||
dataIndex="action"
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user