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

benjobs pushed a commit to branch dev-2.1.5
in repository https://gitbox.apache.org/repos/asf/incubator-streampark.git


The following commit(s) were added to refs/heads/dev-2.1.5 by this push:
     new f25fe894a [Feat] git clone by tag support. (#4009)
f25fe894a is described below

commit f25fe894a5285992e54928383d161097ba016393
Author: benjobs <[email protected]>
AuthorDate: Fri Aug 30 18:30:33 2024 +0800

    [Feat] git clone by tag support. (#4009)
    
    * [Feat] git clone by tag support.
    
    * [Improve] ddl sql impovement
    
    * [Improve] new icon add
---
 .../main/assembly/script/schema/mysql-schema.sql   |  2 +-
 .../main/assembly/script/schema/pgsql-schema.sql   |  2 +-
 .../main/assembly/script/upgrade/mysql/2.1.5.sql   |  3 ++
 .../main/assembly/script/upgrade/pgsql/2.1.5.sql   |  7 ++++
 .../streampark/console/base/util/GitUtils.java     | 39 +++++++++++++-------
 .../console/core/controller/ProjectController.java |  7 +++-
 .../streampark/console/core/entity/Project.java    | 23 ++++++++----
 .../core/service/impl/ProjectServiceImpl.java      |  2 +-
 .../console/core/task/ProjectBuildTask.java        |  6 ++--
 .../src/main/resources/db/schema-h2.sql            |  2 +-
 .../main/resources/mapper/core/ProjectMapper.xml   | 20 -----------
 .../src/api/flink/project/index.ts                 |  2 +-
 .../src/api/flink/project/model/projectModel.ts    |  2 +-
 .../src/assets/icons/branch.svg                    |  1 +
 .../src/assets/icons/tag.svg                       |  1 +
 .../src/locales/lang/en/flink/app.ts               |  2 +-
 .../src/locales/lang/en/flink/project.ts           |  4 +--
 .../src/locales/lang/zh-CN/flink/project.ts        |  4 +--
 .../src/views/flink/app/Detail.vue                 |  2 +-
 .../src/views/flink/app/View.vue                   |  2 +-
 .../src/views/flink/project/Add.vue                |  2 +-
 .../src/views/flink/project/Edit.vue               |  2 +-
 .../views/flink/project/components/ListItem.vue    | 13 +++++--
 .../src/views/flink/project/useProject.tsx         | 42 ++++++++++++++--------
 24 files changed, 118 insertions(+), 74 deletions(-)

diff --git 
a/streampark-console/streampark-console-service/src/main/assembly/script/schema/mysql-schema.sql
 
b/streampark-console/streampark-console-service/src/main/assembly/script/schema/mysql-schema.sql
index c7958e792..adf880442 100644
--- 
a/streampark-console/streampark-console-service/src/main/assembly/script/schema/mysql-schema.sql
+++ 
b/streampark-console/streampark-console-service/src/main/assembly/script/schema/mysql-schema.sql
@@ -184,7 +184,7 @@ create table `t_flink_project` (
   `team_id` bigint not null,
   `name` varchar(255) collate utf8mb4_general_ci default null,
   `url` varchar(255) collate utf8mb4_general_ci default null,
-  `branches` varchar(64) collate utf8mb4_general_ci default null,
+  `refs` varchar(255) collate utf8mb4_general_ci default null,
   `user_name` varchar(64) collate utf8mb4_general_ci default null,
   `password` varchar(64) collate utf8mb4_general_ci default null,
   `prvkey_path` varchar(128) collate utf8mb4_general_ci default null,
diff --git 
a/streampark-console/streampark-console-service/src/main/assembly/script/schema/pgsql-schema.sql
 
b/streampark-console/streampark-console-service/src/main/assembly/script/schema/pgsql-schema.sql
index 9feeef00b..1217ccbf0 100644
--- 
a/streampark-console/streampark-console-service/src/main/assembly/script/schema/pgsql-schema.sql
+++ 
b/streampark-console/streampark-console-service/src/main/assembly/script/schema/pgsql-schema.sql
@@ -421,7 +421,7 @@ create table "public"."t_flink_project" (
   "team_id" int8,
   "name" varchar(255) collate "pg_catalog"."default",
   "url" varchar(255) collate "pg_catalog"."default",
-  "branches" varchar(64) collate "pg_catalog"."default",
+  "refs" varchar(64) collate "pg_catalog"."default",
   "user_name" varchar(64) collate "pg_catalog"."default",
   "password" varchar(64) collate "pg_catalog"."default",
   "prvkey_path" varchar(128) collate "pg_catalog"."default",
diff --git 
a/streampark-console/streampark-console-service/src/main/assembly/script/upgrade/mysql/2.1.5.sql
 
b/streampark-console/streampark-console-service/src/main/assembly/script/upgrade/mysql/2.1.5.sql
index bc13c069f..654a3592d 100644
--- 
a/streampark-console/streampark-console-service/src/main/assembly/script/upgrade/mysql/2.1.5.sql
+++ 
b/streampark-console/streampark-console-service/src/main/assembly/script/upgrade/mysql/2.1.5.sql
@@ -19,3 +19,6 @@ use streampark;
 
 ALTER TABLE `t_external_link`
     MODIFY `link_url` text collate utf8mb4_general_ci default null;
+
+ALTER TABLE `t_flink_project`
+    change column `branches` `refs` varchar(255) collate utf8mb4_general_ci 
default null;
diff --git 
a/streampark-console/streampark-console-service/src/main/assembly/script/upgrade/pgsql/2.1.5.sql
 
b/streampark-console/streampark-console-service/src/main/assembly/script/upgrade/pgsql/2.1.5.sql
index f8f753f99..84f445976 100644
--- 
a/streampark-console/streampark-console-service/src/main/assembly/script/upgrade/pgsql/2.1.5.sql
+++ 
b/streampark-console/streampark-console-service/src/main/assembly/script/upgrade/pgsql/2.1.5.sql
@@ -17,3 +17,10 @@
 
 ALTER TABLE "public"."t_external_link"
     ALTER COLUMN "link_url" TYPE text collate "pg_catalog"."default";
+
+ALTER TABLE "public"."t_flink_project"
+    ALTER COLUMN "branches" TYPE varchar(255) collate "pg_catalog"."default";
+
+ALTER TABLE "public"."t_flink_project"
+    rename column "branches" to "refs";
+
diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/util/GitUtils.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/util/GitUtils.java
index bfee0ab95..4846f4cb3 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/util/GitUtils.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/util/GitUtils.java
@@ -59,7 +59,6 @@ public class GitUtils {
         cloneCommand.setBranchesToClone(
             Collections.singletonList(Constants.R_HEADS + 
request.getBranch()));
       }
-
       Git git = cloneCommand.call();
       if (StringUtils.isNotBlank(request.getBranch())) {
         git.checkout().setName(request.getBranch()).call();
@@ -70,7 +69,7 @@ public class GitUtils {
       }
       return git;
     } catch (Exception e) {
-      if (e instanceof InvalidRemoteException && request.getAuthType() == 
GitAuthType.HTTP) {
+      if (e instanceof InvalidRemoteException && request.getConnType() == 
GitConnType.HTTP) {
         String url = httpUrlToSSH(request.getUrl());
         request.setUrl(url);
         return clone(request);
@@ -94,7 +93,7 @@ public class GitUtils {
       }
       return branchList;
     } catch (Exception e) {
-      if (e instanceof InvalidRemoteException && request.getAuthType() == 
GitAuthType.HTTP) {
+      if (e instanceof InvalidRemoteException && request.getConnType() == 
GitConnType.HTTP) {
         String url = httpUrlToSSH(request.getUrl());
         request.setUrl(url);
         return getBranches(request);
@@ -108,17 +107,17 @@ public class GitUtils {
       LsRemoteCommand command = 
Git.lsRemoteRepository().setRemote(request.getUrl()).setTags(true);
       setCredentials(command, request);
       Collection<Ref> refList = command.call();
-      List<String> branchList = new ArrayList<>(4);
+      List<String> tagList = new ArrayList<>(4);
       for (Ref ref : refList) {
         String refName = ref.getName();
         if (refName.startsWith(Constants.R_TAGS)) {
           String branchName = refName.replace(Constants.R_TAGS, "");
-          branchList.add(branchName);
+          tagList.add(branchName);
         }
       }
-      return branchList;
+      return tagList;
     } catch (Exception e) {
-      if (e instanceof InvalidRemoteException && request.getAuthType() == 
GitAuthType.HTTP) {
+      if (e instanceof InvalidRemoteException && request.getConnType() == 
GitConnType.HTTP) {
         String url = httpUrlToSSH(request.getUrl());
         request.setUrl(url);
         return getTags(request);
@@ -141,7 +140,7 @@ public class GitUtils {
 
   private static void setCredentials(
       TransportCommand<?, ?> transportCommand, GitAuthRequest request) {
-    switch (request.authType) {
+    switch (request.connType) {
       case HTTP:
         if (!StringUtils.isAllEmpty(request.getUsername(), 
request.getPassword())) {
           UsernamePasswordCredentialsProvider credentialsProvider =
@@ -194,7 +193,7 @@ public class GitUtils {
   }
 
   @Getter
-  public enum GitAuthType {
+  public enum GitConnType {
     HTTP,
     SSH
   }
@@ -202,7 +201,7 @@ public class GitUtils {
   @Getter
   @Setter
   public static class GitAuthRequest {
-    private GitAuthType authType;
+    private GitConnType connType;
     private String username;
     private String password;
     private String privateKey;
@@ -219,9 +218,9 @@ public class GitUtils {
       }
       this.url = url;
       if (GitUtils.isSshRepositoryUrl(url)) {
-        setAuthType(GitAuthType.SSH);
+        setConnType(GitConnType.SSH);
       } else {
-        setAuthType(GitAuthType.HTTP);
+        setConnType(GitConnType.HTTP);
       }
     }
   }
@@ -232,5 +231,21 @@ public class GitUtils {
     private File storeDir;
     private String branch;
     private String tag;
+
+    public void setRefs(String refs) {
+      if (StringUtils.isNotBlank(refs)) {
+        if (!refs.startsWith(Constants.R_REFS)) {
+          this.branch = refs;
+          return;
+        }
+        if (refs.startsWith(Constants.R_HEADS)) {
+          this.branch = refs.replace(Constants.R_HEADS, "");
+          return;
+        }
+        if (refs.startsWith(Constants.R_TAGS)) {
+          this.tag = refs.replace(Constants.R_TAGS, "");
+        }
+      }
+    }
   }
 }
diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/controller/ProjectController.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/controller/ProjectController.java
index accfef5a4..33a3b5828 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/controller/ProjectController.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/controller/ProjectController.java
@@ -38,6 +38,7 @@ import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -106,7 +107,11 @@ public class ProjectController {
   @PermissionScope(team = "#project.teamId")
   public RestResponse branches(Project project) {
     List<String> branches = projectService.getAllBranches(project);
-    return RestResponse.success().data(branches);
+    List<String> tags = projectService.getAllTags(project);
+    Map<String, List<String>> refs = new HashMap<>();
+    refs.put("tags", tags);
+    refs.put("branches", branches);
+    return RestResponse.success().data(refs);
   }
 
   @PostMapping("delete")
diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/entity/Project.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/entity/Project.java
index 51c06f0dd..dc0f23c63 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/entity/Project.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/entity/Project.java
@@ -61,8 +61,8 @@ public class Project implements Serializable {
 
   private String url;
 
-  /** git branch */
-  private String branches;
+  /** git branch or tag */
+  private String refs;
 
   private Date lastBuild;
 
@@ -131,7 +131,16 @@ public class Project implements Serializable {
   }
 
   private String getSourceDirName() {
-    String branches = this.getBranches() == null ? "main" : this.getBranches();
+    String branches = "main";
+    if (StringUtils.isNotBlank(this.refs)) {
+      if (this.refs.startsWith(Constants.R_HEADS)) {
+        branches = this.refs.replace(Constants.R_HEADS, "");
+      } else if (this.refs.startsWith(Constants.R_TAGS)) {
+        branches = this.refs.replace(Constants.R_TAGS, "");
+      } else {
+        branches = this.refs;
+      }
+    }
     String rootName = url.replaceAll(".*/|\\.git|\\.svn", "");
     return rootName.concat("-").concat(branches);
   }
@@ -269,15 +278,15 @@ public class Project implements Serializable {
   @JsonIgnore
   public String getLog4BuildStart() {
     return String.format(
-        "%sproject : %s\nbranches: %s\ncommand : %s\n\n",
-        getLogHeader("maven install"), getName(), getBranches(), 
getMavenArgs());
+        "%sproject : %s\nrefs: %s\ncommand : %s\n\n",
+        getLogHeader("maven install"), getName(), getRefs(), getMavenArgs());
   }
 
   @JsonIgnore
   public String getLog4CloneStart() {
     return String.format(
-        "%sproject  : %s\nbranches : %s\nworkspace: %s\n\n",
-        getLogHeader("git clone"), getName(), getBranches(), getAppSource());
+        "%sproject  : %s\nrefs : %s\nworkspace: %s\n\n",
+        getLogHeader("git clone"), getName(), getRefs(), getAppSource());
   }
 
   @JsonIgnore
diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/ProjectServiceImpl.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/ProjectServiceImpl.java
index c82a7006d..4101163eb 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/ProjectServiceImpl.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/ProjectServiceImpl.java
@@ -131,7 +131,7 @@ public class ProjectServiceImpl extends 
ServiceImpl<ProjectMapper, Project>
         "The project is being built, update project failed.");
     project.setName(projectParam.getName());
     project.setUrl(projectParam.getUrl());
-    project.setBranches(projectParam.getBranches());
+    project.setRefs(projectParam.getRefs());
     project.setPrvkeyPath(projectParam.getPrvkeyPath());
     project.setUserName(projectParam.getUserName());
     project.setPassword(projectParam.getPassword());
diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/task/ProjectBuildTask.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/task/ProjectBuildTask.java
index 4859f4f2a..329f47247 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/task/ProjectBuildTask.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/task/ProjectBuildTask.java
@@ -93,7 +93,7 @@ public class ProjectBuildTask extends AbstractLogFileTask {
 
       GitUtils.GitCloneRequest request = new GitUtils.GitCloneRequest();
       request.setUrl(project.getUrl());
-      request.setBranch(project.getBranches());
+      request.setRefs(project.getRefs());
       request.setStoreDir(project.getAppSource());
       request.setUsername(project.getUserName());
       request.setPassword(project.getPassword());
@@ -114,8 +114,8 @@ public class ProjectBuildTask extends AbstractLogFileTask {
     } catch (Exception e) {
       fileLogger.error(
           String.format(
-              "[StreamPark] project [%s] branch [%s] git clone failed, err: 
%s",
-              project.getName(), project.getBranches(), e));
+              "[StreamPark] project [%s] refs [%s] git clone failed, err: %s",
+              project.getName(), project.getRefs(), e));
       fileLogger.error(String.format("project %s clone error ", 
project.getName()), e);
       return false;
     }
diff --git 
a/streampark-console/streampark-console-service/src/main/resources/db/schema-h2.sql
 
b/streampark-console/streampark-console-service/src/main/resources/db/schema-h2.sql
index 0816a78f1..bdf5fac3b 100644
--- 
a/streampark-console/streampark-console-service/src/main/resources/db/schema-h2.sql
+++ 
b/streampark-console/streampark-console-service/src/main/resources/db/schema-h2.sql
@@ -165,7 +165,7 @@ create table if not exists `t_flink_project` (
   `team_id` bigint not null,
   `name` varchar(255) default null,
   `url` varchar(255) default null,
-  `branches` varchar(64) default null,
+  `refs` varchar(255) default null,
   `user_name` varchar(64) default null,
   `password` varchar(64) default null,
   `prvkey_path` varchar(128) default null,
diff --git 
a/streampark-console/streampark-console-service/src/main/resources/mapper/core/ProjectMapper.xml
 
b/streampark-console/streampark-console-service/src/main/resources/mapper/core/ProjectMapper.xml
index a221b3bd8..241849f52 100644
--- 
a/streampark-console/streampark-console-service/src/main/resources/mapper/core/ProjectMapper.xml
+++ 
b/streampark-console/streampark-console-service/src/main/resources/mapper/core/ProjectMapper.xml
@@ -18,26 +18,6 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 
"http://mybatis.org/dtd/mybatis-3-mapper.dtd";>
 <mapper namespace="org.apache.streampark.console.core.mapper.ProjectMapper">
 
-    <resultMap id="BaseResultMap" 
type="org.apache.streampark.console.core.entity.Project">
-        <id column="id" jdbcType="INTEGER" property="id"/>
-        <result column="team_id" jdbcType="BIGINT" property="teamId"/>
-        <result column="name" jdbcType="VARCHAR" property="name"/>
-        <result column="url" jdbcType="VARCHAR" property="url"/>
-        <result column="repository" jdbcType="INTEGER" property="repository"/>
-        <result column="branches" jdbcType="VARCHAR" property="branches"/>
-        <result column="user_name" jdbcType="VARCHAR" property="userName"/>
-        <result column="password" jdbcType="VARCHAR" property="password"/>
-        <result column="prvkey_path" jdbcType="VARCHAR" property="prvkeyPath"/>
-        <result column="pom" jdbcType="VARCHAR" property="pom"/>
-        <result column="build_args" jdbcType="VARCHAR" property="buildArgs"/>
-        <result column="type" jdbcType="INTEGER" property="type"/>
-        <result column="description" jdbcType="VARCHAR" 
property="description"/>
-        <result column="last_build" jdbcType="TIMESTAMP" property="lastBuild"/>
-        <result column="build_state" jdbcType="INTEGER" property="buildState"/>
-        <result column="create_time" jdbcType="TIMESTAMP" 
property="createTime"/>
-        <result column="modify_time" jdbcType="TIMESTAMP" 
property="modifyTime"/>
-    </resultMap>
-
     <select id="existsByTeamId" resultType="java.lang.Boolean" 
parameterType="java.lang.Long">
         select
             CASE
diff --git 
a/streampark-console/streampark-console-webapp/src/api/flink/project/index.ts 
b/streampark-console/streampark-console-webapp/src/api/flink/project/index.ts
index 341e5f46d..e2d27b412 100644
--- 
a/streampark-console/streampark-console-webapp/src/api/flink/project/index.ts
+++ 
b/streampark-console/streampark-console-webapp/src/api/flink/project/index.ts
@@ -64,7 +64,7 @@ export function gitCheck(data: Recordable) {
  * @param data
  * @returns
  */
-export function fetchBranches(data: Recordable): Promise<string[]> {
+export function fetchBranches(data: Recordable): Promise<AxiosResponse<any>> {
   return defHttp.post({
     url: Api.BRANCHES,
     data,
diff --git 
a/streampark-console/streampark-console-webapp/src/api/flink/project/model/projectModel.ts
 
b/streampark-console/streampark-console-webapp/src/api/flink/project/model/projectModel.ts
index 38efe538a..a74e2adb7 100644
--- 
a/streampark-console/streampark-console-webapp/src/api/flink/project/model/projectModel.ts
+++ 
b/streampark-console/streampark-console-webapp/src/api/flink/project/model/projectModel.ts
@@ -22,7 +22,7 @@ export interface ProjectRecord {
   id: string;
   name: string;
   url: string;
-  branches: string;
+  refs: string;
   lastBuild?: any;
   userName?: any;
   password?: any;
diff --git 
a/streampark-console/streampark-console-webapp/src/assets/icons/branch.svg 
b/streampark-console/streampark-console-webapp/src/assets/icons/branch.svg
new file mode 100644
index 000000000..b7d84d483
--- /dev/null
+++ b/streampark-console/streampark-console-webapp/src/assets/icons/branch.svg
@@ -0,0 +1 @@
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 
1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd";><svg 
t="1725013294821" class="icon" viewBox="0 0 1024 1024" version="1.1" 
xmlns="http://www.w3.org/2000/svg"; p-id="16212" 
xmlns:xlink="http://www.w3.org/1999/xlink"; width="200" height="200"><path 
d="M746.666667 170.666667C664.32 170.666667 597.333333 237.653333 597.333333 
320c0 66.304 43.733333 121.984 103.68 141.44-6.229333 39.765333-23.338667 
72.533333- [...]
\ No newline at end of file
diff --git 
a/streampark-console/streampark-console-webapp/src/assets/icons/tag.svg 
b/streampark-console/streampark-console-webapp/src/assets/icons/tag.svg
new file mode 100644
index 000000000..c2eb82030
--- /dev/null
+++ b/streampark-console/streampark-console-webapp/src/assets/icons/tag.svg
@@ -0,0 +1 @@
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 
1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd";><svg 
t="1725013199293" class="icon" viewBox="0 0 1024 1024" version="1.1" 
xmlns="http://www.w3.org/2000/svg"; p-id="13522" 
xmlns:xlink="http://www.w3.org/1999/xlink"; width="200" height="200"><path 
d="M323.008 786.752c-52.928 0-96-43.072-96-96s43.072-96 96-96 96 43.072 96 
96S375.936 786.752 323.008 786.752zM323.008 658.752c-17.632 0-32 14.336-32 
32s14.368 3 [...]
\ No newline at end of file
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 e55f53ec9..5512b01b7 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
@@ -124,7 +124,7 @@ export default {
     copyStartcURL: 'App Start',
     copyCancelcURL: 'App Cancel',
     apiDocCenter: 'Api Doc Center',
-    nullAccessToken: "The current user have no token, please contact the admin 
to add",
+    nullAccessToken: 'The current user have no token, please contact the admin 
to add',
     invalidAccessToken: 'access token is invalid, please contact the admin',
     invalidTokenUser: 'the user is locked, please contact the admin',
     detailTab: {
diff --git 
a/streampark-console/streampark-console-webapp/src/locales/lang/en/flink/project.ts
 
b/streampark-console/streampark-console-webapp/src/locales/lang/en/flink/project.ts
index ebdd2c42d..b9a44d282 100644
--- 
a/streampark-console/streampark-console-webapp/src/locales/lang/en/flink/project.ts
+++ 
b/streampark-console/streampark-console-webapp/src/locales/lang/en/flink/project.ts
@@ -43,8 +43,8 @@ export default {
     userNamePlaceholder: 'UserName for this project',
     password: 'Password',
     passwordPlaceholder: 'Password for this project',
-    branches: 'Branches',
-    branchesPlaceholder: 'Select a branch',
+    branches: 'Branch/Tag',
+    branchesPlaceholder: 'Select by branch or tag',
     pom: 'POM',
     pomPlaceholder:
       'By default,lookup pom.xml in root path,You can manually specify the 
module to compile pom.xml',
diff --git 
a/streampark-console/streampark-console-webapp/src/locales/lang/zh-CN/flink/project.ts
 
b/streampark-console/streampark-console-webapp/src/locales/lang/zh-CN/flink/project.ts
index 7d077a5d6..c656a93f6 100644
--- 
a/streampark-console/streampark-console-webapp/src/locales/lang/zh-CN/flink/project.ts
+++ 
b/streampark-console/streampark-console-webapp/src/locales/lang/zh-CN/flink/project.ts
@@ -44,8 +44,8 @@ export default {
     userNamePlaceholder: '请输入(访问)该项目仓库的用户名',
     password: '密码',
     passwordPlaceholder: '请输入(访问)该项目仓库的密码',
-    branches: '项目分支',
-    branchesPlaceholder: '请选择分支',
+    branches: 'Branch/Tag',
+    branchesPlaceholder: '请选择 Branch 或 Tag',
     pom: 'POM依赖',
     pomPlaceholder: '默认情况下,在根路径中查找pom.xml,你可以手动指定模块来编译pom.xml',
     buildArgs: '构建(项目)参数',
diff --git 
a/streampark-console/streampark-console-webapp/src/views/flink/app/Detail.vue 
b/streampark-console/streampark-console-webapp/src/views/flink/app/Detail.vue
index 3bb1377f5..46d119e1e 100644
--- 
a/streampark-console/streampark-console-webapp/src/views/flink/app/Detail.vue
+++ 
b/streampark-console/streampark-console-webapp/src/views/flink/app/Detail.vue
@@ -25,7 +25,7 @@
   import { Icon } from '/@/components/Icon';
   import { useRoute, useRouter } from 'vue-router';
   import { fetchGet, fetchOptionLog, fetchYarn } from '/@/api/flink/app/app';
-  import { onUnmounted, reactive, h, unref, ref, onMounted, computed } from 
'vue';
+  import { onUnmounted, reactive, h, ref, onMounted, computed } from 'vue';
   import { useIntervalFn } from '@vueuse/core';
   import { AppListRecord } from '/@/api/flink/app/app.type';
   import { Tooltip, Divider, Space } from 'ant-design-vue';
diff --git 
a/streampark-console/streampark-console-webapp/src/views/flink/app/View.vue 
b/streampark-console/streampark-console-webapp/src/views/flink/app/View.vue
index a5ce1e531..6c6c7708d 100644
--- a/streampark-console/streampark-console-webapp/src/views/flink/app/View.vue
+++ b/streampark-console/streampark-console-webapp/src/views/flink/app/View.vue
@@ -20,7 +20,7 @@
   });
 </script>
 <script lang="ts" setup name="AppView">
-  import { defineComponent, nextTick, ref, unref, onUnmounted, onMounted } 
from 'vue';
+  import { defineComponent, nextTick, ref, onUnmounted, onMounted } from 'vue';
   import { useAppTableAction } from './hooks/useAppTableAction';
   import { useI18n } from '/@/hooks/web/useI18n';
   import { AppStateEnum, JobTypeEnum, OptionStateEnum, ReleaseStateEnum } from 
'/@/enums/flinkEnum';
diff --git 
a/streampark-console/streampark-console-webapp/src/views/flink/project/Add.vue 
b/streampark-console/streampark-console-webapp/src/views/flink/project/Add.vue
index e7eea570e..3cd760fe1 100644
--- 
a/streampark-console/streampark-console-webapp/src/views/flink/project/Add.vue
+++ 
b/streampark-console/streampark-console-webapp/src/views/flink/project/Add.vue
@@ -43,7 +43,7 @@
         url: values.url,
         repository: values.repository,
         type: values.type,
-        branches: values.branches,
+        refs: values.refs,
         userName: values.userName,
         password: values.password,
         prvkeyPath: values.prvkeyPath || null,
diff --git 
a/streampark-console/streampark-console-webapp/src/views/flink/project/Edit.vue 
b/streampark-console/streampark-console-webapp/src/views/flink/project/Edit.vue
index 0d31eda5f..a4f5beb7e 100644
--- 
a/streampark-console/streampark-console-webapp/src/views/flink/project/Edit.vue
+++ 
b/streampark-console/streampark-console-webapp/src/views/flink/project/Edit.vue
@@ -63,7 +63,7 @@
         url: values.url,
         repository: values.repository,
         type: values.type,
-        branches: values.branches,
+        refs: values.refs,
         userName: values.userName,
         password: values.password,
         prvkeyPath: values.prvkeyPath,
diff --git 
a/streampark-console/streampark-console-webapp/src/views/flink/project/components/ListItem.vue
 
b/streampark-console/streampark-console-webapp/src/views/flink/project/components/ListItem.vue
index 0368c992f..cc0957af3 100644
--- 
a/streampark-console/streampark-console-webapp/src/views/flink/project/components/ListItem.vue
+++ 
b/streampark-console/streampark-console-webapp/src/views/flink/project/components/ListItem.vue
@@ -49,8 +49,17 @@
       </li>
       <li class="list-content_item">
         <span>{{ t('flink.project.form.branches') }}</span>
-        <p>
-          <Tag color="blue" style="border-radius: 4px">{{ item.branches 
}}</Tag>
+        <p v-if="item.refs != null">
+          <a-tag
+            v-if="item.refs.startsWith('refs/tags/') > 0"
+            color="#108ee9"
+            style="border-radius: 4px"
+          >
+            {{ item.refs.replace('refs/tags/', '') }}
+          </a-tag>
+          <a-tag v-else color="#2db7f5" style="border-radius: 4px">
+            {{ item.refs.replace('refs/heads/', '') }}
+          </a-tag>
         </p>
       </li>
       <li class="list-content_item build_time">
diff --git 
a/streampark-console/streampark-console-webapp/src/views/flink/project/useProject.tsx
 
b/streampark-console/streampark-console-webapp/src/views/flink/project/useProject.tsx
index 09873176c..099584000 100644
--- 
a/streampark-console/streampark-console-webapp/src/views/flink/project/useProject.tsx
+++ 
b/streampark-console/streampark-console-webapp/src/views/flink/project/useProject.tsx
@@ -152,7 +152,7 @@ export const useProject = () => {
         },
       },
       {
-        field: 'branches',
+        field: 'refs',
         label: t('flink.project.form.branches'),
         component: 'Select',
         required: true,
@@ -236,7 +236,6 @@ export const useProject = () => {
     try {
       const res = await gitCheck({
         url: values.url,
-        branches: values.branches,
         userName: values.userName || null,
         password: values.password || null,
         prvkeyPath: values.prvkeyPath || null,
@@ -245,15 +244,7 @@ export const useProject = () => {
         if (branchList.value.length === 0) {
           await handleBranches(values);
         }
-        if (!branchList.value.find((v) => v.value == values.branches)) {
-          createErrorSwal(
-            'branch [' +
-              values.branches +
-              '] does not exist<br>or authentication error,please check',
-          );
-        } else {
-          await FetchAction(values);
-        }
+        await FetchAction(values);
       } else {
         createErrorSwal(
           res === 1
@@ -279,8 +270,31 @@ export const useProject = () => {
         const userNull = userName === null || userName === undefined || 
userName === '';
         const passNull = password === null || password === undefined || 
password === '';
         if ((userNull && passNull) || (!userNull && !passNull)) {
-          const res = await fetchBranches({ url, userName, password, 
prvkeyPath });
-          if (res) branchList.value = res.map((i) => ({ label: i, value: i }));
+          const resp = await fetchBranches({ url, userName, password, 
prvkeyPath });
+          if (resp) {
+            const branches = (resp['branches'] || []).map((c: string) => {
+              return {
+                label: c,
+                value: 'refs/heads/' + c,
+              };
+            });
+            const tags = (resp['tags'] || []).map((c: string) => {
+              return {
+                label: c,
+                value: 'refs/tags/' + c,
+              };
+            });
+            branchList.value = [
+              {
+                label: 'Branches',
+                options: branches,
+              },
+              {
+                label: 'Tags',
+                options: tags,
+              },
+            ];
+          }
         }
       }
     } catch (error) {
@@ -302,7 +316,7 @@ export const useProject = () => {
         userName: res.userName,
         password: res.password,
         prvkeyPath: res.prvkeyPath || null,
-        branches: res.branches,
+        refs: res.refs.replace('refs/heads/', '').replace('refs/tags/', ''),
         pom: res.pom,
         buildArgs: res.buildArgs,
         description: res.description,

Reply via email to