From ca4e05587de328fe97f62f818df3eb1397df5048 Mon Sep 17 00:00:00 2001 From: benjobs Date: Sun, 6 Aug 2023 19:48:30 +0800 Subject: [PATCH] [Improve] flink job restore mode option improvement (#2925) * [Improve] flink job restore mode option improvement * check style minor improvement --- .../console/core/entity/FlinkEnv.java | 31 ++++++++++---- .../src/api/flink/setting/flinkEnv.ts | 9 +++- .../src/design/public.less | 4 +- .../src/locales/lang/en/flink/app.ts | 2 + .../src/locales/lang/zh-CN/flink/app.ts | 1 + .../AppView/StartApplicationModal.vue | 42 +++++-------------- .../AppView/StopApplicationModal.vue | 7 ++-- .../flink/app/hooks/useCreateAndEditSchema.ts | 8 ++-- .../views/flink/app/hooks/useFlinkRender.tsx | 40 +++++++++++++++++- .../resource/components/ResourceDrawer.vue | 8 ---- .../variable/components/VariableDrawer.vue | 10 +---- .../setting/Alarm/components/AlertModal.vue | 2 +- .../setting/ExternalLink/components/Modal.vue | 2 +- .../setting/FlinkCluster/useClusterSetting.ts | 8 ++-- .../setting/FlinkHome/components/Modal.vue | 11 +---- .../src/views/setting/FlinkHome/index.vue | 4 +- streampark-flink/pom.xml | 10 ++++- 17 files changed, 112 insertions(+), 87 deletions(-) diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/entity/FlinkEnv.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/entity/FlinkEnv.java index 60db283150..2a498ebc48 100644 --- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/entity/FlinkEnv.java +++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/entity/FlinkEnv.java @@ -23,6 +23,7 @@ import org.apache.streampark.console.base.exception.ApiDetailException; import org.apache.commons.io.FileUtils; +import org.apache.commons.lang3.StringUtils; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; @@ -61,6 +62,12 @@ public class FlinkEnv implements Serializable { private transient FlinkVersion flinkVersion; + private transient String versionOfLarge; + + private transient String versionOfMiddle; + + private transient String versionOfLast; + private transient String streamParkScalaVersion = scala.util.Properties.versionNumberString(); public void doSetFlinkConf() throws ApiDetailException { @@ -101,23 +108,31 @@ public void unzipFlinkConf() { this.flinkConf = DeflaterUtils.unzipString(this.flinkConf); } - @JsonIgnore public String getLargeVersion() { - return this.version.substring(0, this.version.lastIndexOf(".")); + if (StringUtils.isNotEmpty(this.version)) { + return this.version.substring(0, this.version.lastIndexOf(".")); + } + return null; } - @JsonIgnore public String getVersionOfFirst() { - return this.version.split("\\.")[0]; + if (StringUtils.isNotEmpty(this.version)) { + return this.version.split("\\.")[0]; + } + return null; } - @JsonIgnore public String getVersionOfMiddle() { - return this.version.split("\\.")[1]; + if (StringUtils.isNotEmpty(this.version)) { + return this.version.split("\\.")[1]; + } + return null; } - @JsonIgnore public String getVersionOfLast() { - return this.version.split("\\.")[2]; + if (StringUtils.isNotEmpty(this.version)) { + return this.version.split("\\.")[2]; + } + return null; } } diff --git a/streampark-console/streampark-console-webapp/src/api/flink/setting/flinkEnv.ts b/streampark-console/streampark-console-webapp/src/api/flink/setting/flinkEnv.ts index 7693cc75d7..49d9893d2f 100644 --- a/streampark-console/streampark-console-webapp/src/api/flink/setting/flinkEnv.ts +++ b/streampark-console/streampark-console-webapp/src/api/flink/setting/flinkEnv.ts @@ -34,12 +34,19 @@ enum FLINK_API { * flink environment data * @returns Promise */ -export function fetchFlinkEnv() { +export function fetchListFlinkEnv() { return defHttp.post({ url: FLINK_API.LIST, }); } +export function fetchFlinkEnv(id: string) { + return defHttp.post({ + url: FLINK_API.GET, + data: { id: id }, + }); +} + /** * Set the default * @param {String} id diff --git a/streampark-console/streampark-console-webapp/src/design/public.less b/streampark-console/streampark-console-webapp/src/design/public.less index af007f3db6..3975f9c048 100644 --- a/streampark-console/streampark-console-webapp/src/design/public.less +++ b/streampark-console/streampark-console-webapp/src/design/public.less @@ -66,7 +66,7 @@ } } -.extra .conf-switch { +.tip-info { + margin-top: 10px; color: darkgrey; - margin-left: 5px; } 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 70236a86a9..3dfd8ade71 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 @@ -69,6 +69,8 @@ export default { status: 'Run Status', startTime: 'Start Time', endTime: 'End Time', + restoreModeTip: + 'restore mode is supported since flink 1.15, usually, you do not have to set this parameter', release: { releaseTitle: 'The current release of the application is in progress.', releaseDesc: 'are you sure you want to force another build', diff --git a/streampark-console/streampark-console-webapp/src/locales/lang/zh-CN/flink/app.ts b/streampark-console/streampark-console-webapp/src/locales/lang/zh-CN/flink/app.ts index 92e788091f..d1b94b5b9a 100644 --- a/streampark-console/streampark-console-webapp/src/locales/lang/zh-CN/flink/app.ts +++ b/streampark-console/streampark-console-webapp/src/locales/lang/zh-CN/flink/app.ts @@ -68,6 +68,7 @@ export default { status: '运行状态', startTime: '启动时间', endTime: '结束时间', + restoreModeTip: 'flink 1.15开始支持restore模式,一般情况下不用设置该参数', release: { releaseTitle: '该应用程序的当前启动正在进行中.', releaseDesc: '您确定要强制进行另一次构建吗', diff --git a/streampark-console/streampark-console-webapp/src/views/flink/app/components/AppView/StartApplicationModal.vue b/streampark-console/streampark-console-webapp/src/views/flink/app/components/AppView/StartApplicationModal.vue index fec877c32a..32bb55830b 100644 --- a/streampark-console/streampark-console-webapp/src/views/flink/app/components/AppView/StartApplicationModal.vue +++ b/streampark-console/streampark-console-webapp/src/views/flink/app/components/AppView/StartApplicationModal.vue @@ -24,7 +24,7 @@ }); - diff --git a/streampark-console/streampark-console-webapp/src/views/setting/FlinkHome/index.vue b/streampark-console/streampark-console-webapp/src/views/setting/FlinkHome/index.vue index 6715dd307c..a819533142 100644 --- a/streampark-console/streampark-console-webapp/src/views/setting/FlinkHome/index.vue +++ b/streampark-console/streampark-console-webapp/src/views/setting/FlinkHome/index.vue @@ -38,7 +38,7 @@ import { fetchValidity, fetchDefaultSet, - fetchFlinkEnv, + fetchListFlinkEnv, fetchFlinkEnvRemove, fetchFlinkInfo, } from '/@/api/flink/setting/flinkEnv'; @@ -102,7 +102,7 @@ /* Get flink environment data */ async function getFlinkSetting() { - flinks.value = await fetchFlinkEnv(); + flinks.value = await fetchListFlinkEnv(); } onMounted(() => { diff --git a/streampark-flink/pom.xml b/streampark-flink/pom.xml index 19184ab60e..961a6e784b 100644 --- a/streampark-flink/pom.xml +++ b/streampark-flink/pom.xml @@ -31,7 +31,6 @@ streampark-flink-shims streampark-flink-core - streampark-flink-connector streampark-flink-sqlclient streampark-flink-udf streampark-flink-client @@ -76,4 +75,13 @@ + + + connector + + streampark-flink-connector + + + +