You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampark.apache.org by be...@apache.org on 2023/12/02 09:36:15 UTC
(incubator-streampark) branch deps created (now 1a0eb7f80)
This is an automated email from the ASF dual-hosted git repository.
benjobs pushed a change to branch deps
in repository https://gitbox.apache.org/repos/asf/incubator-streampark.git
at 1a0eb7f80 [Improve] FE job dependency component improvements
This branch includes the following new commits:
new 1a0eb7f80 [Improve] FE job dependency component improvements
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(incubator-streampark) 01/01: [Improve] FE job dependency component improvements
Posted by be...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
benjobs pushed a commit to branch deps
in repository https://gitbox.apache.org/repos/asf/incubator-streampark.git
commit 1a0eb7f806dd7d836a7c09b44bf5afe9f8492188
Author: benjobs <be...@gmail.com>
AuthorDate: Sat Dec 2 17:36:00 2023 +0800
[Improve] FE job dependency component improvements
---
.../console/core/entity/Application.java | 6 ++++++
.../core/service/impl/AppBuildPipeServiceImpl.java | 4 ++--
.../core/service/impl/ApplicationServiceImpl.java | 2 +-
.../src/views/flink/app/Add.vue | 1 +
.../src/views/flink/app/components/Dependency.vue | 2 +-
.../flink/app/hooks/useCreateAndEditSchema.ts | 23 +---------------------
.../src/views/flink/app/hooks/useCreateSchema.ts | 9 +++++++++
.../src/views/flink/app/hooks/useEditStreamPark.ts | 14 +++++++++++--
.../src/views/flink/app/hooks/useFlinkRender.tsx | 11 +++++++++--
.../src/views/flink/app/styles/Add.less | 2 --
10 files changed, 42 insertions(+), 32 deletions(-)
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 1bbee1382..e375d521a 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
@@ -462,6 +462,12 @@ public class Application implements Serializable {
return DevelopmentMode.CUSTOM_CODE.getValue().equals(this.getJobType());
}
+ @JsonIgnore
+ public boolean isApacheFlinkCustomCodeJob() {
+ return DevelopmentMode.CUSTOM_CODE.getValue().equals(this.getJobType())
+ && getApplicationType() == ApplicationType.APACHE_FLINK;
+ }
+
@JsonIgnore
public boolean isUploadJob() {
return isCustomCodeJob() && ResourceFrom.UPLOAD.getValue().equals(this.getResourceFrom());
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 59c0e108f..fb5937215 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
@@ -378,7 +378,7 @@ public class AppBuildPipeServiceImpl
FsOperator localFS = FsOperator.lfs();
// 1. copy jar to local upload dir
- if (app.isFlinkSqlJob() || app.isUploadJob()) {
+ if (app.isFlinkSqlJob() || app.isApacheFlinkCustomCodeJob()) {
if (!app.getMavenDependency().getJar().isEmpty()) {
for (String jar : app.getMavenDependency().getJar()) {
File localJar = new File(WebUtils.getAppTempDir(), jar);
@@ -393,7 +393,7 @@ public class AppBuildPipeServiceImpl
}
}
- if (app.isCustomCodeJob()) {
+ if (app.isApacheFlinkCustomCodeJob()) {
// customCode upload jar to appHome...
FsOperator fsOperator = app.getFsOperator();
ResourceFrom resourceFrom = ResourceFrom.of(app.getResourceFrom());
diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/ApplicationServiceImpl.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/ApplicationServiceImpl.java
index 0d1d45785..8b8b5b53b 100644
--- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/ApplicationServiceImpl.java
+++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/ApplicationServiceImpl.java
@@ -852,7 +852,7 @@ public class ApplicationServiceImpl extends ServiceImpl<ApplicationMapper, Appli
application.setRelease(ReleaseState.NEED_RELEASE.get());
- if (application.isUploadJob()) {
+ if (application.isApacheFlinkCustomCodeJob()) {
MavenDependency thisDependency = MavenDependency.of(appParam.getDependency());
MavenDependency targetDependency = MavenDependency.of(application.getDependency());
diff --git a/streampark-console/streampark-console-webapp/src/views/flink/app/Add.vue b/streampark-console/streampark-console-webapp/src/views/flink/app/Add.vue
index 071231e0c..9ac4b29b0 100644
--- a/streampark-console/streampark-console-webapp/src/views/flink/app/Add.vue
+++ b/streampark-console/streampark-console-webapp/src/views/flink/app/Add.vue
@@ -201,6 +201,7 @@
} else {
params['jar'] = values.jar || null;
params['mainClass'] = values.mainClass || null;
+ params['dependency'] = await getDependency();
}
handleCreateApp(params);
} else {
diff --git a/streampark-console/streampark-console-webapp/src/views/flink/app/components/Dependency.vue b/streampark-console/streampark-console-webapp/src/views/flink/app/components/Dependency.vue
index 5c9686a45..684d4ea60 100644
--- a/streampark-console/streampark-console-webapp/src/views/flink/app/components/Dependency.vue
+++ b/streampark-console/streampark-console-webapp/src/views/flink/app/components/Dependency.vue
@@ -291,7 +291,7 @@
<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 ref="pomBox" class="pom-box syntax-true" style="height: 330px"></div>
<a-button type="primary" class="apply-pom" @click="handleApplyPom()">
{{ t('common.apply') }}
</a-button>
diff --git a/streampark-console/streampark-console-webapp/src/views/flink/app/hooks/useCreateAndEditSchema.ts b/streampark-console/streampark-console-webapp/src/views/flink/app/hooks/useCreateAndEditSchema.ts
index 2a1a3b915..8a6942398 100644
--- a/streampark-console/streampark-console-webapp/src/views/flink/app/hooks/useCreateAndEditSchema.ts
+++ b/streampark-console/streampark-console-webapp/src/views/flink/app/hooks/useCreateAndEditSchema.ts
@@ -49,13 +49,7 @@ import { fetchFlinkEnv } from '/@/api/flink/setting/flinkEnv';
import { FlinkEnv } from '/@/api/flink/setting/types/flinkEnv.type';
import { AlertSetting } from '/@/api/flink/setting/types/alert.type';
import { FlinkCluster } from '/@/api/flink/setting/types/flinkCluster.type';
-import {
- AppTypeEnum,
- ClusterStateEnum,
- ExecModeEnum,
- JobTypeEnum,
- ResourceFromEnum,
-} from '/@/enums/flinkEnum';
+import { AppTypeEnum, ClusterStateEnum, ExecModeEnum, JobTypeEnum } from '/@/enums/flinkEnum';
import { isK8sExecMode } from '../utils';
import { useI18n } from '/@/hooks/web/useI18n';
import { fetchCheckHadoop } from '/@/api/flink/setting';
@@ -125,21 +119,6 @@ export const useCreateAndEditSchema = (
},
rules: [{ required: true, message: t('flink.app.addAppTips.flinkSqlIsRequiredMessage') }],
},
- {
- field: 'dependency',
- label: t('flink.app.dependency'),
- component: 'Input',
- slot: 'dependency',
- ifShow: ({ values }) => {
- if (edit?.appId) {
- return values.jobType == JobTypeEnum.SQL
- ? true
- : values.resourceFrom == ResourceFromEnum.UPLOAD;
- } else {
- return values?.jobType == 'sql' ? true : values?.resourceFrom != 'cvs';
- }
- },
- },
{ field: 'configOverride', label: '', component: 'Input', show: false },
{
field: 'isSetConfig',
diff --git a/streampark-console/streampark-console-webapp/src/views/flink/app/hooks/useCreateSchema.ts b/streampark-console/streampark-console-webapp/src/views/flink/app/hooks/useCreateSchema.ts
index 4ef2557b3..f12392303 100644
--- a/streampark-console/streampark-console-webapp/src/views/flink/app/hooks/useCreateSchema.ts
+++ b/streampark-console/streampark-console-webapp/src/views/flink/app/hooks/useCreateSchema.ts
@@ -242,6 +242,15 @@ export const useCreateSchema = (dependencyRef: Ref) => {
values.appType == String(AppTypeEnum.APACHE_FLINK),
rules: [{ required: true, message: t('flink.app.addAppTips.mainClassIsRequiredMessage') }],
},
+ {
+ field: 'dependency',
+ label: t('flink.app.dependency'),
+ component: 'Input',
+ slot: 'dependency',
+ ifShow: ({ values }) => {
+ return values?.jobType == 'sql' ? true : values?.appType == AppTypeEnum.APACHE_FLINK;
+ },
+ },
{
field: 'config',
label: t('flink.app.appConf'),
diff --git a/streampark-console/streampark-console-webapp/src/views/flink/app/hooks/useEditStreamPark.ts b/streampark-console/streampark-console-webapp/src/views/flink/app/hooks/useEditStreamPark.ts
index a4bb6c15f..3ad8db2cd 100644
--- a/streampark-console/streampark-console-webapp/src/views/flink/app/hooks/useEditStreamPark.ts
+++ b/streampark-console/streampark-console-webapp/src/views/flink/app/hooks/useEditStreamPark.ts
@@ -16,7 +16,7 @@
*/
import { FormSchema } from '/@/components/Table';
import { computed, h, Ref, ref, unref } from 'vue';
-import { ExecModeEnum, JobTypeEnum, UseStrategyEnum } from '/@/enums/flinkEnum';
+import { AppTypeEnum, ExecModeEnum, JobTypeEnum, UseStrategyEnum } from '/@/enums/flinkEnum';
import { useCreateAndEditSchema } from './useCreateAndEditSchema';
import { renderSqlHistory } from './useFlinkRender';
import { Alert } from 'ant-design-vue';
@@ -141,7 +141,6 @@ export const useEditStreamParkSchema = (
ifShow: ({ model, values }) => values.jobType != JobTypeEnum.SQL && model.projectName,
},
{ field: 'project', label: 'ProjectId', component: 'Input', show: false },
-
{
field: 'module',
label: 'Application',
@@ -149,6 +148,17 @@ export const useEditStreamParkSchema = (
render: ({ model }) => h(Alert, { message: model.module, type: 'info' }),
ifShow: ({ model, values }) => values.jobType != JobTypeEnum.SQL && model.module,
},
+ {
+ field: 'dependency',
+ label: t('flink.app.dependency'),
+ component: 'Input',
+ slot: 'dependency',
+ ifShow: ({ values }) => {
+ return values.jobType == JobTypeEnum.SQL
+ ? true
+ : values?.appType == AppTypeEnum.APACHE_FLINK;
+ },
+ },
{ field: 'configId', label: 'configId', component: 'Input', show: false },
{ field: 'config', label: '', component: 'Input', show: false },
{ field: 'strategy', label: '', component: 'Input', show: false },
diff --git a/streampark-console/streampark-console-webapp/src/views/flink/app/hooks/useFlinkRender.tsx b/streampark-console/streampark-console-webapp/src/views/flink/app/hooks/useFlinkRender.tsx
index ba00e667a..851778227 100644
--- a/streampark-console/streampark-console-webapp/src/views/flink/app/hooks/useFlinkRender.tsx
+++ b/streampark-console/streampark-console-webapp/src/views/flink/app/hooks/useFlinkRender.tsx
@@ -39,7 +39,7 @@ import { handleConfTemplate } from '/@/api/flink/config';
import { decodeByBase64 } from '/@/utils/cipher';
import { useMessage } from '/@/hooks/web/useMessage';
import { SelectValue } from 'ant-design-vue/lib/select';
-import { CandidateTypeEnum, FailoverStrategyEnum } from '/@/enums/flinkEnum';
+import { AppTypeEnum, CandidateTypeEnum, FailoverStrategyEnum } from '/@/enums/flinkEnum';
import { useI18n } from '/@/hooks/web/useI18n';
import { fetchYarnQueueList } from '/@/api/flink/setting/yarnQueue';
import { ApiSelect } from '/@/components/Form';
@@ -507,10 +507,17 @@ export const renderCompareSelectTag = (ver: any) => {
);
};
+function handleResourceFrom(model: Recordable, value: string) {
+ model.resourceFrom = value;
+ if (value == 'upload') {
+ model.appType = String(AppTypeEnum.APACHE_FLINK);
+ }
+}
+
export const renderResourceFrom = (model: Recordable) => {
return (
<Select
- onChange={(value: string) => (model.resourceFrom = value)}
+ onChange={(value: string) => handleResourceFrom(model, value)}
value={model.resourceFrom}
placeholder="Please select resource from"
>
diff --git a/streampark-console/streampark-console-webapp/src/views/flink/app/styles/Add.less b/streampark-console/streampark-console-webapp/src/views/flink/app/styles/Add.less
index 10e19a1e3..5159a19b8 100644
--- a/streampark-console/streampark-console-webapp/src/views/flink/app/styles/Add.less
+++ b/streampark-console/streampark-console-webapp/src/views/flink/app/styles/Add.less
@@ -28,9 +28,7 @@
}
}
-.sql-box,
.pom-box {
- height: 550px;
width: 100%;
overflow: hidden;
}