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 72b7cecf4 [Improve] support add resource via maven artifacts (#2735)
72b7cecf4 is described below
commit 72b7cecf47cde50fff51cfe32f513372c13ceaab
Author: zhoulii <[email protected]>
AuthorDate: Tue May 9 18:02:48 2023 +0800
[Improve] support add resource via maven artifacts (#2735)
* [Improve] support add resource via maven artifacts
* [Improve] remove delete button and add some constraints in fe
* [FIX] alter the width of select component
---------
Co-authored-by: zhoulii <[email protected]>
---
.../main/assembly/script/schema/mysql-schema.sql | 1 +
.../main/assembly/script/schema/pgsql-schema.sql | 2 +
.../main/assembly/script/upgrade/mysql/2.2.0.sql | 1 +
.../main/assembly/script/upgrade/pgsql/2.2.0.sql | 2 +
.../streampark/console/core/bean/Dependency.java | 95 ++++++++
.../apache/streampark/console/core/bean/Pom.java | 57 +++++
.../console/core/entity/Application.java | 104 +--------
.../streampark/console/core/entity/FlinkSql.java | 7 +-
.../streampark/console/core/entity/Resource.java | 2 +
.../console/core/enums/ResourceType.java | 5 +-
.../core/service/impl/AppBuildPipeServiceImpl.java | 47 +++-
.../core/service/impl/ResourceServiceImpl.java | 55 ++++-
.../src/main/resources/db/schema-h2.sql | 1 +
.../main/resources/mapper/core/ResourceMapper.xml | 1 +
.../src/api/flink/resource/model/resourceModel.ts | 1 +
.../src/locales/lang/en/flink/resource.ts | 2 +
.../src/locales/lang/zh-CN/flink/resource.ts | 2 +
.../views/flink/resource/components/Resource.vue | 260 +++++++++++++++++++++
.../flink/resource/components/ResourceDrawer.vue | 92 ++++----
.../src/views/flink/resource/useResourceRender.tsx | 2 +-
.../flink/packer/maven/DependencyInfo.scala | 11 +-
21 files changed, 579 insertions(+), 171 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 246e72693..45e2294eb 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
@@ -316,6 +316,7 @@ create table `t_resource` (
`id` bigint not null auto_increment,
`resource_name` varchar(128) collate utf8mb4_general_ci not null comment
'The name of the resource file',
`resource_type` int not null comment '0:app 1:common 2:connector 3:format
4:udf',
+ `resource` text collate utf8mb4_general_ci comment 'resource content,
including jars and poms',
`engine_type` int not null comment 'compute engine type, 0:apache flink
1:apache spark',
`main_class` varchar(255) collate utf8mb4_general_ci default null,
`description` text collate utf8mb4_general_ci default null comment 'More
detailed description of resource',
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 52f2dafa8..b613b852b 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
@@ -609,6 +609,7 @@ create table "public"."t_resource" (
"id" int8 not null default
nextval('streampark_t_resource_id_seq'::regclass),
"resource_name" varchar(128) collate
"pg_catalog"."default" not null,
"resource_type" int4,
+ "resource" text collate
"pg_catalog"."default",
"engine_type" int4,
"main_class" varchar(255) collate
"pg_catalog"."default",
"description" text collate
"pg_catalog"."default" default null,
@@ -621,6 +622,7 @@ create table "public"."t_resource" (
comment on column "public"."t_resource"."id" is 'Resource id';
comment on column "public"."t_resource"."resource_name" is 'Resource name';
comment on column "public"."t_resource"."resource_type" is '0:app 1:common
2:connector 3:format 4:udf';
+comment on column "public"."t_resource"."resource" is 'resource content,
including jars and poms';
comment on column "public"."t_resource"."engine_type" is 'compute engine type,
0:apache flink 1:apache spark';
comment on column "public"."t_resource"."main_class" is 'The program main
class';
comment on column "public"."t_resource"."description" is 'More detailed
description of resource';
diff --git
a/streampark-console/streampark-console-service/src/main/assembly/script/upgrade/mysql/2.2.0.sql
b/streampark-console/streampark-console-service/src/main/assembly/script/upgrade/mysql/2.2.0.sql
index 3bc697b3a..38081fb95 100644
---
a/streampark-console/streampark-console-service/src/main/assembly/script/upgrade/mysql/2.2.0.sql
+++
b/streampark-console/streampark-console-service/src/main/assembly/script/upgrade/mysql/2.2.0.sql
@@ -28,6 +28,7 @@ create table `t_resource` (
`id` bigint not null auto_increment,
`resource_name` varchar(128) collate
utf8mb4_general_ci not null comment 'The name of the resource file',
`resource_type` int not null comment '0:app
1:common 2:connector 3:format 4:udf',
+ `resource` text collate utf8mb4_general_ci
comment 'resource content, including jars and poms',
`engine_type` int not null comment 'compute
engine type, 0:apache flink 1:apache spark',
`main_class` varchar(255) collate
utf8mb4_general_ci default null,
`description` text collate utf8mb4_general_ci
default null comment 'More detailed description of resource',
diff --git
a/streampark-console/streampark-console-service/src/main/assembly/script/upgrade/pgsql/2.2.0.sql
b/streampark-console/streampark-console-service/src/main/assembly/script/upgrade/pgsql/2.2.0.sql
index e42d2624a..f60672c61 100644
---
a/streampark-console/streampark-console-service/src/main/assembly/script/upgrade/pgsql/2.2.0.sql
+++
b/streampark-console/streampark-console-service/src/main/assembly/script/upgrade/pgsql/2.2.0.sql
@@ -25,6 +25,7 @@ create table "public"."t_resource" (
"id" int8 not null default
nextval('streampark_t_resource_id_seq'::regclass),
"resource_name" varchar(128) collate
"pg_catalog"."default" not null,
"resource_type" int4,
+ "resource" text collate
"pg_catalog"."default",
"engine_type" int4,
"main_class" varchar(255) collate
"pg_catalog"."default",
"description" text collate
"pg_catalog"."default" default null,
@@ -37,6 +38,7 @@ create table "public"."t_resource" (
comment on column "public"."t_resource"."id" is 'Resource id';
comment on column "public"."t_resource"."resource_name" is 'Resource name';
comment on column "public"."t_resource"."resource_type" is '0:app 1:common
2:connector 3:format 4:udf';
+comment on column "public"."t_resource"."resource" is 'resource content,
including jars and poms';
comment on column "public"."t_resource"."engine_type" is 'compute engine type,
0:apache flink 1:apache spark';
comment on column "public"."t_resource"."main_class" is 'The program main
class';
comment on column "public"."t_resource"."description" is 'More detailed
description of resource';
diff --git
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/bean/Dependency.java
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/bean/Dependency.java
new file mode 100644
index 000000000..6e15e62f5
--- /dev/null
+++
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/bean/Dependency.java
@@ -0,0 +1,95 @@
+/*
+ * 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.bean;
+
+import org.apache.streampark.common.conf.Workspace;
+import org.apache.streampark.common.util.FileUtils;
+import org.apache.streampark.common.util.Utils;
+import org.apache.streampark.console.base.util.JacksonUtils;
+import org.apache.streampark.console.base.util.WebUtils;
+import org.apache.streampark.flink.packer.maven.Artifact;
+import org.apache.streampark.flink.packer.maven.DependencyInfo;
+
+import com.fasterxml.jackson.core.type.TypeReference;
+import lombok.Data;
+import lombok.SneakyThrows;
+
+import java.io.File;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.stream.Collectors;
+
+@Data
+public class Dependency {
+ private List<Pom> pom = Collections.emptyList();
+ private List<String> jar = Collections.emptyList();
+
+ @SneakyThrows
+ public static Dependency toDependency(String dependency) {
+ if (Utils.notEmpty(dependency)) {
+ return JacksonUtils.read(dependency, new TypeReference<Dependency>() {});
+ }
+ return new Dependency();
+ }
+
+ public boolean isEmpty() {
+ return pom.isEmpty() && jar.isEmpty();
+ }
+
+ public boolean eq(Dependency other) {
+ if (other == null) {
+ return false;
+ }
+ if (this.isEmpty() && other.isEmpty()) {
+ return true;
+ }
+
+ if (this.pom.size() != other.pom.size() || this.jar.size() !=
other.jar.size()) {
+ return false;
+ }
+ File localJar = WebUtils.getAppTempDir();
+ File localUploads = new File(Workspace.local().APP_UPLOADS());
+ HashSet<String> otherJars = new HashSet<>(other.jar);
+ for (String jarName : jar) {
+ if (!otherJars.contains(jarName)
+ || !FileUtils.equals(new File(localJar, jarName), new
File(localUploads, jarName))) {
+ return false;
+ }
+ }
+ return new HashSet<>(pom).containsAll(other.pom);
+ }
+
+ public DependencyInfo toJarPackDeps() {
+ List<Artifact> mvnArts =
+ this.pom.stream()
+ .map(
+ pom ->
+ new Artifact(
+ pom.getGroupId(),
+ pom.getArtifactId(),
+ pom.getVersion(),
+ pom.getClassifier()))
+ .collect(Collectors.toList());
+ List<String> extJars =
+ this.jar.stream()
+ .map(jar -> Workspace.local().APP_UPLOADS() + "/" + jar)
+ .collect(Collectors.toList());
+ return new DependencyInfo(mvnArts, extJars);
+ }
+}
diff --git
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/bean/Pom.java
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/bean/Pom.java
new file mode 100644
index 000000000..da10a529d
--- /dev/null
+++
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/bean/Pom.java
@@ -0,0 +1,57 @@
+/*
+ * 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.bean;
+
+import org.apache.commons.lang3.StringUtils;
+
+import lombok.Data;
+
+import java.util.Objects;
+
+@Data
+public class Pom {
+ private String groupId;
+ private String artifactId;
+ private String version;
+ private String classifier;
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ return this.toString().equals(o.toString());
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(groupId, artifactId, version, classifier);
+ }
+
+ @Override
+ public String toString() {
+ return groupId + ":" + artifactId + ":" + version + getClassifier(":");
+ }
+
+ private String getClassifier(String joiner) {
+ return StringUtils.isEmpty(classifier) ? "" : joiner + classifier;
+ }
+}
diff --git
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/entity/Application.java
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/entity/Application.java
index 2bc94c5da..3c352a5f9 100644
---
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/entity/Application.java
+++
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/entity/Application.java
@@ -26,19 +26,16 @@ import org.apache.streampark.common.enums.ExecutionMode;
import org.apache.streampark.common.enums.FlinkK8sRestExposedType;
import org.apache.streampark.common.enums.StorageType;
import org.apache.streampark.common.fs.FsOperator;
-import org.apache.streampark.common.util.FileUtils;
-import org.apache.streampark.common.util.Utils;
import org.apache.streampark.console.base.util.JacksonUtils;
import org.apache.streampark.console.base.util.ObjectUtils;
-import org.apache.streampark.console.base.util.WebUtils;
import org.apache.streampark.console.core.bean.AppControl;
+import org.apache.streampark.console.core.bean.Dependency;
import org.apache.streampark.console.core.enums.FlinkAppState;
import org.apache.streampark.console.core.enums.ReleaseState;
import org.apache.streampark.console.core.enums.ResourceFrom;
import org.apache.streampark.console.core.metrics.flink.JobsOverview;
import org.apache.streampark.console.core.utils.YarnQueueLabelExpression;
import org.apache.streampark.flink.kubernetes.model.K8sPodTemplates;
-import org.apache.streampark.flink.packer.maven.Artifact;
import org.apache.streampark.flink.packer.maven.DependencyInfo;
import org.apache.commons.lang3.StringUtils;
@@ -49,24 +46,19 @@ import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.core.type.TypeReference;
import lombok.Data;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import javax.annotation.Nonnull;
-import java.io.File;
import java.io.Serializable;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
-import java.util.stream.Collectors;
import static org.apache.streampark.console.core.enums.FlinkAppState.of;
@@ -496,7 +488,7 @@ public class Application implements Serializable {
@JsonIgnore
public DependencyInfo getDependencyInfo() {
- return
Application.Dependency.toDependency(getDependency()).toJarPackDeps();
+ return Dependency.toDependency(getDependency()).toJarPackDeps();
}
@JsonIgnore
@@ -653,65 +645,6 @@ public class Application implements Serializable {
return ExecutionMode.YARN_PER_JOB.equals(mode) ||
ExecutionMode.YARN_APPLICATION.equals(mode);
}
- @Data
- public static class Dependency {
- private List<Pom> pom = Collections.emptyList();
- private List<String> jar = Collections.emptyList();
-
- @SneakyThrows
- public static Dependency toDependency(String dependency) {
- if (Utils.notEmpty(dependency)) {
- return JacksonUtils.read(dependency, new TypeReference<Dependency>()
{});
- }
- return new Dependency();
- }
-
- public boolean isEmpty() {
- return pom.isEmpty() && jar.isEmpty();
- }
-
- public boolean eq(Dependency other) {
- if (other == null) {
- return false;
- }
- if (this.isEmpty() && other.isEmpty()) {
- return true;
- }
-
- if (this.pom.size() != other.pom.size() || this.jar.size() !=
other.jar.size()) {
- return false;
- }
- File localJar = WebUtils.getAppTempDir();
- File localUploads = new File(Workspace.local().APP_UPLOADS());
- HashSet<String> otherJars = new HashSet<>(other.jar);
- for (String jarName : jar) {
- if (!otherJars.contains(jarName)
- || !FileUtils.equals(new File(localJar, jarName), new
File(localUploads, jarName))) {
- return false;
- }
- }
- return new HashSet<>(pom).containsAll(other.pom);
- }
-
- public DependencyInfo toJarPackDeps() {
- List<Artifact> mvnArts =
- this.pom.stream()
- .map(
- pom ->
- new Artifact(
- pom.getGroupId(),
- pom.getArtifactId(),
- pom.getVersion(),
- pom.getClassifier()))
- .collect(Collectors.toList());
- List<String> extJars =
- this.jar.stream()
- .map(jar -> Workspace.local().APP_UPLOADS() + "/" + jar)
- .collect(Collectors.toList());
- return new DependencyInfo(mvnArts, extJars);
- }
- }
-
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -727,37 +660,4 @@ public class Application implements Serializable {
public int hashCode() {
return Objects.hash(id);
}
-
- @Data
- public static class Pom {
- private String groupId;
- private String artifactId;
- private String version;
- private String classifier;
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- return this.toString().equals(o.toString());
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(groupId, artifactId, version, classifier);
- }
-
- @Override
- public String toString() {
- return groupId + ":" + artifactId + ":" + version + getClassifier(":");
- }
-
- private String getClassifier(String joiner) {
- return StringUtils.isEmpty(classifier) ? "" : joiner + classifier;
- }
- }
}
diff --git
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/entity/FlinkSql.java
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/entity/FlinkSql.java
index d94d8ed8d..cb3fc4f97 100644
---
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/entity/FlinkSql.java
+++
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/entity/FlinkSql.java
@@ -19,6 +19,7 @@ package org.apache.streampark.console.core.entity;
import org.apache.streampark.common.util.DeflaterUtils;
import org.apache.streampark.console.base.util.ObjectUtils;
+import org.apache.streampark.console.core.bean.Dependency;
import org.apache.streampark.console.core.enums.ChangedType;
import com.baomidou.mybatisplus.annotation.IdType;
@@ -86,10 +87,8 @@ public class FlinkSql {
// 1) determine if sql statement has changed
boolean sqlDifference =
!this.getSql().trim().equals(target.getSql().trim());
// 2) determine if dependency has changed
- Application.Dependency thisDependency =
- Application.Dependency.toDependency(this.getDependency());
- Application.Dependency targetDependency =
- Application.Dependency.toDependency(target.getDependency());
+ Dependency thisDependency = Dependency.toDependency(this.getDependency());
+ Dependency targetDependency =
Dependency.toDependency(target.getDependency());
boolean depDifference = !thisDependency.eq(targetDependency);
// 3) determine if team resource has changed
boolean teamResDifference =
diff --git
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/entity/Resource.java
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/entity/Resource.java
index 93e181254..ac5eea6a5 100644
---
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/entity/Resource.java
+++
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/entity/Resource.java
@@ -42,6 +42,8 @@ public class Resource implements Serializable {
private String resourceName;
+ private String resource;
+
@Size(max = 100, message = "{noMoreThan}")
private String description;
diff --git
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/enums/ResourceType.java
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/enums/ResourceType.java
index e6aa46353..bf61517e5 100644
---
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/enums/ResourceType.java
+++
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/enums/ResourceType.java
@@ -34,7 +34,10 @@ public enum ResourceType {
UDXF(2),
/** Common resource, like mysql-jdbc */
- NORMAL_JAR(3);
+ NORMAL_JAR(3),
+
+ /** Reserved for resource group */
+ GROUP(4);
@EnumValue private final int code;
diff --git
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/AppBuildPipeServiceImpl.java
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/AppBuildPipeServiceImpl.java
index f62f521e5..45d4ae14d 100644
---
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/AppBuildPipeServiceImpl.java
+++
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/AppBuildPipeServiceImpl.java
@@ -29,6 +29,7 @@ import org.apache.streampark.common.util.Utils;
import org.apache.streampark.console.base.exception.ApiAlertException;
import org.apache.streampark.console.base.util.JacksonUtils;
import org.apache.streampark.console.base.util.WebUtils;
+import org.apache.streampark.console.core.bean.Dependency;
import org.apache.streampark.console.core.entity.AppBuildPipeline;
import org.apache.streampark.console.core.entity.Application;
import org.apache.streampark.console.core.entity.ApplicationConfig;
@@ -36,6 +37,7 @@ import
org.apache.streampark.console.core.entity.ApplicationLog;
import org.apache.streampark.console.core.entity.FlinkEnv;
import org.apache.streampark.console.core.entity.FlinkSql;
import org.apache.streampark.console.core.entity.Message;
+import org.apache.streampark.console.core.entity.Resource;
import org.apache.streampark.console.core.enums.CandidateType;
import org.apache.streampark.console.core.enums.NoticeType;
import org.apache.streampark.console.core.enums.OptionState;
@@ -54,6 +56,7 @@ import
org.apache.streampark.console.core.service.ResourceService;
import org.apache.streampark.console.core.service.SettingService;
import org.apache.streampark.console.core.task.FlinkRESTAPIWatcher;
import org.apache.streampark.flink.packer.docker.DockerConf;
+import org.apache.streampark.flink.packer.maven.Artifact;
import org.apache.streampark.flink.packer.maven.DependencyInfo;
import org.apache.streampark.flink.packer.pipeline.BuildPipeline;
import org.apache.streampark.flink.packer.pipeline.BuildResult;
@@ -90,6 +93,7 @@ import
org.springframework.transaction.annotation.Transactional;
import javax.annotation.Nonnull;
import java.io.File;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@@ -522,17 +526,38 @@ public class AppBuildPipeServiceImpl
DependencyInfo dependencyInfo = application.getDependencyInfo();
try {
- String[] teamJarIds = JacksonUtils.read(application.getTeamResource(),
String[].class);
- List<String> teamJarsFullPath =
- Arrays.stream(teamJarIds)
- .map(jarId -> resourceService.getById(jarId).getResourceName())
- .map(
- jar ->
- String.format(
- "%s/%d/%s",
- Workspace.local().APP_UPLOADS(),
application.getTeamId(), jar))
- .collect(Collectors.toList());
- return dependencyInfo.merge(teamJarsFullPath);
+ String[] resourceIds = JacksonUtils.read(application.getTeamResource(),
String[].class);
+
+ List<Artifact> mvnArtifacts = new ArrayList<Artifact>();
+ List<String> jarLibs = new ArrayList<String>();
+
+ Arrays.stream(resourceIds)
+ .forEach(
+ resourceId -> {
+ Resource resource = resourceService.getById(resourceId);
+ Dependency dependency =
Dependency.toDependency(resource.getResource());
+ dependency
+ .getPom()
+ .forEach(
+ pom -> {
+ mvnArtifacts.add(
+ new Artifact(
+ pom.getGroupId(),
+ pom.getArtifactId(),
+ pom.getVersion(),
+ pom.getClassifier()));
+ });
+ dependency
+ .getJar()
+ .forEach(
+ jar -> {
+ jarLibs.add(
+ String.format(
+ "%s/%d/%s",
+ Workspace.local().APP_UPLOADS(),
application.getTeamId(), jar));
+ });
+ });
+ return dependencyInfo.merge(mvnArtifacts, jarLibs);
} catch (Exception e) {
log.warn("Merge team dependency failed.");
return dependencyInfo;
diff --git
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/ResourceServiceImpl.java
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/ResourceServiceImpl.java
index 97443191a..ad395300f 100644
---
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/ResourceServiceImpl.java
+++
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/ResourceServiceImpl.java
@@ -23,9 +23,12 @@ import org.apache.streampark.console.base.domain.RestRequest;
import org.apache.streampark.console.base.exception.ApiAlertException;
import org.apache.streampark.console.base.mybatis.pager.MybatisPager;
import org.apache.streampark.console.base.util.WebUtils;
+import org.apache.streampark.console.core.bean.Dependency;
+import org.apache.streampark.console.core.bean.Pom;
import org.apache.streampark.console.core.entity.Application;
import org.apache.streampark.console.core.entity.FlinkSql;
import org.apache.streampark.console.core.entity.Resource;
+import org.apache.streampark.console.core.enums.ResourceType;
import org.apache.streampark.console.core.mapper.ResourceMapper;
import org.apache.streampark.console.core.service.ApplicationService;
import org.apache.streampark.console.core.service.CommonService;
@@ -33,6 +36,7 @@ import
org.apache.streampark.console.core.service.FlinkSqlService;
import org.apache.streampark.console.core.service.ResourceService;
import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
@@ -83,16 +87,49 @@ public class ResourceServiceImpl extends
ServiceImpl<ResourceMapper, Resource>
@Override
public void addResource(Resource resource) {
- String resourceName = resource.getResourceName();
- ApiAlertException.throwIfNull(resourceName, "No resource uploaded.");
-
- Long teamId = resource.getTeamId();
- ApiAlertException.throwIfTrue(
- this.findByResourceName(teamId, resourceName) != null,
- String.format("Sorry, the resource %s already exists.",
resource.getResourceName()));
+ String resourceStr = resource.getResource();
+ ApiAlertException.throwIfNull(resourceStr, "Please add pom or jar
resource.");
+
+ if (resource.getResourceType() == ResourceType.GROUP) {
+ // TODO: will support later
+ } else {
+ Dependency dependency = Dependency.toDependency(resourceStr);
+ List<String> jars = dependency.getJar();
+ List<Pom> poms = dependency.getPom();
+
+ ApiAlertException.throwIfTrue(
+ jars.isEmpty() && poms.isEmpty(), "Please add pom or jar resource.");
+ ApiAlertException.throwIfTrue(
+ jars.size() + poms.size() > 1, "Please do not add multi dependency
at one time.");
+ ApiAlertException.throwIfTrue(
+ resource.getResourceType() == ResourceType.FLINK_APP &&
jars.isEmpty(),
+ "Please upload jar for Flink_App resource");
+
+ Long teamId = resource.getTeamId();
+ String resourceName = null;
+
+ if (poms.isEmpty()) {
+ resourceName = jars.get(0);
+ ApiAlertException.throwIfTrue(
+ this.findByResourceName(teamId, resourceName) != null,
+ String.format("Sorry, the resource %s already exists.",
resourceName));
+
+ // copy jar to team upload directory
+ transferTeamResource(teamId, resourceName);
+ } else {
+ Pom pom = poms.get(0);
+ resourceName =
+ String.format("%s:%s:%s", pom.getGroupId(), pom.getArtifactId(),
pom.getVersion());
+ if (StringUtils.isNotBlank(pom.getClassifier())) {
+ resourceName = resourceName + ":" + pom.getClassifier();
+ }
+ ApiAlertException.throwIfTrue(
+ this.findByResourceName(teamId, resourceName) != null,
+ String.format("Sorry, the resource %s already exists.",
resourceName));
+ }
- // copy jar to team upload directory
- transferTeamResource(teamId, resourceName);
+ resource.setResourceName(resourceName);
+ }
resource.setCreatorId(commonService.getUserId());
this.save(resource);
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 9b4f31031..3e9f1c454 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
@@ -220,6 +220,7 @@ create table if not exists `t_resource` (
`id` bigint generated by default as identity not null,
`resource_name` varchar(128) not null comment 'The name of the resource
file',
`resource_type` int not null comment '0:app 1:common 2:connector 3:format
4:udf',
+ `resource` text ,
`engine_type` int not null comment 'compute engine type, 0:apache flink
1:apache spark',
`main_class` varchar(255) default null,
`description` text default null comment 'More detailed description of
resource',
diff --git
a/streampark-console/streampark-console-service/src/main/resources/mapper/core/ResourceMapper.xml
b/streampark-console/streampark-console-service/src/main/resources/mapper/core/ResourceMapper.xml
index 9c9a89ed5..c8020991a 100644
---
a/streampark-console/streampark-console-service/src/main/resources/mapper/core/ResourceMapper.xml
+++
b/streampark-console/streampark-console-service/src/main/resources/mapper/core/ResourceMapper.xml
@@ -22,6 +22,7 @@
<result column="resource_name" jdbcType="VARCHAR"
property="resourceName"/>
<result column="description" jdbcType="VARCHAR"
property="description"/>
<result column="resource_type" jdbcType="BIGINT"
property="resourceType"/>
+ <result column="resource" jdbcType="VARCHAR" property="resource"/>
<result column="engine_type" jdbcType="BIGINT" property="engineType"/>
<result column="creator_id" jdbcType="BIGINT" property="creatorId"/>
<result column="team_id" jdbcType="BIGINT" property="teamId"/>
diff --git
a/streampark-console/streampark-console-webapp/src/api/flink/resource/model/resourceModel.ts
b/streampark-console/streampark-console-webapp/src/api/flink/resource/model/resourceModel.ts
index 684e34e84..4de0f0f5e 100644
---
a/streampark-console/streampark-console-webapp/src/api/flink/resource/model/resourceModel.ts
+++
b/streampark-console/streampark-console-webapp/src/api/flink/resource/model/resourceModel.ts
@@ -18,6 +18,7 @@ export interface ResourceListRecord {
id: string;
resourceName: string;
resourceType: string;
+ resource: string;
engineType: string;
mainClass: string;
description: string;
diff --git
a/streampark-console/streampark-console-webapp/src/locales/lang/en/flink/resource.ts
b/streampark-console/streampark-console-webapp/src/locales/lang/en/flink/resource.ts
index 03f1e5086..84cc1d1d2 100644
---
a/streampark-console/streampark-console-webapp/src/locales/lang/en/flink/resource.ts
+++
b/streampark-console/streampark-console-webapp/src/locales/lang/en/flink/resource.ts
@@ -24,6 +24,8 @@ export default {
resourceType: 'Resource Type',
engineType: 'Engine Type',
engineTypePlaceholder: 'Please select compute engine type',
+ multiPomTip: 'Do not add multiple dependencies at one time',
+ addResourceTip: 'Please add a resource',
add: 'Add',
success: ' successful',
fail: ' failed',
diff --git
a/streampark-console/streampark-console-webapp/src/locales/lang/zh-CN/flink/resource.ts
b/streampark-console/streampark-console-webapp/src/locales/lang/zh-CN/flink/resource.ts
index 3eca6dacc..7d9c9baba 100644
---
a/streampark-console/streampark-console-webapp/src/locales/lang/zh-CN/flink/resource.ts
+++
b/streampark-console/streampark-console-webapp/src/locales/lang/zh-CN/flink/resource.ts
@@ -24,6 +24,8 @@ export default {
resourceType: '资源类型',
engineType: '计算引擎类型',
engineTypePlaceholder: '请选择计算引擎类型',
+ multiPomTip: '不支持同时添加多个依赖',
+ addResourceTip: '请添加资源',
add: '添加',
success: '成功',
fail: '失败',
diff --git
a/streampark-console/streampark-console-webapp/src/views/flink/resource/components/Resource.vue
b/streampark-console/streampark-console-webapp/src/views/flink/resource/components/Resource.vue
new file mode 100644
index 000000000..540b0e533
--- /dev/null
+++
b/streampark-console/streampark-console-webapp/src/views/flink/resource/components/Resource.vue
@@ -0,0 +1,260 @@
+<!--
+ 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
+
+ https://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.
+-->
+<script lang="ts">
+ import { computed, defineComponent, onMounted, reactive, ref } from 'vue';
+ import { useI18n } from '/@/hooks/web/useI18n';
+ import { toPomString } from '/@/views/flink/app/utils/Pom';
+
+ export default defineComponent({
+ name: 'Resource',
+ });
+</script>
+
+<script setup lang="ts" name="Resource">
+ import { getMonacoOptions } from '/@/views/flink/app/data';
+ import { Icon } from '/@/components/Icon';
+ import { useMonaco } from '/@/hooks/web/useMonaco';
+ import { Select, Tabs, Alert, Tag, Space, Form } from 'ant-design-vue';
+ import { useMessage } from '/@/hooks/web/useMessage';
+ import { fetchUpload } from '/@/api/flink/app/app';
+ import UploadJobJar from '/@/views/flink/app/components/UploadJobJar.vue';
+
+ interface DependencyType {
+ artifactId: string;
+ exclusions: string[];
+ groupId: string;
+ version: string;
+ classifier: string;
+ }
+
+ const TabPane = Tabs.TabPane;
+ const activeTab = ref('pom');
+ const pomBox = ref();
+ const dependency = reactive({
+ jar: {},
+ pom: {},
+ });
+ const dependencyRecords = ref<DependencyType[]>([]);
+ const uploadJars = ref<string[]>([]);
+ const loading = ref(false);
+
+ const emit = defineEmits(['update:value']);
+ const props = defineProps({
+ value: {
+ type: String,
+ default: '',
+ },
+ formModel: {
+ type: Object as PropType<Recordable>,
+ required: true,
+ },
+ });
+ const { t } = useI18n();
+ const defaultValue = '';
+ const { Swal } = useMessage();
+ const { onChange, setContent } = useMonaco(pomBox, {
+ language: 'xml',
+ code: props.value || defaultValue,
+ options: {
+ minimap: { enabled: false },
+ ...(getMonacoOptions(false) as any),
+ },
+ });
+
+ async function handleApplyPom() {
+ dependency.pom = {};
+ dependencyRecords.value = [];
+
+ if (props.value == null || props.value.trim() === '') {
+ return;
+ }
+
+ const groupExp = /<groupId>([\s\S]*?)<\/groupId>/;
+ const artifactExp = /<artifactId>([\s\S]*?)<\/artifactId>/;
+ const versionExp = /<version>([\s\S]*?)<\/version>/;
+ const classifierExp = /<classifier>([\s\S]*?)<\/classifier>/;
+ const exclusionsExp = /<exclusions>([\s\S]*?)<\/exclusions>/;
+
+ const poms = props.value
+ .split('</dependency>')
+ .filter((x) => x.trim().replace(/\\s+/, '') !== '');
+
+ poms.forEach((dep) => {
+ const groupId = dep.match(groupExp) ? groupExp.exec(dep)![1].trim() :
null;
+ const artifactId = dep.match(artifactExp) ?
artifactExp.exec(dep)![1].trim() : null;
+ const version = dep.match(versionExp) ? versionExp.exec(dep)![1].trim()
: null;
+ const classifier = dep.match(classifierExp) ?
classifierExp.exec(dep)![1].trim() : null;
+ const exclusion = dep.match(exclusionsExp) ?
exclusionsExp.exec(dep)![1].trim() : null;
+ if (groupId != null && artifactId != null && version != null) {
+ const mvnPom: Recordable = {
+ groupId: groupId,
+ artifactId: artifactId,
+ version: version,
+ };
+ if (classifier != null) {
+ mvnPom.classifier = classifier;
+ }
+ const id = getId(mvnPom);
+ const pomExclusion = {};
+ if (exclusion != null) {
+ const exclusions = exclusion.split('<exclusion>');
+ exclusions.forEach((e) => {
+ if (e != null && e.length > 0) {
+ const e_group = e.match(groupExp) ? groupExp.exec(e)![1].trim()
: null;
+ const e_artifact = e.match(artifactExp) ?
artifactExp.exec(e)![1].trim() : null;
+ const id = e_group + '_' + e_artifact;
+ pomExclusion[id] = {
+ groupId: e_group,
+ artifactId: e_artifact,
+ };
+ }
+ });
+ }
+ mvnPom.exclusions = pomExclusion;
+ dependency.pom[id] = mvnPom;
+ } else {
+ console.error('dependency error...');
+ }
+ });
+
+ handleUpdateDependency();
+ }
+
+ /* custom http */
+ async function handleCustomDepsRequest(data) {
+ try {
+ loading.value = true;
+ const formData = new FormData();
+ formData.append('file', data.file);
+ await fetchUpload(formData);
+ dependency.jar = {}
+ dependency.jar[data.file.name] = data.file.name;
+ handleUpdateDependency();
+ } catch (error) {
+ console.error(error);
+ } finally {
+ loading.value = false;
+ }
+ }
+
+ // update the dependency list
+ function handleUpdateDependency() {
+ const deps: DependencyType[] = [];
+ const jars: string[] = [];
+ Object.keys(dependency.pom).forEach((v: string) => {
+ deps.push(dependency.pom[v]);
+ });
+ Object.keys(dependency.jar).forEach((v: string) => {
+ jars.push(v);
+ });
+
+ dependencyRecords.value = deps;
+ uploadJars.value = jars;
+ }
+
+ function handleRemoveJar(jar: string) {
+ delete dependency.jar[jar];
+ handleUpdateDependency();
+ }
+
+ // set default value
+ function setDefaultValue(dataSource: { pom?: DependencyType[]; jar?:
string[] }) {
+ dependencyRecords.value = dataSource.pom || [];
+ uploadJars.value = dataSource.jar || [];
+ dependency.pom = {};
+ dependency.jar = {};
+ if (dataSource.pom === undefined) {
+ setContent(defaultValue)
+ }
+ dataSource.pom?.map((pomRecord: DependencyType) => {
+ const id = getId(pomRecord);
+ dependency.pom[id] = pomRecord;
+ setContent(toPomString(pomRecord))
+ });
+ dataSource.jar?.map((fileName: string) => {
+ dependency.jar[fileName] = fileName;
+ });
+ }
+
+ function getId(pom) {
+ if (pom.classifier != null) {
+ return pom.groupId + '_' + pom.artifactId + '_' + pom.classifier;
+ }
+ return pom.groupId + '_' + pom.artifactId;
+ }
+
+ onChange((data) => {
+ emit('update:value', data);
+ });
+
+ defineExpose({
+ setDefaultValue,
+ dependency,
+ handleApplyPom,
+ dependencyRecords,
+ uploadJars,
+ });
+</script>
+
+<style lang="less">
+@import url('/@/views/flink/app/styles/Add.less');
+.apply-pom {
+ z-index: 99;
+ position: absolute;
+ bottom: 20px;
+ float: right;
+ right: 20px;
+ cursor: pointer;
+ height: 26px;
+ padding: 0 12px;
+ font-size: 12px;
+}
+</style>
+
+<template>
+ <Tabs type="card" v-model:activeKey="activeTab" class="pom-card">
+ <TabPane key="pom" tab="Maven pom">
+ <div class="relative">
+ <div ref="pomBox" class="pom-box syntax-true" style="height:
300px"></div>
+ </div>
+ </TabPane>
+ <TabPane key="jar" tab="Upload Jar">
+ <UploadJobJar :custom-request="handleCustomDepsRequest"
v-model:loading="loading" />
+ </TabPane>
+ </Tabs>
+ <div class="dependency-box" v-if="uploadJars.length > 0">
+ <Alert
+ class="dependency-item"
+ v-for="jar in uploadJars"
+ :key="`upload_jars_${jar}`"
+ type="info"
+ >
+ <template #message>
+ <Space>
+ <Tag class="tag-dependency" color="#108ee9">JAR</Tag>
+ {{ jar }}
+ <Icon
+ icon="ant-design:close-outlined"
+ class="icon-close cursor-pointer"
+ :size="12"
+ @click="handleRemoveJar(jar)"
+ />
+ </Space>
+ </template>
+ </Alert>
+ </div>
+</template>
diff --git
a/streampark-console/streampark-console-webapp/src/views/flink/resource/components/ResourceDrawer.vue
b/streampark-console/streampark-console-webapp/src/views/flink/resource/components/ResourceDrawer.vue
index 930b1a926..75e16aced 100644
---
a/streampark-console/streampark-console-webapp/src/views/flink/resource/components/ResourceDrawer.vue
+++
b/streampark-console/streampark-console-webapp/src/views/flink/resource/components/ResourceDrawer.vue
@@ -27,18 +27,12 @@
{{ getTitle }}
</template>
<BasicForm @register="registerForm" :schemas="getResourceFormSchema">
- <template #uploadJobJar>
- <UploadJobJar :custom-request="handleCustomJobRequest"
v-model:loading="uploadLoading">
- <template #uploadInfo>
- <Alert v-if="uploadJar" class="uploadjar-box" type="info">
- <template #message>
- <span class="tag-dependency-pom">
- {{ uploadJar }}
- </span>
- </template>
- </Alert>
- </template>
- </UploadJobJar>
+ <template #resource="{ model, field }">
+ <Resource
+ ref="resourceRef"
+ v-model:value="model[field]"
+ :form-model="model"
+ />
</template>
</BasicForm>
</BasicDrawer>
@@ -51,25 +45,24 @@
<script lang="ts" setup>
import { ref, h, computed, unref } from 'vue';
- import { Alert } from 'ant-design-vue';
import { BasicForm, FormSchema, useForm } from '/@/components/Form';
import { BasicDrawer, useDrawerInner } from '/@/components/Drawer';
import { Icon } from '/@/components/Icon';
import { useI18n } from '/@/hooks/web/useI18n';
- import UploadJobJar from '/@/views/flink/app/components/UploadJobJar.vue';
- import { fetchUpload } from "/@/api/flink/app/app";
+ import Resource from '/@/views/flink/resource/components/Resource.vue';
import { fetchAddResource, fetchUpdateResource } from
"/@/api/flink/resource";
- import { EngineTypeEnum, ResourceTypeEnum } from
"/@/views/flink/resource/resource.data";
- import {renderResourceType} from "/@/views/flink/resource/useResourceRender";
+ import { EngineTypeEnum } from "/@/views/flink/resource/resource.data";
+ import { renderResourceType } from
"/@/views/flink/resource/useResourceRender";
+ import { useMessage } from "/@/hooks/web/useMessage";
const emit = defineEmits(['success', 'register']);
const { t } = useI18n();
+ const { Swal } = useMessage();
const isUpdate = ref(false);
- const uploadLoading = ref(false);
- const uploadJar = ref('');
const resourceId = ref<Nullable<number>>(null);
+ const resourceRef = ref();
const getResourceFormSchema = computed((): FormSchema[] => {
return [
@@ -96,10 +89,10 @@
rules: [{ required: true, message:
t('flink.resource.form.engineTypeIsRequiredMessage') }],
},
{
- field: 'resourceName',
- label: t('flink.resource.uploadResource'),
- component: 'Select',
- slot: 'uploadJobJar',
+ field: 'dependency',
+ label: t('flink.resource.addResource'),
+ component: 'Input',
+ slot: 'resource',
},
{
field: 'mainClass',
@@ -136,6 +129,7 @@
if (unref(isUpdate)) {
resourceId.value = data.record.id;
setFieldsValue(data.record);
+ unref(resourceRef)?.setDefaultValue(JSON.parse(data.record.resource ||
'{}'));
}
},
);
@@ -146,13 +140,45 @@
// form submit
async function handleSubmit() {
+ const resource: { pom?: string; jar?: string } = {};
+ unref(resourceRef).handleApplyPom();
+ const dependencyRecords = unref(resourceRef)?.dependencyRecords;
+ const uploadJars = unref(resourceRef)?.uploadJars;
+
+ if (unref(dependencyRecords) && unref(dependencyRecords).length > 0) {
+ if (unref(dependencyRecords).length > 1) {
+ Swal.fire('Failed', t('flink.resource.multiPomTip'), 'error');
+ return;
+ }
+ Object.assign(resource, {
+ pom: unref(dependencyRecords),
+ });
+ }
+
+ if (uploadJars && unref(uploadJars).length > 0) {
+ Object.assign(resource, {
+ jar: unref(uploadJars),
+ });
+ }
+
+ if (resource.pom === undefined && resource.jar === undefined) {
+ Swal.fire('Failed', t('flink.resource.addResourceTip'), 'error');
+ return;
+ }
+
+ if (resource.pom?.length > 0 && resource.jar?.length > 0) {
+ Swal.fire('Failed', t('flink.resource.multiPomTip'), 'error');
+ return;
+ }
+
try {
const values = await validate();
setDrawerProps({ confirmLoading: true });
await (isUpdate.value
- ? fetchUpdateResource({ id: resourceId.value, ...values })
- : fetchAddResource(values));
- uploadJar.value = ''
+ ? fetchUpdateResource({ id: resourceId.value, resource:
JSON.stringify(resource), ...values })
+ : fetchAddResource({ resource: JSON.stringify(resource), ...values }));
+ unref(resourceRef)?.setDefaultValue({});
+ resetFields();
closeDrawer();
emit('success', isUpdate.value);
} finally {
@@ -160,20 +186,6 @@
}
}
- /* Custom job upload */
- async function handleCustomJobRequest(data) {
- const formData = new FormData();
- formData.append('file', data.file);
- try {
- const path = await fetchUpload(formData);
- uploadJar.value = data.file.name;
- uploadLoading.value = false;
- setFieldsValue({ resourceName: uploadJar.value });
- } catch (error) {
- console.error(error);
- uploadLoading.value = false;
- }
- }
</script>
<style lang="less">
diff --git
a/streampark-console/streampark-console-webapp/src/views/flink/resource/useResourceRender.tsx
b/streampark-console/streampark-console-webapp/src/views/flink/resource/useResourceRender.tsx
index 14c0205b5..ba48164ef 100644
---
a/streampark-console/streampark-console-webapp/src/views/flink/resource/useResourceRender.tsx
+++
b/streampark-console/streampark-console-webapp/src/views/flink/resource/useResourceRender.tsx
@@ -62,7 +62,7 @@ export const renderResourceType = ({ model },) => {
<Select
allow-clear
placeholder={t('flink.resource.form.resourceTypePlaceholder')}
- style="width: calc(100% - 60px)"
+ value={model.resourceType}
onChange={(value) => (model.resourceType = value)}
>
{renderOptions()}
diff --git
a/streampark-flink/streampark-flink-packer/src/main/scala/org/apache/streampark/flink/packer/maven/DependencyInfo.scala
b/streampark-flink/streampark-flink-packer/src/main/scala/org/apache/streampark/flink/packer/maven/DependencyInfo.scala
index 698e9f8a0..33f05fc29 100644
---
a/streampark-flink/streampark-flink-packer/src/main/scala/org/apache/streampark/flink/packer/maven/DependencyInfo.scala
+++
b/streampark-flink/streampark-flink-packer/src/main/scala/org/apache/streampark/flink/packer/maven/DependencyInfo.scala
@@ -36,9 +36,14 @@ case class DependencyInfo(mavenArts: Set[Artifact] = Set(),
extJarLibs: Set[Stri
def merge(jarLibs: Set[String]): DependencyInfo =
if (jarLibs != null) DependencyInfo(mavenArts, extJarLibs ++ jarLibs) else
this.copy()
- def merge(jarLibs: JavaList[String]): DependencyInfo =
- if (jarLibs != null) DependencyInfo(mavenArts, extJarLibs ++
jarLibs.toSet) else this.copy()
-
+ def merge(mvnPoms: JavaList[Artifact], jarLibs: JavaList[String]):
DependencyInfo =
+ if (mvnPoms != null && jarLibs != null)
+ DependencyInfo(mavenArts ++ mvnPoms.toSet, extJarLibs ++ jarLibs.toSet)
+ else if (mvnPoms != null)
+ DependencyInfo(mavenArts ++ mvnPoms.toSet, extJarLibs)
+ else if (jarLibs != null)
+ DependencyInfo(mavenArts, extJarLibs ++ jarLibs.toSet)
+ else this.copy()
}
object DependencyInfo {