This is an automated email from the ASF dual-hosted git repository.
benjobs pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-streampark.git
The following commit(s) were added to refs/heads/dev by this push:
new 5218337f5 [Improve] token status improvement (#3921)
5218337f5 is described below
commit 5218337f5e9f84408599a331c31782274e0895bf
Author: benjobs <[email protected]>
AuthorDate: Sat Jul 27 20:00:54 2024 +0800
[Improve] token status improvement (#3921)
* [Improve] token status improvement
* [Improve] NotNull minor improvement
---
.../src/main/assembly/conf/config.yaml | 2 -
.../console/core/aspect/StreamParkAspect.java | 29 +---
.../console/core/controller/AlertController.java | 4 +-
.../console/core/controller/OpenAPIController.java | 3 +-
.../console/core/enums/AccessTokenStateEnum.java | 9 +-
.../console/core/service/ServiceHelper.java | 146 ---------------------
.../console/system/authentication/ShiroRealm.java | 12 +-
.../system/controller/AccessTokenController.java | 24 ++--
.../system/controller/MemberController.java | 4 +-
.../console/system/service/AccessTokenService.java | 9 --
.../service/impl/AccessTokenServiceImpl.java | 6 -
.../resources/mapper/system/AccessTokenMapper.xml | 8 +-
.../streampark-console-webapp/src/api/index.ts | 9 +-
.../src/locales/lang/en/flink/app.ts | 5 +-
.../src/locales/lang/zh-CN/flink/app.ts | 5 +-
.../flink/app/components/RequestModal/index.tsx | 18 ++-
.../src/views/system/token/token.data.ts | 5 +-
17 files changed, 55 insertions(+), 243 deletions(-)
diff --git
a/streampark-console/streampark-console-service/src/main/assembly/conf/config.yaml
b/streampark-console/streampark-console-service/src/main/assembly/conf/config.yaml
index 86f9394b6..ec9a5fd33 100644
---
a/streampark-console/streampark-console-service/src/main/assembly/conf/config.yaml
+++
b/streampark-console/streampark-console-service/src/main/assembly/conf/config.yaml
@@ -64,8 +64,6 @@ streampark:
http-auth: 'simple' # default simple, or kerberos
# flink on yarn or spark on yarn, HADOOP_USER_NAME
hadoop-user-name: hdfs
- # openapi whitelist,
- openapi.white-list:
# flink on yarn or spark on yarn, when the hadoop cluster enable kerberos
authentication, it is necessary to set Kerberos authentication parameters.
security:
diff --git
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/aspect/StreamParkAspect.java
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/aspect/StreamParkAspect.java
index a17e7e23d..dda162627 100644
---
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/aspect/StreamParkAspect.java
+++
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/aspect/StreamParkAspect.java
@@ -42,7 +42,6 @@ import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.DefaultParameterNameDiscoverer;
-import org.springframework.core.SpringProperties;
import org.springframework.expression.EvaluationContext;
import org.springframework.expression.Expression;
import org.springframework.expression.spel.standard.SpelExpressionParser;
@@ -51,12 +50,8 @@ import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
-import javax.annotation.PostConstruct;
import javax.servlet.http.HttpServletRequest;
-import java.util.HashSet;
-import java.util.Set;
-
@Slf4j
@Component
@Aspect
@@ -71,24 +66,6 @@ public class StreamParkAspect {
@Autowired
private ApplicationManageService applicationManageService;
- private final Set<String> openapiWhitelist = new HashSet<>();
-
- @PostConstruct
- public void initOpenapiWhitelist() {
- String whiteLists =
SpringProperties.getProperty("streampark.openapi.white-list");
- if (StringUtils.isNotBlank(whiteLists)) {
- String[] whiteList = whiteLists.trim().split("\\s");
- for (String order : whiteList) {
- if (StringUtils.isNotBlank(order)) {
- if (!order.startsWith("/")) {
- order = "/" + order;
- }
- openapiWhitelist.add(order);
- }
- }
- }
- }
-
@Pointcut("execution(public"
+ " org.apache.streampark.console.base.domain.RestResponse"
+ " org.apache.streampark.console.core.controller.*.*(..))")
@@ -107,11 +84,7 @@ public class StreamParkAspect {
HttpServletRequest request =
((ServletRequestAttributes)
RequestContextHolder.getRequestAttributes()).getRequest();
String url = request.getRequestURI();
- if (openapiWhitelist.contains(url)) {
- log.info("request by openapi white-list: {} ", url);
- } else {
- throw new ApiAlertException("current api unsupported!");
- }
+ throw new ApiAlertException("openapi unsupported: " + url);
}
}
return (RestResponse) joinPoint.proceed();
diff --git
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/controller/AlertController.java
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/controller/AlertController.java
index a63e571a7..b299739dc 100644
---
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/controller/AlertController.java
+++
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/controller/AlertController.java
@@ -35,7 +35,6 @@ import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.constraints.NotNull;
@@ -93,8 +92,7 @@ public class AlertController {
}
@DeleteMapping("/delete")
- public RestResponse deleteAlertConfig(
- @RequestParam("id") @NotNull(message
= "config id must be not null") Long id) {
+ public RestResponse deleteAlertConfig(@NotNull(message = "{required}")
Long id) {
boolean result = alertConfigService.removeById(id);
return RestResponse.success(result);
}
diff --git
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/controller/OpenAPIController.java
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/controller/OpenAPIController.java
index 0a440a2fa..75954f041 100644
---
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/controller/OpenAPIController.java
+++
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/controller/OpenAPIController.java
@@ -34,6 +34,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
@Validated
@RestController
@@ -83,7 +84,7 @@ public class OpenAPIController {
@PostMapping("curl")
public RestResponse copyOpenApiCurl(String baseUrl,
Long appId,
- @NotBlank(message = "{required}") Long
teamId,
+ @NotNull(message = "{required}") Long
teamId,
@NotBlank(message = "{required}")
String name) {
String url = openAPIComponent.getOpenApiCUrl(baseUrl, appId, teamId,
name);
return RestResponse.success(url);
diff --git
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/enums/AccessTokenStateEnum.java
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/enums/AccessTokenStateEnum.java
index 1a2847a8b..d9c7d91f7 100644
---
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/enums/AccessTokenStateEnum.java
+++
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/enums/AccessTokenStateEnum.java
@@ -24,10 +24,13 @@ public enum AccessTokenStateEnum {
NULL(0),
/** invalid token */
- INVALID(1),
+ INVALID_TOKEN(1),
- /** effect token */
- OK(2);
+ /** locked user */
+ LOCKED_USER(2),
+
+ /** ok */
+ OK(3);
private final int value;
diff --git
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/ServiceHelper.java
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/ServiceHelper.java
deleted file mode 100644
index f81ab7f08..000000000
---
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/ServiceHelper.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.streampark.console.core.service;
-
-import org.apache.streampark.console.base.exception.ApiAlertException;
-import org.apache.streampark.console.base.exception.ApiDetailException;
-import org.apache.streampark.console.base.util.WebUtils;
-import org.apache.streampark.console.core.entity.FlinkEnv;
-import org.apache.streampark.console.core.entity.SparkEnv;
-import org.apache.streampark.console.system.authentication.JWTUtil;
-import org.apache.streampark.console.system.entity.User;
-import org.apache.streampark.console.system.service.UserService;
-import org.apache.streampark.flink.kubernetes.ingress.IngressController;
-
-import org.apache.shiro.SecurityUtils;
-import org.apache.shiro.authc.AuthenticationException;
-
-import com.baomidou.mybatisplus.core.toolkit.StringUtils;
-import io.fabric8.kubernetes.client.KubernetesClientException;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.io.File;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Objects;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-@Service
-public class ServiceHelper {
-
- @Autowired
- private SettingService settingService;
-
- @Autowired
- private UserService userService;
-
- private String flinkSqlClientJar = null;
-
- private String sparkSqlClientJar = null;
-
- public User getLoginUser() {
- String token = (String) SecurityUtils.getSubject().getPrincipal();
- Long userId = JWTUtil.getUserId(token);
- if (userId == null) {
- throw new AuthenticationException("Unauthorized");
- }
- return userService.getById(userId);
- }
-
- public Long getUserId() {
- User user = getLoginUser();
- if (user != null) {
- return user.getUserId();
- }
- return null;
- }
-
- public String getFlinkSqlClientJar(FlinkEnv flinkEnv) {
- if (flinkSqlClientJar == null) {
- File localClient = WebUtils.getAppClientDir();
- ApiAlertException.throwIfFalse(
- localClient.exists(), "[StreamPark] " + localClient + " no
exists. please check.");
-
- String regex =
String.format("streampark-flink-sqlclient_%s-.*\\.jar",
flinkEnv.getScalaVersion());
-
- List<String> jars =
Arrays.stream(Objects.requireNonNull(localClient.list()))
- .filter(x -> x.matches(regex))
- .collect(Collectors.toList());
-
- ApiAlertException.throwIfTrue(
- jars.isEmpty(),
- "[StreamPark] can't found streampark-flink-sqlclient jar in "
+ localClient);
-
- ApiAlertException.throwIfTrue(
- jars.size() > 1,
- "[StreamPark] found multiple streampark-flink-sqlclient jar in
" + localClient);
- flinkSqlClientJar = jars.get(0);
- }
- return flinkSqlClientJar;
- }
-
- public String getSparkSqlClientJar(SparkEnv sparkEnv) {
- if (sparkSqlClientJar == null) {
- File localClient = WebUtils.getAppClientDir();
- ApiAlertException.throwIfFalse(
- localClient.exists(), "[StreamPark] " + localClient + " no
exists. please check.");
- List<String> jars =
Arrays.stream(Objects.requireNonNull(localClient.list()))
- .filter(
- x -> x.matches(
- "streampark-spark-sqlclient_" +
sparkEnv.getScalaVersion()
- + "-.*\\.jar"))
- .collect(Collectors.toList());
-
- ApiAlertException.throwIfTrue(
- jars.isEmpty(),
- "[StreamPark] can't found streampark-flink-sqlclient jar in "
+ localClient);
-
- ApiAlertException.throwIfTrue(
- jars.size() > 1,
- "[StreamPark] found multiple streampark-flink-sqlclient jar in
" + localClient);
-
- sparkSqlClientJar = jars.get(0);
- }
- return sparkSqlClientJar;
- }
-
- public String rollViewLog(String path, int offset, int limit) {
- try {
- File file = new File(path);
- if (file.exists() && file.isFile()) {
- try (Stream<String> stream = Files.lines(Paths.get(path))) {
- return
stream.skip(offset).limit(limit).collect(Collectors.joining("\r\n"));
- }
- }
- return null;
- } catch (Exception e) {
- throw new ApiDetailException("roll view log error: " + e);
- }
- }
-
- public void configureIngress(String clusterId, String namespace) throws
KubernetesClientException {
- String domainName = settingService.getIngressModeDefault();
- if (StringUtils.isNotBlank(domainName)) {
- IngressController.configureIngress(domainName, clusterId,
namespace);
- }
- }
-}
diff --git
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/authentication/ShiroRealm.java
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/authentication/ShiroRealm.java
index 691e94e3d..b9d6afb0a 100644
---
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/authentication/ShiroRealm.java
+++
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/authentication/ShiroRealm.java
@@ -102,13 +102,19 @@ public class ShiroRealm extends AuthorizingRealm {
||
!accessToken.getToken().equals(WebUtils.encryptToken(credential))) {
throw new AuthenticationException("the openapi authorization
token is invalid");
}
- if
(AccessToken.STATUS_DISABLE.equals(accessToken.getFinalStatus())) {
+
+ if (AccessToken.STATUS_DISABLE.equals(accessToken.getStatus())) {
+ throw new AuthenticationException(
+ "the openapi authorization token is disabled, please
contact the administrator");
+ }
+
+ if (User.STATUS_LOCK.equals(accessToken.getUserStatus())) {
throw new AuthenticationException(
- "the openapi authorization token has been disabled, please
contact the administrator");
+ "the user [" + username + "] has been locked, please
contact the administrator");
}
+
SecurityUtils.getSubject().getSession().setAttribute(AccessToken.IS_API_TOKEN,
true);
}
-
return new SimpleAuthenticationInfo(credential, credential,
"streampark_shiro_realm");
}
}
diff --git
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/AccessTokenController.java
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/AccessTokenController.java
index 4d6eb0905..0fdb8f54c 100644
---
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/AccessTokenController.java
+++
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/AccessTokenController.java
@@ -23,6 +23,7 @@ import
org.apache.streampark.console.base.exception.InternalException;
import org.apache.streampark.console.core.enums.AccessTokenStateEnum;
import org.apache.streampark.console.core.util.ServiceHelper;
import org.apache.streampark.console.system.entity.AccessToken;
+import org.apache.streampark.console.system.entity.User;
import org.apache.streampark.console.system.service.AccessTokenService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
@@ -35,7 +36,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
-import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
@RestController
@@ -48,7 +48,7 @@ public class AccessTokenController {
@PostMapping(value = "create")
@RequiresPermissions("token:add")
public RestResponse createToken(
- @NotBlank(message = "{required}") Long
userId,
+ @NotNull(message = "{required}") Long
userId,
@RequestParam(required = false) String
description) throws InternalException {
return accessTokenService.create(userId, description);
}
@@ -57,17 +57,13 @@ public class AccessTokenController {
public RestResponse verifyToken() {
Long userId = ServiceHelper.getUserId();
RestResponse restResponse = RestResponse.success();
- if (userId != null) {
- AccessToken accessToken = accessTokenService.getByUserId(userId);
- if (accessToken == null) {
- restResponse.data(AccessTokenStateEnum.NULL.get());
- } else if
(AccessToken.STATUS_DISABLE.equals(accessToken.getFinalStatus())) {
- restResponse.data(AccessTokenStateEnum.INVALID.get());
- } else {
- restResponse.data(AccessTokenStateEnum.OK.get());
- }
- } else {
- restResponse.data(AccessTokenStateEnum.INVALID.get());
+ AccessToken accessToken = accessTokenService.getByUserId(userId);
+ if (accessToken == null) {
+ restResponse.data(AccessTokenStateEnum.NULL.get());
+ } else if (AccessToken.STATUS_DISABLE.equals(accessToken.getStatus()))
{
+ restResponse.data(AccessTokenStateEnum.INVALID_TOKEN.get());
+ } else if (User.STATUS_LOCK.equals(accessToken.getUserStatus())) {
+ restResponse.data(AccessTokenStateEnum.LOCKED_USER.get());
}
return restResponse;
}
@@ -87,7 +83,7 @@ public class AccessTokenController {
@DeleteMapping(value = "delete")
@RequiresPermissions("token:delete")
- public RestResponse deleteToken(@NotBlank(message = "{required}") Long
tokenId) {
+ public RestResponse deleteToken(@NotNull(message = "{required}") Long
tokenId) {
boolean res = accessTokenService.removeById(tokenId);
return RestResponse.success(res);
}
diff --git
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/MemberController.java
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/MemberController.java
index f302ae76b..337353e64 100644
---
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/MemberController.java
+++
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/MemberController.java
@@ -38,7 +38,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
-import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
import java.util.List;
@@ -70,7 +70,7 @@ public class MemberController {
}
@PostMapping("check/user")
- public RestResponse check(@NotBlank(message = "{required}") Long teamId,
String userName) {
+ public RestResponse check(@NotNull(message = "{required}") Long teamId,
String userName) {
Member result = this.memberService.getByTeamIdUserName(teamId,
userName);
return RestResponse.success(result == null);
}
diff --git
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/AccessTokenService.java
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/AccessTokenService.java
index 6cc38db89..60c7bae22 100644
---
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/AccessTokenService.java
+++
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/AccessTokenService.java
@@ -47,15 +47,6 @@ public interface AccessTokenService extends
IService<AccessToken> {
*/
IPage<AccessToken> getPage(AccessToken tokenParam, RestRequest request);
- /**
- * Check whether the incoming token is valid
- *
- * @param userId User id
- * @param token 被Checked token
- * @return Whether the token is valid
- */
- boolean checkTokenEffective(Long userId, String token);
-
/**
* Update information in token
*
diff --git
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/AccessTokenServiceImpl.java
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/AccessTokenServiceImpl.java
index 12c2fe6ea..a2a204fc1 100644
---
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/AccessTokenServiceImpl.java
+++
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/AccessTokenServiceImpl.java
@@ -89,12 +89,6 @@ public class AccessTokenServiceImpl extends
ServiceImpl<AccessTokenMapper, Acces
return page;
}
- @Override
- public boolean checkTokenEffective(Long userId, String token) {
- AccessToken res = baseMapper.selectByUserToken(userId, token);
- return res != null &&
AccessToken.STATUS_ENABLE.equals(res.getFinalStatus());
- }
-
@Override
public RestResponse toggleToken(Long tokenId) {
AccessToken tokenInfo = baseMapper.selectById(tokenId);
diff --git
a/streampark-console/streampark-console-service/src/main/resources/mapper/system/AccessTokenMapper.xml
b/streampark-console/streampark-console-service/src/main/resources/mapper/system/AccessTokenMapper.xml
index 1c4930029..a4c6a9fa7 100644
---
a/streampark-console/streampark-console-service/src/main/resources/mapper/system/AccessTokenMapper.xml
+++
b/streampark-console/streampark-console-service/src/main/resources/mapper/system/AccessTokenMapper.xml
@@ -28,13 +28,7 @@
t1.modify_time,
t1.description,
t1.status as status,
- t2.status as userStatus,
- case
- when t1.status = 1 and t2.status = 1
- then 1
- else 0
- end
- as finalStatus
+ t2.status as userStatus
</sql>
<select id="selectPage"
resultType="org.apache.streampark.console.system.entity.AccessToken"
diff --git a/streampark-console/streampark-console-webapp/src/api/index.ts
b/streampark-console/streampark-console-webapp/src/api/index.ts
index ec297e6d0..be0e995b0 100644
--- a/streampark-console/streampark-console-webapp/src/api/index.ts
+++ b/streampark-console/streampark-console-webapp/src/api/index.ts
@@ -14,12 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+import * as process from 'node:process';
+
export function baseUrl() {
- if (import.meta.env.VITE_APP_ENV) {
+ if (process.env.NODE_ENV === 'production') {
return `${location.protocol}//${location.host}`;
}
-
- const baseApi = import.meta.env.VITE_GLOB_API_URL;
-
- return baseApi ? baseApi : '';
+ return '';
}
diff --git
a/streampark-console/streampark-console-webapp/src/locales/lang/en/flink/app.ts
b/streampark-console/streampark-console-webapp/src/locales/lang/en/flink/app.ts
index e9f14bf18..445f1e082 100644
---
a/streampark-console/streampark-console-webapp/src/locales/lang/en/flink/app.ts
+++
b/streampark-console/streampark-console-webapp/src/locales/lang/en/flink/app.ts
@@ -126,8 +126,9 @@ export default {
copyStartcURL: 'App Start',
copyCancelcURL: 'App Cancel',
apiDocCenter: 'Api Doc Center',
- nullAccessToken: 'access token is null,please contact the administrator to
add.',
- invalidAccessToken: 'access token is invalid,please contact the
administrator.',
+ nullAccessToken: "The current user's token not exist, please contact the
administrator to add",
+ invalidAccessToken: 'The token is invalid, please contact the
administrator',
+ invalidTokenUser: 'The user is locked, please contact the administrator',
detailTab: {
detailTabName: {
option: 'Option',
diff --git
a/streampark-console/streampark-console-webapp/src/locales/lang/zh-CN/flink/app.ts
b/streampark-console/streampark-console-webapp/src/locales/lang/zh-CN/flink/app.ts
index 8ecaff1d0..7324c5f1f 100644
---
a/streampark-console/streampark-console-webapp/src/locales/lang/zh-CN/flink/app.ts
+++
b/streampark-console/streampark-console-webapp/src/locales/lang/zh-CN/flink/app.ts
@@ -116,8 +116,9 @@ export default {
copyStartcURL: '作业启动',
copyCancelcURL: '作业停止',
apiDocCenter: 'Api文档',
- nullAccessToken: '访问令牌为空,请联系管理员添加.',
- invalidAccessToken: '访问令牌无效,请联系管理员。',
+ nullAccessToken: '访问令牌不存在,请联系管理员添加',
+ invalidAccessToken: '访问令牌无效,请联系管理员',
+ invalidTokenUser: '当前用户已被锁定,请联系管理员',
detailTab: {
detailTabName: {
option: '选项',
diff --git
a/streampark-console/streampark-console-webapp/src/views/flink/app/components/RequestModal/index.tsx
b/streampark-console/streampark-console-webapp/src/views/flink/app/components/RequestModal/index.tsx
index a065b773f..f9572f48c 100644
---
a/streampark-console/streampark-console-webapp/src/views/flink/app/components/RequestModal/index.tsx
+++
b/streampark-console/streampark-console-webapp/src/views/flink/app/components/RequestModal/index.tsx
@@ -30,7 +30,7 @@ export default defineComponent({
emits: ['register'],
setup() {
const currentRef = ref<Recordable>({});
- const [registerModal, { closeModal, changeOkLoading }] =
useModalInner(async (data) => {
+ const [registerModal, { changeOkLoading }] = useModalInner(async (data) =>
{
currentRef.value = data;
});
const { Swal, createMessage } = useMessage();
@@ -48,14 +48,18 @@ export default defineComponent({
icon: 'error',
title: t('flink.app.detail.nullAccessToken'),
showConfirmButton: true,
- timer: 3500,
});
} else if (result === 1) {
Swal.fire({
icon: 'error',
title: t('flink.app.detail.invalidAccessToken'),
showConfirmButton: true,
- timer: 3500,
+ });
+ } else if (result === 2) {
+ Swal.fire({
+ icon: 'error',
+ title: t('flink.app.detail.invalidTokenUser'),
+ showConfirmButton: true,
});
} else {
const res = await fetchCopyCurl({
@@ -63,9 +67,8 @@ export default defineComponent({
appId: currentRef.value.app.id,
name: currentRef.value.name,
});
- copy(res);
+ await copy(res);
createMessage.success(t('flink.app.detail.detailTab.copySuccess'));
- closeModal();
}
} catch (error) {
console.log(error);
@@ -76,9 +79,10 @@ export default defineComponent({
return () => (
<>
<BasicModal
- width={900}
+ width={800}
onRegister={registerModal}
- minHeight={400}
+ minHeight={520}
+ showCancelBtn={false}
okText={t('flink.app.detail.copyCurl')}
onOk={handleCopyCurl}
v-slots={{
diff --git
a/streampark-console/streampark-console-webapp/src/views/system/token/token.data.ts
b/streampark-console/streampark-console-webapp/src/views/system/token/token.data.ts
index 1d1918e00..dbf1f9c7c 100644
---
a/streampark-console/streampark-console-webapp/src/views/system/token/token.data.ts
+++
b/streampark-console/streampark-console-webapp/src/views/system/token/token.data.ts
@@ -59,7 +59,7 @@ export const columns: BasicColumn[] = [
record.pendingStatus = false;
}
return h(Switch, {
- checked: record.userStatus === StatusEnum.On,
+ checked: record.status == StatusEnum.On,
checkedChildren: 'on',
unCheckedChildren: 'off',
loading: record.pendingStatus,
@@ -67,10 +67,9 @@ export const columns: BasicColumn[] = [
record.pendingStatus = true;
const newStatus = checked ? StatusEnum.On : StatusEnum.Off;
const { createMessage } = useMessage();
-
fetTokenStatusToggle({ tokenId: record.id })
.then(() => {
- record.userStatus = newStatus;
+ record.status = newStatus;
createMessage.success(`success`);
})
.finally(() => {