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