Skip to content

Commit a648066

Browse files
authored
[INLONG-5203][Manager] Refactor the user interface (#5204)
1 parent f7c0d5d commit a648066

40 files changed

+517
-1503
lines changed

inlong-dashboard/src/components/StaffSelect/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ const StaffSelect: React.FC<StaffSelectProps> = ({
106106

107107
const { data: staffList, loading, run: getStaffList } = useRequest(
108108
(userName = '') => ({
109-
url: '/user/listAllUsers',
109+
url: '/user/listAll',
110110
params: {
111111
userName,
112112
},

inlong-dashboard/src/pages/UserManagement/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const Comp: React.FC = () => {
4343

4444
const { data, loading, run: getList } = useRequest(
4545
{
46-
url: '/user/listAllUsers',
46+
url: '/user/listAll',
4747
params: options,
4848
},
4949
{

inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/pojo/user/UserDetail.java

-55
This file was deleted.

inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/pojo/user/UserDetailListVO.java

-46
This file was deleted.

inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/pojo/user/UserDetailPageRequest.java

-35
This file was deleted.

inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/pojo/user/UserInfo.java

+39-29
Original file line numberDiff line numberDiff line change
@@ -17,63 +17,73 @@
1717

1818
package org.apache.inlong.manager.common.pojo.user;
1919

20+
import com.fasterxml.jackson.annotation.JsonFormat;
2021
import io.swagger.annotations.ApiModel;
2122
import io.swagger.annotations.ApiModelProperty;
22-
import lombok.AllArgsConstructor;
23-
import lombok.Builder;
2423
import lombok.Data;
25-
import lombok.NoArgsConstructor;
26-
import org.apache.inlong.manager.common.enums.UserTypeEnum;
27-
import org.apache.inlong.manager.common.validation.InEnumInt;
2824

2925
import javax.validation.constraints.Min;
30-
import javax.validation.constraints.NotBlank;
3126
import javax.validation.constraints.NotNull;
27+
import java.util.Date;
28+
import java.util.Set;
3229

3330
/**
34-
* User info, including username, password, etc.
31+
* User info
3532
*/
3633
@Data
37-
@Builder
38-
@NoArgsConstructor
39-
@AllArgsConstructor
4034
@ApiModel("User info")
4135
public class UserInfo {
4236

37+
@ApiModelProperty(value = "Primary key")
4338
private Integer id;
4439

45-
/**
46-
* User type {@link UserTypeEnum}
47-
*/
48-
@NotNull(message = "type cannot be null")
49-
@InEnumInt(UserTypeEnum.class)
50-
@ApiModelProperty(value = "type: 0 - manager, 1 - operator", required = true)
51-
private Integer type;
40+
@ApiModelProperty(value = "Username")
41+
private String name;
5242

53-
@NotBlank(message = "username cannot be blank")
54-
@ApiModelProperty(value = "username", required = true)
55-
private String username;
56-
57-
@ApiModelProperty(value = "password")
43+
@ApiModelProperty(value = "User password")
5844
private String password;
5945

60-
@ApiModelProperty(value = "newPassword")
61-
private String newPassword;
62-
63-
@ApiModelProperty("secret key")
46+
@ApiModelProperty("Secret key")
6447
private String secretKey;
6548

66-
@ApiModelProperty("public key")
49+
@ApiModelProperty("Public key")
6750
private String publicKey;
6851

69-
@ApiModelProperty("private key")
52+
@ApiModelProperty("Private key")
7053
private String privateKey;
7154

55+
@ApiModelProperty("Encryption key version")
56+
private Integer encryptVersion;
57+
58+
@ApiModelProperty(value = "Account type: 0 - manager, 1 - operator", required = true)
59+
private Integer accountType;
60+
7261
@Min(1)
7362
@NotNull(message = "validDays cannot be null")
74-
@ApiModelProperty(value = "valid days", required = true)
63+
@ApiModelProperty(value = "Valid days", required = true)
7564
private Integer validDays;
7665

66+
@ApiModelProperty(value = "Name of creator")
67+
private String creator;
68+
69+
@ApiModelProperty(value = "Name of modifier")
70+
private String modifier;
71+
72+
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
73+
private Date createTime;
74+
75+
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
76+
private Date modifyTime;
77+
78+
@ApiModelProperty(value = "User status, valid or not")
79+
private String status;
80+
81+
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
82+
private Date dueDate;
83+
84+
@ApiModelProperty(value = "User roles")
85+
private Set<String> roles;
86+
7787
@ApiModelProperty(value = "Version number")
7888
private Integer version;
7989

inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/pojo/user/LoginUser.java inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/pojo/user/UserLoginRequest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
*/
2929
@Data
3030
@ApiModel("Login user and password")
31-
public class LoginUser {
31+
public class UserLoginRequest {
3232

3333
@NotBlank
3434
@ApiModelProperty(value = "username", required = true)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
package org.apache.inlong.manager.common.pojo.user;
19+
20+
import io.swagger.annotations.ApiModel;
21+
import io.swagger.annotations.ApiModelProperty;
22+
import lombok.AllArgsConstructor;
23+
import lombok.Builder;
24+
import lombok.Data;
25+
import lombok.EqualsAndHashCode;
26+
import lombok.NoArgsConstructor;
27+
import org.apache.inlong.manager.common.beans.PageRequest;
28+
import org.apache.inlong.manager.common.enums.UserTypeEnum;
29+
import org.apache.inlong.manager.common.validation.InEnumInt;
30+
31+
import javax.validation.constraints.Min;
32+
import javax.validation.constraints.NotBlank;
33+
import javax.validation.constraints.NotNull;
34+
35+
/**
36+
* User info request
37+
*/
38+
@Data
39+
@Builder
40+
@NoArgsConstructor
41+
@AllArgsConstructor
42+
@EqualsAndHashCode(callSuper = false)
43+
@ApiModel("User info request")
44+
public class UserRequest extends PageRequest {
45+
46+
@ApiModelProperty(value = "Primary key")
47+
private Integer id;
48+
49+
@NotBlank(message = "User name cannot be blank")
50+
@ApiModelProperty(value = "User name", required = true)
51+
private String name;
52+
53+
@ApiModelProperty(value = "Keyword, can be user name")
54+
private String keyword;
55+
56+
@ApiModelProperty(value = "User password")
57+
private String password;
58+
59+
@ApiModelProperty(value = "New password, is required if needs updated")
60+
private String newPassword;
61+
62+
@ApiModelProperty("Secret key")
63+
private String secretKey;
64+
65+
@ApiModelProperty("Public key")
66+
private String publicKey;
67+
68+
@ApiModelProperty("Private key")
69+
private String privateKey;
70+
71+
@ApiModelProperty("Encryption key version")
72+
private Integer encryptVersion;
73+
74+
@NotNull(message = "accountType cannot be null")
75+
@InEnumInt(UserTypeEnum.class)
76+
@ApiModelProperty(value = "Account type: 0 - manager, 1 - operator", required = true)
77+
private Integer accountType;
78+
79+
@Min(1)
80+
@NotNull(message = "validDays cannot be null")
81+
@ApiModelProperty(value = "Valid days", required = true)
82+
private Integer validDays;
83+
84+
@ApiModelProperty(value = "Version number")
85+
private Integer version;
86+
87+
}

inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/pojo/user/UserRoleCode.java

+1
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@ public class UserRoleCode {
2424

2525
public static final String ADMIN = "ADMIN";
2626
public static final String OPERATOR = "OPERATE";
27+
2728
}

inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/util/LoginUserUtils.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
package org.apache.inlong.manager.common.util;
1919

2020
import lombok.extern.slf4j.Slf4j;
21-
import org.apache.inlong.manager.common.pojo.user.UserDetail;
21+
import org.apache.inlong.manager.common.pojo.user.UserInfo;
2222

2323
/**
2424
* User info for login
@@ -29,15 +29,15 @@ public class LoginUserUtils {
2929
/**
3030
* ThreadLocal for user info
3131
*/
32-
private static final ThreadLocal<UserDetail> LOGIN_USER_DETAIL_TL = new ThreadLocal<>();
32+
private static final ThreadLocal<UserInfo> LOGIN_USER_DETAIL_TL = new ThreadLocal<>();
3333

34-
public static UserDetail getLoginUserDetail() {
34+
public static UserInfo getLoginUser() {
3535
return LOGIN_USER_DETAIL_TL.get();
3636
}
3737

38-
public static void setUserLoginInfo(UserDetail userDetail) {
39-
log.debug("user login: {}", userDetail.getUsername());
40-
LOGIN_USER_DETAIL_TL.set(userDetail);
38+
public static void setUserLoginInfo(UserInfo userInfo) {
39+
log.debug("user login: {}", userInfo.getName());
40+
LOGIN_USER_DETAIL_TL.set(userInfo);
4141
}
4242

4343
public static void removeUserLoginInfo() {

0 commit comments

Comments
 (0)