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

View File

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

View File

@ -60,6 +60,7 @@ class PermissionsManagement extends React.Component {
}
getPermissions() {
this.setState({ loading: true });
const { pageNo, pageSize } = this.state;
this.props
.getPermissions({ pageNo, pageSize })
@ -94,6 +95,9 @@ class PermissionsManagement extends React.Component {
<Button type="primary" onClick={() => this.setState({ createPermissionVisible: true })}>
{locale.addPermission}
</Button>
<Button type="secondary" onClick={() => this.getPermissions()}>
{locale.refresh}
</Button>
</div>
<Table dataSource={permissions.pageItems} loading={loading} maxBodyHeight={476} fixedHeader>
<Table.Column title={locale.role} dataIndex="role" />

View File

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

View File

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

View File

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

File diff suppressed because one or more lines are too long