ISSUE #3530 add button for user role page (#3553)

* ISSUE #3530 add button for user role page

* Merge branch 'upstream-develop' into develop-issues-#2792

# Conflicts:
#	console/src/main/resources/static/js/main.js
This commit is contained in:
ZZQ的 2020-08-11 09:47:39 +08:00 committed by GitHub
parent f1382d690e
commit 2726591dae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 67 additions and 42 deletions

View File

@ -94,6 +94,7 @@ const I18N_CONF = {
namespaceNames: 'Namespaces', namespaceNames: 'Namespaces',
namespaceNumber: 'Namespace ID', namespaceNumber: 'Namespace ID',
namespaceOperation: 'Actions', namespaceOperation: 'Actions',
refresh: 'Refresh',
}, },
ServiceList: { ServiceList: {
serviceList: 'Service List', serviceList: 'Service List',
@ -521,6 +522,7 @@ const I18N_CONF = {
username: 'Username', username: 'Username',
password: 'Password', password: 'Password',
operation: 'Operation', operation: 'Operation',
refresh: 'Refresh',
}, },
NewUser: { NewUser: {
createUser: 'Create user', createUser: 'Create user',
@ -554,6 +556,7 @@ const I18N_CONF = {
operation: 'Operation', operation: 'Operation',
deleteRole: 'Delete', deleteRole: 'Delete',
deleteRoleTip: 'Do you want to delete this role?', deleteRoleTip: 'Do you want to delete this role?',
refresh: 'Refresh',
}, },
NewRole: { NewRole: {
bindingRoles: 'Binding roles', bindingRoles: 'Binding roles',
@ -576,6 +579,7 @@ const I18N_CONF = {
readOnly: 'read only', readOnly: 'read only',
writeOnly: 'write only', writeOnly: 'write only',
readWrite: 'Read and write', readWrite: 'Read and write',
refresh: 'Refresh',
}, },
NewPermissions: { NewPermissions: {
addPermission: 'Add Permission', addPermission: 'Add Permission',

View File

@ -94,6 +94,7 @@ const I18N_CONF = {
namespaceNames: '命名空间名称', namespaceNames: '命名空间名称',
namespaceNumber: '命名空间ID', namespaceNumber: '命名空间ID',
namespaceOperation: '操作', namespaceOperation: '操作',
refresh: '刷新',
}, },
ServiceList: { ServiceList: {
serviceList: '服务列表', serviceList: '服务列表',
@ -518,6 +519,7 @@ const I18N_CONF = {
username: '用户名', username: '用户名',
password: '密码', password: '密码',
operation: '操作', operation: '操作',
refresh: '刷新',
}, },
NewUser: { NewUser: {
createUser: '创建用户', createUser: '创建用户',
@ -551,6 +553,7 @@ const I18N_CONF = {
operation: '操作', operation: '操作',
deleteRole: '删除', deleteRole: '删除',
deleteRoleTip: '是否要删除该角色', deleteRoleTip: '是否要删除该角色',
refresh: '刷新',
}, },
NewRole: { NewRole: {
bindingRoles: '绑定角色', bindingRoles: '绑定角色',
@ -573,6 +576,7 @@ const I18N_CONF = {
readOnly: '只读', readOnly: '只读',
writeOnly: '只写', writeOnly: '只写',
readWrite: '读写', readWrite: '读写',
refresh: '刷新',
}, },
NewPermissions: { NewPermissions: {
addPermission: '添加权限', addPermission: '添加权限',

View File

@ -60,6 +60,7 @@ class PermissionsManagement extends React.Component {
} }
getPermissions() { getPermissions() {
this.setState({ loading: true });
const { pageNo, pageSize } = this.state; const { pageNo, pageSize } = this.state;
this.props this.props
.getPermissions({ pageNo, pageSize }) .getPermissions({ pageNo, pageSize })
@ -94,6 +95,9 @@ class PermissionsManagement extends React.Component {
<Button type="primary" onClick={() => this.setState({ createPermissionVisible: true })}> <Button type="primary" onClick={() => this.setState({ createPermissionVisible: true })}>
{locale.addPermission} {locale.addPermission}
</Button> </Button>
<Button type="secondary" onClick={() => this.getPermissions()}>
{locale.refresh}
</Button>
</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" />

View File

@ -49,6 +49,7 @@ class RolesManagement extends React.Component {
} }
getRoles() { getRoles() {
this.setState({ loading: true });
const { pageNo, pageSize } = this.state; const { pageNo, pageSize } = this.state;
this.props this.props
.getRoles({ pageNo, pageSize }) .getRoles({ pageNo, pageSize })
@ -74,6 +75,9 @@ class RolesManagement extends React.Component {
<Button type="primary" onClick={() => this.setState({ createRoleVisible: true })}> <Button type="primary" onClick={() => this.setState({ createRoleVisible: true })}>
{locale.bindingRoles} {locale.bindingRoles}
</Button> </Button>
<Button type="secondary" onClick={() => this.getRoles()}>
{locale.refresh}
</Button>
</div> </div>
<Table dataSource={roles.pageItems} loading={loading} maxBodyHeight={476} fixedHeader> <Table dataSource={roles.pageItems} loading={loading} maxBodyHeight={476} fixedHeader>
<Table.Column title={locale.role} dataIndex="role" /> <Table.Column title={locale.role} dataIndex="role" />

View File

@ -51,6 +51,7 @@ class UserManagement extends React.Component {
} }
getUsers() { getUsers() {
this.setState({ loading: true });
const { pageNo, pageSize } = this.state; const { pageNo, pageSize } = this.state;
this.props this.props
.getUsers({ pageNo, pageSize }) .getUsers({ pageNo, pageSize })
@ -76,6 +77,9 @@ class UserManagement extends React.Component {
<Button type="primary" onClick={() => this.setState({ createUserVisible: true })}> <Button type="primary" onClick={() => this.setState({ createUserVisible: true })}>
{locale.createUser} {locale.createUser}
</Button> </Button>
<Button type="secondary" onClick={() => this.getUsers()}>
{locale.refresh}
</Button>
</div> </div>
<Table dataSource={users.pageItems} loading={loading} maxBodyHeight={476} fixedHeader> <Table dataSource={users.pageItems} loading={loading} maxBodyHeight={476} fixedHeader>
<Table.Column title={locale.username} dataIndex="username" /> <Table.Column title={locale.username} dataIndex="username" />

View File

@ -47,53 +47,51 @@ class NameSpace extends React.Component {
this.getNameSpaces(0); this.getNameSpaces(0);
} }
getNameSpaces(delayTime = 2000) { getNameSpaces() {
const { locale = {} } = this.props; const { locale = {} } = this.props;
const { prompt } = locale; const { prompt } = locale;
const self = this; const self = this;
self.openLoading(); self.openLoading();
setTimeout(() => { request({
request({ type: 'get',
type: 'get', beforeSend() {},
beforeSend() {}, url: 'v1/console/namespaces',
url: 'v1/console/namespaces', success: res => {
success: res => { if (res.code === 200) {
if (res.code === 200) { const data = res.data || [];
const data = res.data || []; window.namespaceList = data;
window.namespaceList = data;
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
if (data[i].type === 1) { if (data[i].type === 1) {
this.setState({ this.setState({
defaultNamespace: data[i].namespace, defaultNamespace: data[i].namespace,
}); });
}
} }
this.setState({
dataSource: data,
});
} else {
Dialog.alert({
title: prompt,
content: res.message,
});
} }
},
complete() { this.setState({
self.closeLoading(); dataSource: data,
}, });
error: res => { } else {
window.namespaceList = [ Dialog.alert({
{ title: prompt,
namespace: '', content: res.message,
namespaceShowName: '公共空间', });
type: 0, }
}, },
]; complete() {
}, self.closeLoading();
}); },
}, delayTime); error: res => {
window.namespaceList = [
{
namespace: '',
namespaceShowName: '公共空间',
type: 0,
},
];
},
});
} }
openLoading() { openLoading() {
@ -315,6 +313,13 @@ class NameSpace extends React.Component {
> >
{namespaceAdd} {namespaceAdd}
</Button> </Button>
<Button
style={{ marginRight: 0, marginTop: 10 }}
type="secondary"
onClick={() => this.getNameSpaces()}
>
{locale.refresh}
</Button>
</div> </div>
<div> <div>
<Table dataSource={this.state.dataSource} locale={{ empty: pubNoData }}> <Table dataSource={this.state.dataSource} locale={{ empty: pubNoData }}>

File diff suppressed because one or more lines are too long