This is an automated email from the ASF dual-hosted git repository.

SbloodyS pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git


The following commit(s) were added to refs/heads/dev by this push:
     new 9492e4e0fe [Chore][API] Remove obsolete cluster query-by-code API 
(#18584)
9492e4e0fe is described below

commit 9492e4e0fefe3a060e77c3a97d9de3653b3a792a
Author: Wenjun Ruan <[email protected]>
AuthorDate: Fri Aug 28 15:09:41 2026 +0800

    [Chore][API] Remove obsolete cluster query-by-code API (#18584)
---
 docs/docs/en/guide/upgrade/incompatible.md         |  1 +
 docs/docs/zh/guide/upgrade/incompatible.md         |  1 +
 .../api/controller/ClusterController.java          | 21 ---------------------
 .../apache/dolphinscheduler/api/enums/Status.java  |  1 -
 .../api/service/ClusterService.java                |  8 --------
 .../api/service/impl/ClusterServiceImpl.java       | 22 ----------------------
 .../src/main/resources/i18n/messages.properties    |  1 -
 .../main/resources/i18n/messages_en_US.properties  |  1 -
 .../main/resources/i18n/messages_zh_CN.properties  |  1 -
 .../api/controller/ClusterControllerTest.java      | 16 +++-------------
 .../api/service/impl/ClusterServiceTest.java       | 14 --------------
 .../src/service/modules/cluster/index.ts           |  8 --------
 12 files changed, 5 insertions(+), 90 deletions(-)

diff --git a/docs/docs/en/guide/upgrade/incompatible.md 
b/docs/docs/en/guide/upgrade/incompatible.md
index 968891bcbe..9c33258091 100644
--- a/docs/docs/en/guide/upgrade/incompatible.md
+++ b/docs/docs/en/guide/upgrade/incompatible.md
@@ -49,6 +49,7 @@ This document records the incompatible updates between each 
version. You need to
 * Add the `missed_fire_policy` column to `t_ds_schedules`. Existing schedules 
default to `FIRE_ALL_MISSED` to preserve the previous Quartz `IgnoreMisfires` 
behavior. ([#18464](https://github.com/apache/dolphinscheduler/pull/18464))
 * Remove the obsolete Dynamic Task query API. 
([#18556](https://github.com/apache/dolphinscheduler/issues/18556))
 * Remove the obsolete task update-with-upstream API `PUT 
/projects/{projectCode}/task-definition/{code}/with-upstream`. 
([#18568](https://github.com/apache/dolphinscheduler/issues/18568))
+* Remove the obsolete cluster query API `GET /cluster/query-by-code`.
 * The workflow instance list APIs (`GET 
/projects/{projectCode}/workflow-instances`, `GET 
/projects/{projectCode}/workflow-instances/top-n`, `GET 
/projects/{projectCode}/workflow-instances/trigger`) no longer return the 
following properties in the response body:
   * **Removed heavy fields**: `commandParam`, `globalParams`, `historyCmd`, 
`varPool`, `stateHistory`
   * **Removed transient fields**: `stateDescList`, `workflowDefinition`, 
`dagData`, `queue`, `locations`, `dependenceScheduleTimes`
diff --git a/docs/docs/zh/guide/upgrade/incompatible.md 
b/docs/docs/zh/guide/upgrade/incompatible.md
index 5c6870fad6..54c0c8433f 100644
--- a/docs/docs/zh/guide/upgrade/incompatible.md
+++ b/docs/docs/zh/guide/upgrade/incompatible.md
@@ -49,6 +49,7 @@
 * 为 `t_ds_schedules` 表新增 `missed_fire_policy` 字段。现有定时默认使用 
`FIRE_ALL_MISSED`,以保持原有 Quartz `IgnoreMisfires` 
行为。([#18464](https://github.com/apache/dolphinscheduler/pull/18464))
 * 移除已废弃的 Dynamic Task 
查询接口。([#18556](https://github.com/apache/dolphinscheduler/issues/18556))
 * 移除已废弃的任务及其上游关系更新接口 `PUT 
/projects/{projectCode}/task-definition/{code}/with-upstream`。([#18568](https://github.com/apache/dolphinscheduler/issues/18568))
+* 移除已废弃的集群查询接口 `GET /cluster/query-by-code`。
 * 工作流实例列表接口(`GET /projects/{projectCode}/workflow-instances`、`GET 
/projects/{projectCode}/workflow-instances/top-n`、`GET 
/projects/{projectCode}/workflow-instances/trigger`)的响应体不再返回以下属性:
   * 
**移除的大字段**:`commandParam`、`globalParams`、`historyCmd`、`varPool`、`stateHistory`
   * 
**移除的非数据库字段**:`stateDescList`、`workflowDefinition`、`dagData`、`queue`、`locations`、`dependenceScheduleTimes`
diff --git 
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ClusterController.java
 
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ClusterController.java
index a47eaba885..960eb084c4 100644
--- 
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ClusterController.java
+++ 
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ClusterController.java
@@ -19,7 +19,6 @@ package org.apache.dolphinscheduler.api.controller;
 
 import static 
org.apache.dolphinscheduler.api.enums.Status.CREATE_CLUSTER_ERROR;
 import static 
org.apache.dolphinscheduler.api.enums.Status.DELETE_CLUSTER_ERROR;
-import static 
org.apache.dolphinscheduler.api.enums.Status.QUERY_CLUSTER_BY_CODE_ERROR;
 import static org.apache.dolphinscheduler.api.enums.Status.QUERY_CLUSTER_ERROR;
 import static 
org.apache.dolphinscheduler.api.enums.Status.UPDATE_CLUSTER_ERROR;
 import static 
org.apache.dolphinscheduler.api.enums.Status.VERIFY_CLUSTER_ERROR;
@@ -120,26 +119,6 @@ public class ClusterController extends BaseController {
         return Result.success(cluster);
     }
 
-    /**
-     * query cluster details by code
-     *
-     * @param clusterCode cluster code
-     * @return cluster detail information
-     */
-    @Operation(summary = "queryClusterByCode", description = 
"QUERY_CLUSTER_BY_CODE_NOTES")
-    @Parameters({
-            @Parameter(name = "clusterCode", description = "CLUSTER_CODE", 
required = true, schema = @Schema(implementation = long.class, example = "100"))
-    })
-    @GetMapping(value = "/query-by-code")
-    @ResponseStatus(HttpStatus.OK)
-    @ApiException(QUERY_CLUSTER_BY_CODE_ERROR)
-    public Result<ClusterDto> queryClusterByCode(@Parameter(hidden = true) 
@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
-                                                 @RequestParam("clusterCode") 
Long clusterCode) {
-
-        ClusterDto clusterDto = clusterService.queryClusterByCode(loginUser, 
clusterCode);
-        return Result.success(clusterDto);
-    }
-
     /**
      * query cluster list paging
      *
diff --git 
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java
 
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java
index 05f951a16e..ef413cc9e3 100644
--- 
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java
+++ 
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java
@@ -493,7 +493,6 @@ public enum Status {
     DELETE_CLUSTER_RELATED_TASK_EXISTS(120026, "this cluster has been used in 
tasks,so you can't delete it.",
             "该集群已经被任务使用,所以不能删除该集群信息"),
     QUERY_CLUSTER_BY_NAME_ERROR(1200027, "not found cluster [{0}] ", 
"查询集群名称[{0}]信息不存在"),
-    QUERY_CLUSTER_BY_CODE_ERROR(1200028, "not found cluster [{0}] ", 
"查询集群编码[{0}]不存在"),
     QUERY_CLUSTER_ERROR(1200029, "login user query cluster error", 
"分页查询集群列表错误"),
     VERIFY_CLUSTER_ERROR(1200030, "verify cluster error", "验证集群信息错误"),
     CLUSTER_WORKFLOW_DEFINITIONS_IS_INVALID(1200031, "cluster worker groups is 
invalid format", "集群关联的工作组参数解析错误"),
diff --git 
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ClusterService.java
 
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ClusterService.java
index d4c4c1d174..a7c2d1bb16 100644
--- 
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ClusterService.java
+++ 
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ClusterService.java
@@ -44,14 +44,6 @@ public interface ClusterService {
      */
     ClusterDto queryClusterByName(String name);
 
-    /**
-     * query cluster
-     *
-     * @param loginUser login user
-     * @param code      cluster code
-     */
-    ClusterDto queryClusterByCode(User loginUser, Long code);
-
     /**
      * delete cluster
      *
diff --git 
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ClusterServiceImpl.java
 
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ClusterServiceImpl.java
index b7e45b53ac..718e8c2b94 100644
--- 
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ClusterServiceImpl.java
+++ 
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ClusterServiceImpl.java
@@ -164,28 +164,6 @@ public class ClusterServiceImpl extends BaseServiceImpl 
implements ClusterServic
                 }).collect(Collectors.toList());
     }
 
-    /**
-     * query cluster
-     *
-     * @param loginUser login user
-     * @param code      cluster code
-     */
-    @Override
-    public ClusterDto queryClusterByCode(User loginUser, Long code) {
-        if (isNotAdmin(loginUser)) {
-            throw new ServiceException(Status.USER_NO_OPERATION_PERM);
-        }
-
-        Cluster cluster = clusterDao.queryByClusterCode(code);
-
-        if (cluster == null) {
-            throw new ServiceException(Status.QUERY_CLUSTER_BY_CODE_ERROR, 
code);
-        }
-        ClusterDto dto = new ClusterDto();
-        BeanUtils.copyProperties(cluster, dto);
-        return dto;
-    }
-
     /**
      * query cluster
      *
diff --git a/dolphinscheduler-api/src/main/resources/i18n/messages.properties 
b/dolphinscheduler-api/src/main/resources/i18n/messages.properties
index fd135b7093..33502f63c6 100644
--- a/dolphinscheduler-api/src/main/resources/i18n/messages.properties
+++ b/dolphinscheduler-api/src/main/resources/i18n/messages.properties
@@ -259,7 +259,6 @@ CLUSTER_DESC=cluster description
 UPDATE_CLUSTER_NOTES=update cluster
 CLUSTER_CODE=cluster code
 CLUSTER_CONFIG=cluster configuration
-QUERY_CLUSTER_BY_CODE_NOTES=query cluster by code
 QUERY_CLUSTER_LIST_PAGING_NOTES=query cluster list paging
 DELETE_CLUSTER_BY_CODE_NOTES=delete cluster by code
 QUERY_ALL_CLUSTER_LIST_NOTES=query all cluster list
diff --git 
a/dolphinscheduler-api/src/main/resources/i18n/messages_en_US.properties 
b/dolphinscheduler-api/src/main/resources/i18n/messages_en_US.properties
index 434e88e1cf..b078819c17 100644
--- a/dolphinscheduler-api/src/main/resources/i18n/messages_en_US.properties
+++ b/dolphinscheduler-api/src/main/resources/i18n/messages_en_US.properties
@@ -292,7 +292,6 @@ CLUSTER_DESC=cluster description
 UPDATE_CLUSTER_NOTES=update cluster
 CLUSTER_CODE=cluster code
 CLUSTER_CONFIG=cluster configuration
-QUERY_CLUSTER_BY_CODE_NOTES=query cluster by code
 QUERY_CLUSTER_LIST_PAGING_NOTES=query cluster list paging
 DELETE_CLUSTER_BY_CODE_NOTES=delete cluster by code
 QUERY_ALL_CLUSTER_LIST_NOTES=query all cluster list
diff --git 
a/dolphinscheduler-api/src/main/resources/i18n/messages_zh_CN.properties 
b/dolphinscheduler-api/src/main/resources/i18n/messages_zh_CN.properties
index 09bf14f011..644d637eef 100644
--- a/dolphinscheduler-api/src/main/resources/i18n/messages_zh_CN.properties
+++ b/dolphinscheduler-api/src/main/resources/i18n/messages_zh_CN.properties
@@ -290,7 +290,6 @@ CLUSTER_DESC=\u96C6\u7FA4\u63CF\u8FF0
 UPDATE_CLUSTER_NOTES=\u66F4\u65B0\u96C6\u7FA4
 CLUSTER_CODE=\u96C6\u7FA4\u4EE3\u7801
 CLUSTER_CONFIG=\u96C6\u7FA4\u914D\u7F6E
-QUERY_CLUSTER_BY_CODE_NOTES=\u901A\u8FC7\u96C6\u7FA4ID\u67E5\u8BE2\u96C6\u7FA4
 
QUERY_CLUSTER_LIST_PAGING_NOTES=\u67E5\u8BE2\u96C6\u7FA4\u5206\u9875\u5217\u8868
 
DELETE_CLUSTER_BY_CODE_NOTES=\u901A\u8FC7\u96C6\u7FA4\u4EE3\u7801\u5220\u9664\u96C6\u7FA4
 QUERY_ALL_CLUSTER_LIST_NOTES=\u67E5\u8BE2\u6240\u6709\u96C6\u7FA4\u5217\u8868
diff --git 
a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ClusterControllerTest.java
 
b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ClusterControllerTest.java
index 5c6088d649..fa88dc4401 100644
--- 
a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ClusterControllerTest.java
+++ 
b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ClusterControllerTest.java
@@ -107,24 +107,14 @@ public class ClusterControllerTest extends 
AbstractControllerTest {
     }
 
     @Test
-    public void testQueryClusterByCode() throws Exception {
+    public void testQueryClusterByCodeIsNotExposed() throws Exception {
         MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>();
         paramsMap.add("clusterCode", clusterCode);
 
-        MvcResult mvcResult = mockMvc.perform(get("/cluster/query-by-code")
+        mockMvc.perform(get("/cluster/query-by-code")
                 .header(SESSION_ID, sessionId)
                 .params(paramsMap))
-                .andExpect(status().isOk())
-                .andExpect(content().contentType(MediaType.APPLICATION_JSON))
-                .andReturn();
-
-        Result result = 
JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), 
Result.class);
-        logger.info(result.toString());
-        Assertions.assertTrue(result != null && result.isSuccess());
-        logger.info(mvcResult.getResponse().getContentAsString());
-        logger.info("query cluster by id :{}, return result:{}", clusterCode,
-                mvcResult.getResponse().getContentAsString());
-
+                .andExpect(status().isNotFound());
     }
 
     @Test
diff --git 
a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/impl/ClusterServiceTest.java
 
b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/impl/ClusterServiceTest.java
index 381ec66205..2f48303db9 100644
--- 
a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/impl/ClusterServiceTest.java
+++ 
b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/impl/ClusterServiceTest.java
@@ -175,20 +175,6 @@ public class ClusterServiceTest {
         assertNotNull(clusterDto);
     }
 
-    @Test
-    public void testQueryClusterByCode() {
-        assertThrowsServiceException(Status.USER_NO_OPERATION_PERM,
-                () -> clusterService.queryClusterByCode(getGeneralUser(), 1L));
-
-        when(clusterDao.queryByClusterCode(1L)).thenReturn(null);
-        assertThrowsServiceException(Status.QUERY_CLUSTER_BY_CODE_ERROR,
-                () -> clusterService.queryClusterByCode(getAdminUser(), 1L));
-
-        when(clusterDao.queryByClusterCode(1L)).thenReturn(getCluster());
-        ClusterDto clusterDto = 
clusterService.queryClusterByCode(getAdminUser(), 1L);
-        assertNotNull(clusterDto);
-    }
-
     @Test
     public void testDeleteClusterByCode() {
         assertThrowsServiceException(Status.USER_NO_OPERATION_PERM, () -> {
diff --git a/dolphinscheduler-ui/src/service/modules/cluster/index.ts 
b/dolphinscheduler-ui/src/service/modules/cluster/index.ts
index e941443aaa..94027d26ae 100644
--- a/dolphinscheduler-ui/src/service/modules/cluster/index.ts
+++ b/dolphinscheduler-ui/src/service/modules/cluster/index.ts
@@ -48,14 +48,6 @@ export function queryClusterListPaging(params: ListReq): any 
{
   })
 }
 
-export function queryClusterByCode(params: ClusterCodeReq): any {
-  return axios({
-    url: '/cluster/query-by-code',
-    method: 'get',
-    params
-  })
-}
-
 export function queryAllClusterList(): any {
   return axios({
     url: '/cluster/query-cluster-list',

Reply via email to