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 2022/11/15 13:49:40 UTC
[incubator-streampark] branch dev updated: [improve] fix login input auto fill bug (#2022)
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 d6fe187fb [improve] fix login input auto fill bug (#2022)
d6fe187fb is described below
commit d6fe187fbd2bb6e8b62615a33bc666364c73b1b1
Author: WSZ <wa...@outlook.com>
AuthorDate: Tue Nov 15 21:49:34 2022 +0800
[improve] fix login input auto fill bug (#2022)
* [improve] fix login input auto fill bug
* [refactor] Modify the enumeration in the code
* [Fix] spell and props
---
.../conf/streamx-console-config/application.yml | 2 +
.../console/system/authentication/ShiroConfig.java | 2 +
.../src/components/Form/src/props.ts | 2 +-
.../src/components/Upload/src/props.ts | 2 +-
.../src/design/index.less | 12 +-
.../src/enums/flinkEnum.ts | 146 +++++++++++++++++----
.../setting/components/ThemeColorPicker.vue | 2 +-
.../default/setting/components/TypePicker.vue | 2 +-
.../src/views/flink/app/Add.vue | 18 ++-
.../src/views/flink/app/Detail.vue | 6 +-
.../src/views/flink/app/EditStreamPark.vue | 26 ++--
.../src/views/flink/app/View.vue | 22 ++--
.../src/views/flink/app/components/AppConf.tsx | 22 ++--
.../app/components/AppDetail/CompareModal.vue | 4 +-
.../flink/app/components/AppDetail/DetailTab.vue | 18 ++-
.../flink/app/components/AppView/BuildDrawer.vue | 2 +-
.../components/AppView/StopApplicationModal.vue | 7 +-
.../src/views/flink/app/components/State.tsx | 76 ++++++++---
.../src/views/flink/app/data/detail.data.ts | 9 +-
.../src/views/flink/app/data/index.ts | 22 ++--
.../src/views/flink/app/hooks/useApp.tsx | 56 +++++---
.../src/views/flink/app/hooks/useAppTableAction.ts | 38 ++++--
.../flink/app/hooks/useCreateAndEditSchema.ts | 20 +--
.../src/views/flink/app/hooks/useCreateSchema.ts | 27 +++-
.../src/views/flink/app/hooks/useDetail.ts | 6 +-
.../views/flink/app/hooks/useEditFlinkSchema.ts | 16 ++-
.../src/views/flink/app/hooks/useEditStreamPark.ts | 17 ++-
.../src/views/flink/app/hooks/useFlinkRender.tsx | 5 +-
.../src/views/flink/app/hooks/useFlinkSchema.ts | 138 +++++++++----------
.../src/views/flink/app/utils/index.ts | 70 +++++-----
.../src/views/flink/project/View.vue | 2 +-
.../flink/setting/components/AlertSetting.vue | 37 +++---
.../setting/components/FlinkClusterSetting.vue | 12 +-
33 files changed, 543 insertions(+), 303 deletions(-)
diff --git a/deploy/helm/streamx/conf/streamx-console-config/application.yml b/deploy/helm/streamx/conf/streamx-console-config/application.yml
index 3bc7db276..b318affad 100755
--- a/deploy/helm/streamx/conf/streamx-console-config/application.yml
+++ b/deploy/helm/streamx/conf/streamx-console-config/application.yml
@@ -144,6 +144,7 @@ streampark:
/metrics/**,
/index.html,
/assets/**,
+ /resource/**/**,
/css/**,
/fonts/**,
/img/**,
@@ -153,5 +154,6 @@ streampark:
/*.png,
/*.jpg,
/*.less,
+ /*.ico,
/
diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/authentication/ShiroConfig.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/authentication/ShiroConfig.java
index 8fa0ef897..aa015f9f0 100644
--- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/authentication/ShiroConfig.java
+++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/authentication/ShiroConfig.java
@@ -61,6 +61,7 @@ public class ShiroConfig {
filterChainDefinitionMap.put("/index.html", "anon");
filterChainDefinitionMap.put("/assets/**", "anon");
+ filterChainDefinitionMap.put("/resource/**/**", "anon");
filterChainDefinitionMap.put("/css/**", "anon");
filterChainDefinitionMap.put("/fonts/**", "anon");
filterChainDefinitionMap.put("/img/**", "anon");
@@ -70,6 +71,7 @@ public class ShiroConfig {
filterChainDefinitionMap.put("/*.png", "anon");
filterChainDefinitionMap.put("/*.jpg", "anon");
filterChainDefinitionMap.put("/*.less", "anon");
+ filterChainDefinitionMap.put("/*.ico", "anon");
filterChainDefinitionMap.put("/", "anon");
filterChainDefinitionMap.put("/**", "jwt");
diff --git a/streampark-console/streampark-console-webapp/src/components/Form/src/props.ts b/streampark-console/streampark-console-webapp/src/components/Form/src/props.ts
index 7e1d63b98..2d5d34c4a 100644
--- a/streampark-console/streampark-console-webapp/src/components/Form/src/props.ts
+++ b/streampark-console/streampark-console-webapp/src/components/Form/src/props.ts
@@ -25,7 +25,7 @@ import { propTypes } from '/@/utils/propTypes';
export const basicProps = {
model: {
type: Object as PropType<Recordable>,
- default: {},
+ default: () => ({}),
},
// Label width Fixed width
labelWidth: {
diff --git a/streampark-console/streampark-console-webapp/src/components/Upload/src/props.ts b/streampark-console/streampark-console-webapp/src/components/Upload/src/props.ts
index d141228a5..7c136b75b 100644
--- a/streampark-console/streampark-console-webapp/src/components/Upload/src/props.ts
+++ b/streampark-console/streampark-console-webapp/src/components/Upload/src/props.ts
@@ -41,7 +41,7 @@ export const basicProps = {
},
uploadParams: {
type: Object as PropType<any>,
- default: {},
+ default: () => ({}),
},
api: {
type: Function as PropType<PromiseFn>,
diff --git a/streampark-console/streampark-console-webapp/src/design/index.less b/streampark-console/streampark-console-webapp/src/design/index.less
index e97027a51..b2db63337 100644
--- a/streampark-console/streampark-console-webapp/src/design/index.less
+++ b/streampark-console/streampark-console-webapp/src/design/index.less
@@ -26,9 +26,15 @@ input:-webkit-autofill {
box-shadow: 0 0 0 1000px transparent inset !important;
}
-[data-theme='dark'] input:-webkit-autofill {
- box-shadow: none !important;
- -webkit-text-fill-color: #fff;
+[data-theme='dark'] {
+ input:-webkit-autofill {
+ box-shadow: none !important;
+ -webkit-text-fill-color: #fff;
+ }
+
+ .@{namespace}-login-form input:-webkit-autofill {
+ -webkit-text-fill-color: #000 !important;
+ }
}
:-webkit-autofill {
diff --git a/streampark-console/streampark-console-webapp/src/enums/flinkEnum.ts b/streampark-console/streampark-console-webapp/src/enums/flinkEnum.ts
index 6e97e7c13..28dfaf0f8 100644
--- a/streampark-console/streampark-console-webapp/src/enums/flinkEnum.ts
+++ b/streampark-console/streampark-console-webapp/src/enums/flinkEnum.ts
@@ -43,21 +43,6 @@ export enum ExecModeEnum {
KUBERNETES_APPLICATION = 6,
}
-export const executionMap = {
- /**1. remote (standalone) */
- REMOTE: ExecModeEnum.REMOTE,
- /**2. yarn per-job (deprecated, please use yarn-application mode) */
- YARN_PER_JOB: ExecModeEnum.YARN_PER_JOB,
- /**3. yarn session */
- YARN_SESSION: ExecModeEnum.YARN_SESSION,
- /**4. yarn application */
- YARN_APPLICATION: ExecModeEnum.YARN_APPLICATION,
- /**5. kubernetes session */
- KUBERNETES_SESSION: ExecModeEnum.KUBERNETES_SESSION,
- /**6. kubernetes application */
- KUBERNETES_APPLICATION: ExecModeEnum.KUBERNETES_APPLICATION,
-};
-
export enum LaunchStateEnum {
/** launch failed */
FAILED = -1,
@@ -69,20 +54,16 @@ export enum LaunchStateEnum {
LAUNCHING = 2,
/** launch complete, need restart */
NEED_RESTART = 3,
- /** need rollback */
+ /** need rollback */
NEED_ROLLBACK = 4,
- /**
- * project has changed, need to check the jar whether to be re-selected
- */
+ /** project has changed, need to check the jar whether to be re-selected */
NEED_CHECK = 5,
- /**
- * revoked
- */
+ /** revoked */
REVOKED = 10,
}
export enum OptionStateEnum {
- /** Application which is currently action: none. */
+ /** Application which is currently action: none. */
NONE = 0,
/** Application which is currently action: deploying. */
LAUNCHING = 1,
@@ -93,3 +74,122 @@ export enum OptionStateEnum {
/** Application which is currently action: savepointing. */
SAVEPOINTING = 4,
}
+
+export enum AppStateEnum {
+ /** added new job to database */
+ ADDED = 0,
+ /** The job has been received by the Dispatcher, and is waiting for the job manager to be created. */
+ INITIALIZING = 1,
+ /** Job is newly created, no task has started to run. */
+ CREATED = 2,
+ /** Application which is currently starting. */
+ STARTING = 3,
+ /** Application which is currently running. */
+ RESTARTING = 4,
+ /** Some tasks are scheduled or running, some may be pending, some may be finished. */
+ RUNNING = 5,
+ /** The job has failed and is currently waiting for the cleanup to complete. */
+ FAILING = 6,
+ /** The job has failed with a non-recoverable task failure.*/
+ FAILED = 7,
+ /** Job is being cancelled. */
+ CANCELLING = 8,
+ /** Job has been cancelled. */
+ CANCELED = 9,
+ /** All of the job's tasks have successfully finished. */
+ FINISHED = 10,
+ /** The job has been suspended which means that it has been stopped but not been removed from a potential HA job store. */
+ SUSPENDED = 11,
+ /** The job is currently reconciling and waits for task execution report to recover state. */
+ RECONCILING = 12,
+ /** Lost */
+ LOST = 13,
+ /** MAPPING */
+ MAPPING = 14,
+ /** OTHER */
+ OTHER = 15,
+ /** has rollback */
+ REVOKED = 16,
+ /**
+ * Lost track of flink job temporarily.
+ * A complete loss of flink job tracking translates into LOST state.
+ */
+ SILENT = 17,
+ /** Flink job has terminated vaguely, maybe FINISHED, CACNELED or FAILED */
+ TERMINATED = 18,
+ /** Flink job has terminated vaguely, maybe FINISHED, CACNELED or FAILED */
+ POS_TERMINATED = 19,
+ /** job SUCCEEDED on yarn */
+ SUCCEEDED = 20,
+ /** has killed in Yarn */
+ KILLED = -9,
+}
+
+export enum ClusterStateEnum {
+ /** The cluster was just created but not started */
+ CREATED = 0,
+ /** cluster started */
+ STARTED = 1,
+ /** cluster stopped */
+ STOPED = 2,
+}
+
+export enum AppTypeEnum {
+ /** StreamPark Flink */
+ STREAMPARK_FLINK = 1,
+ /** Apache Flink */
+ APACHE_FLINK = 2,
+ /** StreamPark Spark */
+ STREAMPARK_SPARK = 3,
+ /** Apache Spark */
+ APACHE_SPARK = 4,
+}
+
+export enum JobTypeEnum {
+ JAR = 1,
+ SQL = 2,
+}
+
+export enum CandidateTypeEnum {
+ /** non candidate */
+ NONE = 0,
+ /** newly added record becomes a candidate */
+ NEW = 1,
+ /** specific history becomes a candidate */
+ HISTORY = 2,
+}
+
+export enum ResourceFromEnum {
+ /** cicd(build from cvs) */
+ CICD = 1,
+ /** upload local jar */
+ UPLOAD = 2,
+}
+export enum StrategyEnum {
+ /** use existing */
+ USE_EXIST = 1,
+ /** reselect */
+ RESELECT = 2,
+}
+
+export enum PipelineStepEnum {
+ UNKNOWN = 0,
+ WAITING = 1,
+ RUNNING = 2,
+ SUCCESS = 3,
+ FAILURE = 4,
+ SKIPPED = 5,
+}
+
+export enum AlertTypeEnum {
+ /** mail */
+ MAIL = 1,
+ /** dingtalk */
+ DINGTALK = 2,
+ /** wecom */
+ WECOM = 4,
+ /**message */
+ MESSAGE = 8,
+ /** lark */
+ LARK = 16,
+}
diff --git a/streampark-console/streampark-console-webapp/src/layouts/default/setting/components/ThemeColorPicker.vue b/streampark-console/streampark-console-webapp/src/layouts/default/setting/components/ThemeColorPicker.vue
index aba82f7b9..29f1487d8 100644
--- a/streampark-console/streampark-console-webapp/src/layouts/default/setting/components/ThemeColorPicker.vue
+++ b/streampark-console/streampark-console-webapp/src/layouts/default/setting/components/ThemeColorPicker.vue
@@ -47,7 +47,7 @@
props: {
colorList: {
type: Array as PropType<string[]>,
- defualt: [],
+ default: () => [],
},
event: {
type: Number as PropType<HandlerEnum>,
diff --git a/streampark-console/streampark-console-webapp/src/layouts/default/setting/components/TypePicker.vue b/streampark-console/streampark-console-webapp/src/layouts/default/setting/components/TypePicker.vue
index 264731f65..2c32e0ac5 100644
--- a/streampark-console/streampark-console-webapp/src/layouts/default/setting/components/TypePicker.vue
+++ b/streampark-console/streampark-console-webapp/src/layouts/default/setting/components/TypePicker.vue
@@ -47,7 +47,7 @@
props: {
menuTypeList: {
type: Array as PropType<typeof menuTypeList>,
- defualt: () => [],
+ default: () => [],
},
handler: {
type: Function as PropType<Fn>,
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 1f7e20511..fbb627441 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
@@ -46,6 +46,7 @@
import UseSysHadoopConf from './components/UseSysHadoopConf.vue';
import { CreateParams } from '/@/api/flink/app/app.type';
import { decodeByBase64, encryptByBase64 } from '/@/utils/cipher';
+ import { AppTypeEnum, ClusterStateEnum, JobTypeEnum } from '/@/enums/flinkEnum';
const FlinkSqlEditor = createAsyncComponent(() => import('./components/FlinkSql.vue'), {
loading: true,
@@ -151,13 +152,16 @@
}
}
- function handleCluster(values) {
+ function handleCluster(values: Recordable) {
const cluster =
unref(flinkClusters).filter((c) => {
if (values.flinkClusterId) {
- return c.id == values.flinkClusterId && c.clusterState === 1;
+ return c.id == values.flinkClusterId && c.clusterState === ClusterStateEnum.STARTED;
} else {
- return c.clusterId == values.yarnSessionClusterId && c.clusterState === 1;
+ return (
+ c.clusterId == values.yarnSessionClusterId &&
+ c.clusterState === ClusterStateEnum.STARTED
+ );
}
})[0] || null;
if (cluster) {
@@ -205,7 +209,7 @@
// from upload
Object.assign(params, {
resourceFrom: 2,
- appType: 2,
+ appType: AppTypeEnum.APACHE_FLINK,
jar: unref(uploadJar),
mainClass: values.mainClass,
});
@@ -214,7 +218,7 @@
}
}
/* flink sql mode */
- async function handleSubmitSQL(values) {
+ async function handleSubmitSQL(values: Recordable) {
// Trigger a pom confirmation operation.
await unref(dependencyRef)?.handleApplyPom();
// common params...
@@ -241,9 +245,9 @@
handleCluster(values);
const params = {
- jobType: 2,
+ jobType: JobTypeEnum.SQL,
flinkSql: values.flinkSql,
- appType: 1,
+ appType: AppTypeEnum.STREAMPARK_FLINK,
config,
format: values.isSetConfig ? 1 : null,
dependency:
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 228e818d7..86329b036 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
@@ -16,7 +16,7 @@
-->
<script lang="ts">
import { defineComponent } from 'vue';
- import { ExecModeEnum } from '/@/enums/flinkEnum';
+ import { AppStateEnum, ExecModeEnum } from '/@/enums/flinkEnum';
import { useI18n } from '/@/hooks/web/useI18n';
export default defineComponent({
name: 'ApplicationDetail',
@@ -231,7 +231,9 @@
<a-button
type="danger"
@click="handleFlinkView"
- :disabled="app.state !== 5 || (yarn === null && app.flinkRestUrl === null)"
+ :disabled="
+ app.state !== AppStateEnum.RUNNING || (yarn === null && app.flinkRestUrl === null)
+ "
class="float-right -mt-8px mr-20px"
>
<Icon icon="ant-design:cloud-outlined" />
diff --git a/streampark-console/streampark-console-webapp/src/views/flink/app/EditStreamPark.vue b/streampark-console/streampark-console-webapp/src/views/flink/app/EditStreamPark.vue
index bf45ce4cc..e9533dff6 100644
--- a/streampark-console/streampark-console-webapp/src/views/flink/app/EditStreamPark.vue
+++ b/streampark-console/streampark-console-webapp/src/views/flink/app/EditStreamPark.vue
@@ -48,6 +48,7 @@
import { useGo } from '/@/hooks/web/usePage';
import ProgramArgs from './components/ProgramArgs.vue';
import VariableReview from './components/VariableReview.vue';
+ import { ClusterStateEnum, JobTypeEnum, StrategyEnum } from '/@/enums/flinkEnum';
const route = useRoute();
const go = useGo();
@@ -195,7 +196,9 @@
if (values.yarnSessionClusterId) {
const cluster =
flinkClusters.value.filter(
- (c) => c.clusterId === values.yarnSessionClusterId && c.clusterState === 1,
+ (c) =>
+ c.clusterId === values.yarnSessionClusterId &&
+ c.clusterState === ClusterStateEnum.STARTED,
)[0] || null;
values.clusterId = cluster.id;
values.flinkClusterId = cluster.id;
@@ -229,7 +232,11 @@
async function handleSubmitCustomJob(values: Recordable) {
try {
const format =
- values.strategy == 1 ? app.format : (values.config || '').endsWith('.properties') ? 2 : 1;
+ values.strategy == StrategyEnum.USE_EXIST
+ ? app.format
+ : (values.config || '').endsWith('.properties')
+ ? 2
+ : 1;
let config = values.configOverride || app.config;
if (config != null && config.trim() !== '') {
config = encryptByBase64(config);
@@ -238,14 +245,17 @@
}
if (values.yarnSessionClusterId) {
const cluster =
- flinkClusters.value.filter(
- (c) => c.clusterId === values.yarnSessionClusterId && c.clusterState === 1,
- )[0] || null;
+ flinkClusters.value.filter((c) => {
+ return (
+ c.clusterId === values.yarnSessionClusterId &&
+ c.clusterState === ClusterStateEnum.STARTED
+ );
+ })[0] || null;
values.clusterId = cluster.id;
values.flinkClusterId = cluster.id;
values.yarnSessionClusterId = cluster.clusterId;
}
- const configId = values.strategy == 1 ? app.configId : null;
+ const configId = values.strategy == StrategyEnum.USE_EXIST ? app.configId : null;
const params = {
id: app.id,
format: format,
@@ -289,7 +299,7 @@
Object.assign(app, res);
Object.assign(defaultOptions, JSON.parse(app.options || '{}'));
- if (app.jobType == 2) {
+ if (app.jobType == JobTypeEnum.SQL) {
fetchFlinkHistory({ id: appId }).then((res) => {
flinkSqlHistory.value = res;
});
@@ -333,7 +343,7 @@
handleReset();
}
- function handleMergely(configOverride) {
+ function handleMergely(configOverride: string) {
openConfDrawer(true, {
configOverride,
});
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 b29757790..d9b1b2f9c 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
@@ -15,15 +15,15 @@
limitations under the License.
-->
<script lang="ts">
- import { defineComponent, nextTick, ref, unref, onUnmounted, onMounted } from 'vue';
- import { useAppTableAction } from './hooks/useAppTableAction';
- import { useI18n } from '/@/hooks/web/useI18n';
-
export default defineComponent({
name: 'AppView',
});
</script>
<script lang="ts" setup name="AppView">
+ import { defineComponent, nextTick, ref, unref, onUnmounted, onMounted } from 'vue';
+ import { useAppTableAction } from './hooks/useAppTableAction';
+ import { useI18n } from '/@/hooks/web/useI18n';
+ import { AppStateEnum, JobTypeEnum, OptionStateEnum, LaunchStateEnum } from '/@/enums/flinkEnum';
import { useTimeoutFn } from '@vueuse/core';
import { Tooltip, Badge, Divider, Tag } from 'ant-design-vue';
import { fetchAppRecord } from '/@/api/flink/app/app';
@@ -87,7 +87,7 @@
availableSlot: x.availableSlot,
},
];
- if (x['optionState'] === 0) {
+ if (x['optionState'] === OptionStateEnum.NONE) {
if (optionApps.starting.get(x.id)) {
if (timestamp - optionApps.starting.get(x.id) > 2000 * 2) {
optionApps.starting.delete(x.id);
@@ -135,7 +135,7 @@
/* view */
async function handleJobView(app: AppListRecord) {
// Task is running, restarting, in savePoint
- if ([4, 5].includes(app.state) || app['optionState'] === 4) {
+ if ([4, 5].includes(app.state) || app['optionState'] === OptionStateEnum.SAVEPOINTING) {
console.log(app);
// yarn-per-job|yarn-session|yarn-application
handleView(app, unref(yarn));
@@ -191,22 +191,24 @@
<span
class="link"
:class="{
- pointer: [4, 5].includes(record.state) || record['optionState'] === 4,
+ pointer:
+ [AppStateEnum.RESTARTING, AppStateEnum.RUNNING].includes(record.state) ||
+ record['optionState'] === OptionStateEnum.SAVEPOINTING,
}"
@click="handleJobView(record)"
>
<Tooltip :title="record.description"> {{ record.jobName }} </Tooltip>
</span>
- <template v-if="record['jobType'] === 1">
+ <template v-if="record['jobType'] === JobTypeEnum.JAR">
<Badge
- v-if="record.launch == 5"
+ v-if="record.launch == LaunchStateEnum.NEED_CHECK"
class="build-badge"
count="NEW"
:title="t('flink.app.view.recheck')"
/>
<Badge
- v-else-if="record.launch >= 2"
+ v-else-if="record.launch >= LaunchStateEnum.LAUNCHING"
class="build-badge"
count="NEW"
:title="t('flink.app.view.changed')"
diff --git a/streampark-console/streampark-console-webapp/src/views/flink/app/components/AppConf.tsx b/streampark-console/streampark-console-webapp/src/views/flink/app/components/AppConf.tsx
index 951b050b8..54097091b 100644
--- a/streampark-console/streampark-console-webapp/src/views/flink/app/components/AppConf.tsx
+++ b/streampark-console/streampark-console-webapp/src/views/flink/app/components/AppConf.tsx
@@ -26,6 +26,7 @@ import { ApiTreeSelect } from '/@/components/Form';
import { fetchAppConf, fetchName } from '/@/api/flink/app/app';
import { SettingTwoTone } from '@ant-design/icons-vue';
import { fetchListConf } from '/@/api/flink/project';
+import { StrategyEnum } from '/@/enums/flinkEnum';
export default defineComponent({
name: 'AppConf',
@@ -49,7 +50,7 @@ export default defineComponent({
model.value.configOverride = decodeByBase64(res.content);
}
- async function handleChangeNewConfig(confFile: any) {
+ async function handleChangeNewConfig(confFile: string) {
const res = await fetchName({
config: confFile,
});
@@ -59,7 +60,6 @@ export default defineComponent({
model.value.jobName = res;
model.value.configOverride = decodeByBase64(resp);
}
- console.log('configId', props.model.project);
return () => {
return (
<div>
@@ -70,10 +70,10 @@ export default defineComponent({
value={unref(model).strategy}
onChange={(value: any) => (model.value.strategy = value)}
>
- <Select.Option value="1">use existing</Select.Option>
- <Select.Option value="2">reselect</Select.Option>
+ <Select.Option value={StrategyEnum.USE_EXIST}>use existing</Select.Option>
+ <Select.Option value={StrategyEnum.RESELECT}>reselect</Select.Option>
</Select>
- {unref(model).strategy == 1 && (
+ {unref(model).strategy == StrategyEnum.USE_EXIST && (
<Form.Item style="width: calc(75% - 75px);margin-left:10px;">
<Select
class="!w-full"
@@ -89,7 +89,7 @@ export default defineComponent({
</Select>
</Form.Item>
)}
- {unref(model).strategy == 2 && (
+ {unref(model).strategy == StrategyEnum.RESELECT && (
<Form.Item style="width: calc(75% - 60px)">
<ApiTreeSelect
class="!w-full"
@@ -98,13 +98,19 @@ export default defineComponent({
params={{ id: props.model.project, module: props.model.module }}
placeholder="Please select config"
tree-default-expand-all
- onChange={(value) => handleChangeNewConfig(value)}
+ onChange={(value: string) => handleChangeNewConfig(value)}
></ApiTreeSelect>
</Form.Item>
)}
<Button
- disabled={unref(model).strategy == 1 ? false : unref(model).config ? false : true}
+ disabled={
+ unref(model).strategy == StrategyEnum.USE_EXIST
+ ? false
+ : unref(model).config
+ ? false
+ : true
+ }
type="primary"
class="ml-10px w-50px"
onClick={() => emit('openMergely', unref(model).configOverride)}
diff --git a/streampark-console/streampark-console-webapp/src/views/flink/app/components/AppDetail/CompareModal.vue b/streampark-console/streampark-console-webapp/src/views/flink/app/components/AppDetail/CompareModal.vue
index dd63c162f..856dfc4d5 100644
--- a/streampark-console/streampark-console-webapp/src/views/flink/app/components/AppDetail/CompareModal.vue
+++ b/streampark-console/streampark-console-webapp/src/views/flink/app/components/AppDetail/CompareModal.vue
@@ -17,6 +17,7 @@
<script lang="ts">
import { computed, defineComponent, reactive, ref, toRaw } from 'vue';
import { useI18n } from '/@/hooks/web/useI18n';
+ import { CandidateTypeEnum } from '/@/enums/flinkEnum';
export default defineComponent({
name: 'CompareModal',
});
@@ -99,7 +100,6 @@
function handleCompareTarget(v: string) {
compareRecord.value.target = v;
}
-
const filterNotCurrConfig = computed(() => {
return allConfigVersions.value.filter((x) => x.version !== compareRecord.value.version);
});
@@ -132,7 +132,7 @@
color="cyan"
class="ml-5px"
size="small"
- v-if="ver.candidate == 1 || ver.candidate == 2"
+ v-if="[CandidateTypeEnum.NEW, CandidateTypeEnum.HISTORY].includes(ver.candidate)"
>
{{ t('flink.app.detail.candidate') }}
</Tag>
diff --git a/streampark-console/streampark-console-webapp/src/views/flink/app/components/AppDetail/DetailTab.vue b/streampark-console/streampark-console-webapp/src/views/flink/app/components/AppDetail/DetailTab.vue
index 18b3baaef..a8b42a238 100644
--- a/streampark-console/streampark-console-webapp/src/views/flink/app/components/AppDetail/DetailTab.vue
+++ b/streampark-console/streampark-console-webapp/src/views/flink/app/components/AppDetail/DetailTab.vue
@@ -48,6 +48,7 @@
import ExecOptionModal from './ExecOptionModal.vue';
import { useMessage } from '/@/hooks/web/useMessage';
import { useClipboard } from '@vueuse/core';
+ import { AppTypeEnum, JobTypeEnum } from '/@/enums/flinkEnum';
const DescriptionItem = Descriptions.Item;
const TabPane = Tabs.TabPane;
@@ -76,7 +77,8 @@
watch(
() => props.app.flinkSql,
- () => {
+ (val) => {
+ if (!val) return;
setContent(decodeByBase64(props.app.flinkSql));
},
);
@@ -169,12 +171,12 @@
}
/* delete configuration */
- async function handleDeleteConf(record) {
+ async function handleDeleteConf(record: Recordable) {
await fetchRemoveConf({ id: record.id });
reloadConf();
}
- function handleCompare(record) {
+ function handleCompare(record: Recordable) {
openCompareModal(true, {
id: record.id,
version: record.version,
@@ -202,7 +204,7 @@
];
}
/* delete savePoint */
- async function handleDeleteSavePoint(record) {
+ async function handleDeleteSavePoint(record: Recordable) {
await fetchRemoveSavePoint({ id: record.id });
reloadSavePoint();
}
@@ -234,7 +236,11 @@
</DescriptionItem>
</Descriptions>
</TabPane>
- <TabPane key="2" tab="Configuration" v-if="app && app.appType == 1 && tabConf.showConf">
+ <TabPane
+ key="2"
+ tab="Configuration"
+ v-if="app && app.appType == AppTypeEnum.STREAMPARK_FLINK && tabConf.showConf"
+ >
<BasicTable @register="registerConfigTable">
<template #bodyCell="{ column, record }">
<template v-if="column.dataIndex == 'format'">
@@ -260,7 +266,7 @@
</template>
</BasicTable>
</TabPane>
- <TabPane key="3" tab="Flink SQL" v-if="app.jobType === 2">
+ <TabPane key="3" tab="Flink SQL" v-if="app.jobType === JobTypeEnum.JAR">
<div class="sql-box syntax-true" ref="flinkSql" style="height: 600px"></div>
</TabPane>
<TabPane key="4" tab="Savepoints" v-if="tabConf.showSaveOption">
diff --git a/streampark-console/streampark-console-webapp/src/views/flink/app/components/AppView/BuildDrawer.vue b/streampark-console/streampark-console-webapp/src/views/flink/app/components/AppView/BuildDrawer.vue
index e06621eca..d3146ef8f 100644
--- a/streampark-console/streampark-console-webapp/src/views/flink/app/components/AppView/BuildDrawer.vue
+++ b/streampark-console/streampark-console-webapp/src/views/flink/app/components/AppView/BuildDrawer.vue
@@ -76,7 +76,7 @@
data && onReceiveData(data);
});
/* data reception */
- function onReceiveData(data) {
+ function onReceiveData(data: Recordable) {
appId.value = data.appId;
if (!isPending.value) start();
}
diff --git a/streampark-console/streampark-console-webapp/src/views/flink/app/components/AppView/StopApplicationModal.vue b/streampark-console/streampark-console-webapp/src/views/flink/app/components/AppView/StopApplicationModal.vue
index 26c3a9007..d2bff9bcb 100644
--- a/streampark-console/streampark-console-webapp/src/views/flink/app/components/AppView/StopApplicationModal.vue
+++ b/streampark-console/streampark-console-webapp/src/views/flink/app/components/AppView/StopApplicationModal.vue
@@ -143,7 +143,12 @@
}
</script>
<template>
- <BasicModal @register="registerModal" @ok="handleSubmit" okText="Apply" cancelText="Cancel">
+ <BasicModal
+ @register="registerModal"
+ @ok="handleSubmit"
+ :okText="t('common.apply')"
+ :cancelText="t('common.cancelText')"
+ >
<template #title>
<SvgIcon name="shutdown" style="color: red" />
diff --git a/streampark-console/streampark-console-webapp/src/views/flink/app/components/State.tsx b/streampark-console/streampark-console-webapp/src/views/flink/app/components/State.tsx
index ac7539c7f..7bdb9a288 100644
--- a/streampark-console/streampark-console-webapp/src/views/flink/app/components/State.tsx
+++ b/streampark-console/streampark-console-webapp/src/views/flink/app/components/State.tsx
@@ -18,27 +18,59 @@
import { defineComponent, toRefs, unref } from 'vue';
import { Tag, Tooltip } from 'ant-design-vue';
import './State.less';
-import { LaunchStateEnum, OptionStateEnum } from '/@/enums/flinkEnum';
+import { AppStateEnum, LaunchStateEnum, OptionStateEnum } from '/@/enums/flinkEnum';
/* state map*/
const stateMap = {
- 0: { color: '#2f54eb', title: 'ADDED' },
- 1: { color: '#738df8', title: 'INITIALIZING', class: 'status-processing-initializing' },
- 2: { color: '#2f54eb', title: 'CREATED' },
- 3: { color: '#1AB58E', title: 'STARTING', class: 'status-processing-starting' },
- 4: { color: '#13c2c2', title: 'RESTARTING', class: 'status-processing-restarting' },
- 5: { color: '#52c41a', title: 'RUNNING', class: 'status-processing-running' },
- 6: { color: '#fa541c', title: 'FAILING', class: 'status-processing-failing' },
- 7: { color: '#f5222d', title: 'FAILED' },
- 8: { color: '#faad14', title: 'CANCELLING' },
- 9: { color: '#fa8c16', title: 'CANCELED' },
- 10: { color: '#1890ff', title: 'FINISHED' },
- 11: { color: '#722ed1', title: 'SUSPENDED' },
- 12: { color: '#eb2f96', title: 'RECONCILING', class: 'status-processing-reconciling' },
- 13: { color: '#000000', title: 'LOST' },
- 14: { color: '#13c2c2', title: 'MAPPING', class: 'status-processing-restarting' },
- 17: { color: '#738df8', title: 'SILENT', class: 'status-processing-initializing' },
- 18: { color: '#8E50FF', title: 'TERMINATED' },
+ [AppStateEnum.ADDED]: { color: '#2f54eb', title: 'ADDED' },
+ [AppStateEnum.INITIALIZING]: {
+ color: '#738df8',
+ title: 'INITIALIZING',
+ class: 'status-processing-initializing',
+ },
+ [AppStateEnum.CREATED]: { color: '#2f54eb', title: 'CREATED' },
+ [AppStateEnum.STARTING]: {
+ color: '#1AB58E',
+ title: 'STARTING',
+ class: 'status-processing-starting',
+ },
+ [AppStateEnum.RESTARTING]: {
+ color: '#13c2c2',
+ title: 'RESTARTING',
+ class: 'status-processing-restarting',
+ },
+ [AppStateEnum.RUNNING]: {
+ color: '#52c41a',
+ title: 'RUNNING',
+ class: 'status-processing-running',
+ },
+ [AppStateEnum.FAILING]: {
+ color: '#fa541c',
+ title: 'FAILING',
+ class: 'status-processing-failing',
+ },
+ [AppStateEnum.FAILED]: { color: '#f5222d', title: 'FAILED' },
+ [AppStateEnum.CANCELLING]: { color: '#faad14', title: 'CANCELLING' },
+ [AppStateEnum.CANCELED]: { color: '#fa8c16', title: 'CANCELED' },
+ [AppStateEnum.FINISHED]: { color: '#1890ff', title: 'FINISHED' },
+ [AppStateEnum.SUSPENDED]: { color: '#722ed1', title: 'SUSPENDED' },
+ [AppStateEnum.RECONCILING]: {
+ color: '#eb2f96',
+ title: 'RECONCILING',
+ class: 'status-processing-reconciling',
+ },
+ [AppStateEnum.LOST]: { color: '#000000', title: 'LOST' },
+ [AppStateEnum.MAPPING]: {
+ color: '#13c2c2',
+ title: 'MAPPING',
+ class: 'status-processing-restarting',
+ },
+ [AppStateEnum.SILENT]: {
+ color: '#738df8',
+ title: 'SILENT',
+ class: 'status-processing-initializing',
+ },
+ [AppStateEnum.TERMINATED]: { color: '#8E50FF', title: 'TERMINATED' },
};
/* option state map*/
const optionStateMap = {
@@ -122,7 +154,7 @@ export default defineComponent({
};
const renderState = () => {
- if (unref(data).optionState === 0) {
+ if (unref(data).optionState === OptionStateEnum.NONE) {
return <div class="app_state">{renderTag(stateMap, unref(data).state)}</div>;
} else {
return <div class="app_state">{renderTag(optionStateMap, unref(data).optionState)}</div>;
@@ -146,7 +178,11 @@ export default defineComponent({
});
}
const renderOtherOption = () => {
- if ([4, 5, 6].includes(unref(data)?.state || unref(data)?.optionState == 4)) {
+ if (
+ [AppStateEnum.RESTARTING, AppStateEnum.RUNNING, AppStateEnum.FAILING].includes(
+ unref(data)?.state || unref(data)?.optionState == OptionStateEnum.SAVEPOINTING,
+ )
+ ) {
return (
<div class="task-tag">
{unref(data).totalTask && (
diff --git a/streampark-console/streampark-console-webapp/src/views/flink/app/data/detail.data.ts b/streampark-console/streampark-console-webapp/src/views/flink/app/data/detail.data.ts
index c806a26d7..a0ae2490f 100644
--- a/streampark-console/streampark-console-webapp/src/views/flink/app/data/detail.data.ts
+++ b/streampark-console/streampark-console-webapp/src/views/flink/app/data/detail.data.ts
@@ -21,6 +21,7 @@ import { h } from 'vue';
import State from '../components/State';
import Icon from '/@/components/Icon';
import { dateToDuration } from '/@/utils/dateUtil';
+import { AppTypeEnum, JobTypeEnum } from '/@/enums/flinkEnum';
export const getDescSchema = (): DescItem[] => {
return [
@@ -43,14 +44,14 @@ export const getDescSchema = (): DescItem[] => {
),
),
},
- { field: 'module', label: 'Module', show: (data) => data.jobType != 2 },
- { field: 'projectName', label: 'Project', show: (data) => data.jobType != 2 },
+ { field: 'module', label: 'Module', show: (data) => data.jobType != JobTypeEnum.SQL },
+ { field: 'projectName', label: 'Project', show: (data) => data.jobType != JobTypeEnum.SQL },
{
field: 'appType',
label: 'Application Type',
render: (curVal) =>
- h(Tag, { color: curVal == 1 ? 'cyan' : 'blue' }, () =>
- curVal == 1 ? 'StreamPark Flink' : 'Apache Flink',
+ h(Tag, { color: curVal == AppTypeEnum.STREAMPARK_FLINK ? 'cyan' : 'blue' }, () =>
+ curVal == AppTypeEnum.STREAMPARK_FLINK ? 'StreamPark Flink' : 'Apache Flink',
),
},
{
diff --git a/streampark-console/streampark-console-webapp/src/views/flink/app/data/index.ts b/streampark-console/streampark-console-webapp/src/views/flink/app/data/index.ts
index 7fe8b8ce2..baf1e9ded 100644
--- a/streampark-console/streampark-console-webapp/src/views/flink/app/data/index.ts
+++ b/streampark-console/streampark-console-webapp/src/views/flink/app/data/index.ts
@@ -16,7 +16,7 @@
*/
import { dateToDuration } from '/@/utils/dateUtil';
import { BasicColumn } from '/@/components/Table';
-import { ExecModeEnum, LaunchStateEnum } from '/@/enums/flinkEnum';
+import { ExecModeEnum, LaunchStateEnum, AppStateEnum } from '/@/enums/flinkEnum';
import { useI18n } from '/@/hooks/web/useI18n';
const { t } = useI18n();
@@ -45,16 +45,16 @@ export const getAppColumns = (): BasicColumn[] => [
dataIndex: 'state',
width: 120,
filters: [
- { text: t('flink.app.runStatusOptions.added'), value: '0' },
- { text: t('flink.app.runStatusOptions.starting'), value: '3' },
- { text: t('flink.app.runStatusOptions.running'), value: '5' },
- { text: t('flink.app.runStatusOptions.failed'), value: '7' },
- { text: t('flink.app.runStatusOptions.canceled'), value: '9' },
- { text: t('flink.app.runStatusOptions.finished'), value: '10' },
- { text: t('flink.app.runStatusOptions.suspended'), value: '11' },
- { text: t('flink.app.runStatusOptions.lost'), value: '13' },
- { text: t('flink.app.runStatusOptions.silent'), value: '17' },
- { text: t('flink.app.runStatusOptions.terminated'), value: '18' },
+ { text: t('flink.app.runStatusOptions.added'), value: String(AppStateEnum.ADDED) },
+ { text: t('flink.app.runStatusOptions.starting'), value: String(AppStateEnum.STARTING) },
+ { text: t('flink.app.runStatusOptions.running'), value: String(AppStateEnum.RUNNING) },
+ { text: t('flink.app.runStatusOptions.failed'), value: String(AppStateEnum.FAILED) },
+ { text: t('flink.app.runStatusOptions.canceled'), value: String(AppStateEnum.CANCELED) },
+ { text: t('flink.app.runStatusOptions.finished'), value: String(AppStateEnum.FINISHED) },
+ { text: t('flink.app.runStatusOptions.suspended'), value: String(AppStateEnum.SUSPENDED) },
+ { text: t('flink.app.runStatusOptions.lost'), value: String(AppStateEnum.LOST) },
+ { text: t('flink.app.runStatusOptions.silent'), value: String(AppStateEnum.SILENT) },
+ { text: t('flink.app.runStatusOptions.terminated'), value: String(AppStateEnum.TERMINATED) },
],
},
{ title: t('flink.app.launchBuild'), dataIndex: 'launch', width: 220 },
diff --git a/streampark-console/streampark-console-webapp/src/views/flink/app/hooks/useApp.tsx b/streampark-console/streampark-console-webapp/src/views/flink/app/hooks/useApp.tsx
index 1f078ba50..d927c6e4e 100644
--- a/streampark-console/streampark-console-webapp/src/views/flink/app/hooks/useApp.tsx
+++ b/streampark-console/streampark-console-webapp/src/views/flink/app/hooks/useApp.tsx
@@ -22,6 +22,7 @@ import { fetchBuild, fetchBuildDetail } from '/@/api/flink/app/flinkBuild';
import { fetchLatest, fetchSavePonitHistory } from '/@/api/flink/app/savepoint';
import { fetchAppOwners } from '/@/api/system/user';
import { SvgIcon } from '/@/components/Icon';
+import { AppStateEnum, ExecModeEnum, OptionStateEnum } from '/@/enums/flinkEnum';
import { useI18n } from '/@/hooks/web/useI18n';
import { useMessage } from '/@/hooks/web/useMessage';
@@ -38,14 +39,14 @@ export const useFlinkApplication = (openStartModal: Fn) => {
};
/* check */
- function handleCheckLaunchApp(app) {
+ function handleCheckLaunchApp(app: Recordable) {
if (app['appControl']['allowBuild'] === true) {
handleLaunchApp(app, false);
} else {
createWarningModal({
title: 'WARNING',
content: `
- <p>${t('flink.app.launch.launchTitle')}</p>
+ <p class="pt-10px">${t('flink.app.launch.launchTitle')}</p>
<p>${t('flink.app.launch.launchDesc')}</p>
`,
okType: 'danger',
@@ -55,7 +56,7 @@ export const useFlinkApplication = (openStartModal: Fn) => {
}
/* Launch App */
- async function handleLaunchApp(app, force: boolean) {
+ async function handleLaunchApp(app: Recordable, force: boolean) {
const { data } = await fetchBuild({
appId: app.id,
forceBuild: force,
@@ -79,7 +80,7 @@ export const useFlinkApplication = (openStartModal: Fn) => {
}
/* start application */
- function handleAppCheckStart(app) {
+ function handleAppCheckStart(app: Recordable) {
// when then app is building, show forced starting modal
if (app['appControl']['allowStart'] === false) {
handleFetchBuildDetail(app);
@@ -88,10 +89,12 @@ export const useFlinkApplication = (openStartModal: Fn) => {
content: () => {
const content: Array<VNode> = [];
if (appBuildDetail.pipeline == null) {
- content.push(h('p', null, 'No build record exists for the current application.'));
+ content.push(
+ h('p', { class: 'pt-10px' }, 'No build record exists for the current application.'),
+ );
} else {
content.push(
- h('p', null, [
+ h('p', { class: 'pt-10px' }, [
'The current build state of the application is',
h(
Tag,
@@ -115,11 +118,11 @@ export const useFlinkApplication = (openStartModal: Fn) => {
}
}
- async function handleStart(app) {
+ async function handleStart(app: Recordable) {
if (app.flinkVersion == null) {
Swal.fire('Failed', 'please set flink version first.', 'error');
} else {
- if (!optionApps.starting.get(app.id) || app['optionState'] === 0) {
+ if (!optionApps.starting.get(app.id) || app['optionState'] === OptionStateEnum.NONE) {
const res = await fetchLatest({
appId: app.id,
});
@@ -129,7 +132,7 @@ export const useFlinkApplication = (openStartModal: Fn) => {
pageNum: 1,
pageSize: 9999,
});
- historySavePoint.value = resp.records.filter((x) => x.path);
+ historySavePoint.value = resp.records.filter((x: Recordable) => x.path);
}
openStartModal(true, {
latestSavePoint: res,
@@ -141,7 +144,7 @@ export const useFlinkApplication = (openStartModal: Fn) => {
}
}
- async function handleFetchBuildDetail(app) {
+ async function handleFetchBuildDetail(app: Recordable) {
const res = await fetchBuildDetail({
appId: app.id,
});
@@ -149,24 +152,37 @@ export const useFlinkApplication = (openStartModal: Fn) => {
appBuildDetail.docker = res.docker;
}
- function handleCanStop(app) {
+ function handleCanStop(app: Recordable) {
const optionTime = new Date(app['optionTime']).getTime();
const nowTime = new Date().getTime();
if (nowTime - optionTime >= 60 * 1000) {
const state = app['optionState'];
- if (state === 0) {
- return [3, 4, 8].includes(app.state) || false;
+ if (state === OptionStateEnum.NONE) {
+ return (
+ [AppStateEnum.STARTING, AppStateEnum.RESTARTING, AppStateEnum.CANCELLING].includes(
+ app.state,
+ ) || false
+ );
}
return true;
}
return false;
}
- function handleForcedStop(app) {
+ function handleForcedStop(app: Recordable) {
let option = 'starting';
const optionState = app['optionState'];
- const stateMap = { 3: 'starting', 4: 'restarting', 8: 'cancelling' };
- const optionStateMap = { 1: 'launching', 2: 'cancelling', 3: 'starting', 4: 'savePointing' };
- if (optionState === 0) {
+ const stateMap = {
+ [AppStateEnum.STARTING]: 'starting',
+ [AppStateEnum.RESTARTING]: 'restarting',
+ [AppStateEnum.CANCELLING]: 'cancelling',
+ };
+ const optionStateMap = {
+ [OptionStateEnum.LAUNCHING]: 'launching',
+ [OptionStateEnum.CANCELLING]: 'cancelling',
+ [OptionStateEnum.STARTING]: 'starting',
+ [OptionStateEnum.SAVEPOINTING]: 'savePointing',
+ };
+ if (optionState === OptionStateEnum.NONE) {
option = stateMap[app.state];
} else {
option = optionStateMap[optionState];
@@ -292,7 +308,11 @@ export const useFlinkApplication = (openStartModal: Fn) => {
<Form.Item label="Application Name">
<Alert message={app.jobName} type="info" />
</Form.Item>
- {[2, 3, 4].includes(app.executionMode) && (
+ {[
+ ExecModeEnum.YARN_PER_JOB,
+ ExecModeEnum.YARN_SESSION,
+ ExecModeEnum.YARN_APPLICATION,
+ ].includes(app.executionMode) && (
<Form.Item
label="YARN Application Id"
name="appId"
diff --git a/streampark-console/streampark-console-webapp/src/views/flink/app/hooks/useAppTableAction.ts b/streampark-console/streampark-console-webapp/src/views/flink/app/hooks/useAppTableAction.ts
index 8633f4e6e..37889c3b9 100644
--- a/streampark-console/streampark-console-webapp/src/views/flink/app/hooks/useAppTableAction.ts
+++ b/streampark-console/streampark-console-webapp/src/views/flink/app/hooks/useAppTableAction.ts
@@ -24,13 +24,16 @@ import { AppListRecord } from '/@/api/flink/app/app.type';
import { fetchFlamegraph } from '/@/api/flink/app/metrics';
import { ActionItem, FormProps } from '/@/components/Table';
import { useMessage } from '/@/hooks/web/useMessage';
-import { ExecModeEnum, LaunchStateEnum, OptionStateEnum } from '/@/enums/flinkEnum';
+import {
+ AppTypeEnum,
+ ExecModeEnum,
+ LaunchStateEnum,
+ OptionStateEnum,
+ AppStateEnum,
+ JobTypeEnum,
+} from '/@/enums/flinkEnum';
import { usePermission } from '/@/hooks/web/usePermission';
import { useI18n } from '/@/hooks/web/useI18n';
-export enum JobTypeEnum {
- JAR = 1,
- SQL = 2,
-}
// Create form configurations and operation functions in the application table
export const useAppTableAction = (
@@ -97,7 +100,8 @@ export const useAppTableAction = (
},
{
tooltip: { title: t('flink.app.operation.cancel') },
- ifShow: record.state === 5 && record['optionState'] == OptionStateEnum.NONE,
+ ifShow:
+ record.state == AppStateEnum.RUNNING && record['optionState'] == OptionStateEnum.NONE,
auth: 'app:cancel',
icon: 'ant-design:pause-circle-outlined',
onClick: handleCancel.bind(null, record),
@@ -131,10 +135,10 @@ export const useAppTableAction = (
// Record the current page number
sessionStorage.setItem('appPageNo', String(currentPageNo || 1));
flinkAppStore.setApplicationId(app.id);
- if (app.appType == 1) {
+ if (app.appType == AppTypeEnum.STREAMPARK_FLINK) {
// jobType( 1 custom code 2: flinkSQL)
router.push({ path: '/flink/app/edit_streampark', query: { appId: app.id } });
- } else if (app.appType == 2) {
+ } else if (app.appType == AppTypeEnum.APACHE_FLINK) {
//Apache Flink
router.push({ path: '/flink/app/edit_flink', query: { appId: app.id } });
}
@@ -162,7 +166,13 @@ export const useAppTableAction = (
},
{
label: t('flink.app.operation.remapping'),
- ifShow: [0, 7, 10, 11, 13].includes(record.state),
+ ifShow: [
+ AppStateEnum.ADDED,
+ AppStateEnum.FAILED,
+ AppStateEnum.FINISHED,
+ AppStateEnum.SUSPENDED,
+ AppStateEnum.LOST,
+ ].includes(record.state),
auth: 'app:mapping',
icon: 'ant-design:deployment-unit-outlined',
onClick: handleMapping.bind(null, record),
@@ -180,7 +190,15 @@ export const useAppTableAction = (
confirm: handleDelete.bind(null, record),
},
label: t('common.delText'),
- ifShow: [0, 7, 9, 10, 13, 18, 19].includes(record.state),
+ ifShow: [
+ AppStateEnum.ADDED,
+ AppStateEnum.FAILED,
+ AppStateEnum.CANCELED,
+ AppStateEnum.FINISHED,
+ AppStateEnum.LOST,
+ AppStateEnum.TERMINATED,
+ AppStateEnum.POS_TERMINATED,
+ ].includes(record.state),
auth: 'app:delete',
icon: 'ant-design:delete-outlined',
color: 'error',
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 7e6d94345..96fa616d5 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
@@ -48,7 +48,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 { ExecModeEnum } from '/@/enums/flinkEnum';
+import { ClusterStateEnum, ExecModeEnum, JobTypeEnum } from '/@/enums/flinkEnum';
import { isK8sExecMode } from '../utils';
import { useI18n } from '/@/hooks/web/useI18n';
const { t } = useI18n();
@@ -93,7 +93,7 @@ export const useCreateAndEditSchema = (
.filter((o) => {
// Edit mode has one more filter condition
if (edit?.mode) {
- return o.executionMode == executionMode && o.clusterState === 1;
+ return o.executionMode == executionMode && o.clusterState === ClusterStateEnum.STARTED;
} else {
return o.executionMode == executionMode;
}
@@ -110,7 +110,7 @@ export const useCreateAndEditSchema = (
slot: 'flinkSql',
ifShow: ({ values }) => {
if (edit?.appId) {
- return values?.jobType == 2;
+ return values?.jobType == JobTypeEnum.SQL;
} else {
return values?.jobType == 'sql';
}
@@ -124,7 +124,7 @@ export const useCreateAndEditSchema = (
slot: 'dependency',
ifShow: ({ values }) => {
if (edit?.appId) {
- return values.jobType == 2;
+ return values.jobType == JobTypeEnum.SQL;
} else {
return values?.jobType == 'sql';
}
@@ -137,7 +137,7 @@ export const useCreateAndEditSchema = (
component: 'Switch',
ifShow: ({ values }) => {
if (edit?.appId) {
- return values?.jobType == 2 && !isK8sExecMode(values.executionMode);
+ return values?.jobType == JobTypeEnum.SQL && !isK8sExecMode(values.executionMode);
} else {
return values?.jobType == 'sql' && !isK8sExecMode(values.executionMode);
}
@@ -215,7 +215,7 @@ export const useCreateAndEditSchema = (
component: 'Select',
componentProps: {
placeholder: t('flink.app.flinkCluster'),
- options: getExecutionCluster(1, 'id'),
+ options: getExecutionCluster(ExecModeEnum.REMOTE, 'id'),
},
ifShow: ({ values }) => values.executionMode == ExecModeEnum.REMOTE,
rules: [{ required: true, message: 'Flink Cluster is required' }],
@@ -227,7 +227,7 @@ export const useCreateAndEditSchema = (
componentProps: () => {
return {
placeholder: t('flink.app.addAppTips.yarnSessionClusterIdPlaceholder'),
- options: getExecutionCluster(3, 'clusterId'),
+ options: getExecutionCluster(ExecModeEnum.YARN_SESSION, 'clusterId'),
};
},
ifShow: ({ values }) => values.executionMode == ExecModeEnum.YARN_SESSION,
@@ -251,7 +251,7 @@ export const useCreateAndEditSchema = (
componentProps: ({ formModel }) => {
return {
placeholder: t('flink.app.addAppTips.kubernetesClusterIdPlaceholder'),
- onChange: (e) => (formModel.jobName = e.target.value),
+ onChange: (e: ChangeEvent) => (formModel.jobName = e.target.value),
};
},
ifShow: ({ values }) => values.executionMode == ExecModeEnum.KUBERNETES_APPLICATION,
@@ -264,7 +264,7 @@ export const useCreateAndEditSchema = (
ifShow: ({ values }) => values.executionMode == ExecModeEnum.KUBERNETES_SESSION,
componentProps: {
placeholder: t('flink.app.addAppTips.kubernetesClusterIdPlaceholder'),
- options: getExecutionCluster(5, 'clusterId'),
+ options: getExecutionCluster(ExecModeEnum.KUBERNETES_SESSION, 'clusterId'),
},
rules: [
{
@@ -498,7 +498,7 @@ export const useCreateAndEditSchema = (
label: t('flink.app.developmentMode'),
component: 'Input',
render: ({ model }) => {
- if (model.jobType == 1) {
+ if (model.jobType == JobTypeEnum.JAR) {
return h(
Alert,
{ type: 'info' },
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 4cbdae54a..69c006e47 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
@@ -29,6 +29,7 @@ import { StoreValue } from 'ant-design-vue/lib/form/interface';
import { renderResourceFrom } from './useFlinkRender';
import { filterOption } from '../utils';
import { useI18n } from '/@/hooks/web/useI18n';
+import { AppTypeEnum } from '/@/enums/flinkEnum';
const { t } = useI18n();
const getJobTypeOptions = () => {
@@ -96,7 +97,7 @@ export const useCreateSchema = (dependencyRef: Ref) => {
return {
placeholder: t('flink.app.addAppTips.developmentModePlaceholder'),
options: getJobTypeOptions(),
- onChange: (value) => {
+ onChange: (value: string) => {
if (value === 'sql') {
formModel.tableEnv = 1;
} else {
@@ -126,7 +127,13 @@ export const useCreateSchema = (dependencyRef: Ref) => {
if (value === null || value === undefined || value === '') {
return Promise.reject(t('flink.app.addAppTips.executionModeIsRequiredMessage'));
} else {
- if ([2, 3, 4].includes(value)) {
+ if (
+ [
+ ExecModeEnum.YARN_PER_JOB,
+ ExecModeEnum.YARN_SESSION,
+ ExecModeEnum.YARN_APPLICATION,
+ ].includes(value)
+ ) {
const res = await fetchCheckHadoop();
if (res) {
return Promise.resolve();
@@ -219,8 +226,8 @@ export const useCreateSchema = (dependencyRef: Ref) => {
return {
placeholder: t('flink.app.addAppTips.appTypePlaceholder'),
options: [
- { label: 'StreamPark Flink', value: '1' },
- { label: 'Apache Flink', value: '2' },
+ { label: 'StreamPark Flink', value: String(AppTypeEnum.STREAMPARK_FLINK) },
+ { label: 'Apache Flink', value: String(AppTypeEnum.APACHE_FLINK) },
],
onChange: () => {
Object.assign(formModel, {
@@ -262,7 +269,9 @@ export const useCreateSchema = (dependencyRef: Ref) => {
};
},
ifShow: ({ values }) =>
- values?.jobType != 'sql' && values?.resourceFrom != 'upload' && values.appType == '2',
+ values?.jobType != 'sql' &&
+ values?.resourceFrom != 'upload' &&
+ values.appType == String(AppTypeEnum.APACHE_FLINK),
rules: [{ required: true, message: t('flink.app.addAppTips.programJarIsRequiredMessage') }],
},
{
@@ -271,7 +280,9 @@ export const useCreateSchema = (dependencyRef: Ref) => {
component: 'Input',
componentProps: { placeholder: t('flink.app.addAppTips.mainClassPlaceholder') },
ifShow: ({ values }) =>
- values?.jobType != 'sql' && values?.resourceFrom != 'upload' && values.appType == '2',
+ values?.jobType != 'sql' &&
+ values?.resourceFrom != 'upload' &&
+ values.appType == String(AppTypeEnum.APACHE_FLINK),
rules: [{ required: true, message: t('flink.app.addAppTips.mainClassIsRequiredMessage') }],
},
{
@@ -296,7 +307,9 @@ export const useCreateSchema = (dependencyRef: Ref) => {
};
},
ifShow: ({ values }) =>
- values?.jobType != 'sql' && values?.resourceFrom != 'upload' && values.appType == '1',
+ values?.jobType != 'sql' &&
+ values?.resourceFrom != 'upload' &&
+ values.appType == String(AppTypeEnum.STREAMPARK_FLINK),
dynamicRules: () => [{ required: true, validator: handleCheckConfig }],
},
{
diff --git a/streampark-console/streampark-console-webapp/src/views/flink/app/hooks/useDetail.ts b/streampark-console/streampark-console-webapp/src/views/flink/app/hooks/useDetail.ts
index 509dfe52d..a186220c1 100644
--- a/streampark-console/streampark-console-webapp/src/views/flink/app/hooks/useDetail.ts
+++ b/streampark-console/streampark-console-webapp/src/views/flink/app/hooks/useDetail.ts
@@ -61,12 +61,12 @@ export const userDetail = (
}
/* delete configuration */
- async function handleDeleteConf(record) {
+ async function handleDeleteConf(record: Recordable) {
await fetchRemoveConf({ id: record.id });
reloadConf();
}
- function handleCompare(record) {
+ function handleCompare(record: Recordable) {
openCompareModal(true, {
id: record.id,
version: record.version,
@@ -105,7 +105,7 @@ export const userDetail = (
}
}
/* delete savePoint */
- async function handleDeleteSavePoint(record) {
+ async function handleDeleteSavePoint(record: Recordable) {
await fetchRemoveSavePoint({ id: record.id });
reloadSavePoint();
}
diff --git a/streampark-console/streampark-console-webapp/src/views/flink/app/hooks/useEditFlinkSchema.ts b/streampark-console/streampark-console-webapp/src/views/flink/app/hooks/useEditFlinkSchema.ts
index c679beb72..e76bced57 100644
--- a/streampark-console/streampark-console-webapp/src/views/flink/app/hooks/useEditFlinkSchema.ts
+++ b/streampark-console/streampark-console-webapp/src/views/flink/app/hooks/useEditFlinkSchema.ts
@@ -23,6 +23,7 @@ import { getAlertSvgIcon } from './useFlinkRender';
import { Alert } from 'ant-design-vue';
import { useRoute } from 'vue-router';
import { fetchMain } from '/@/api/flink/app/app';
+import { ResourceFromEnum } from '/@/enums/flinkEnum';
export const useEditFlinkSchema = (jars: Ref) => {
const flinkSql = ref();
@@ -54,8 +55,9 @@ export const useEditFlinkSchema = (jars: Ref) => {
label: 'Resource From',
component: 'Input',
render: ({ model }) => {
- if (model.resourceFrom == 1) return getAlertSvgIcon('github', 'CICD (build from CSV)');
- else if (model.resourceFrom == 2)
+ if (model.resourceFrom == ResourceFromEnum.CICD)
+ return getAlertSvgIcon('github', 'CICD (build from CSV)');
+ else if (model.resourceFrom == ResourceFromEnum.UPLOAD)
return getAlertSvgIcon('upload', 'Upload (upload local job)');
else return '';
},
@@ -66,14 +68,14 @@ export const useEditFlinkSchema = (jars: Ref) => {
label: 'Project',
component: 'Input',
render: ({ model }) => h(Alert, { message: model.projectName, type: 'info' }),
- ifShow: ({ model }) => model.resourceFrom == 1,
+ ifShow: ({ model }) => model.resourceFrom == ResourceFromEnum.CICD,
},
{
field: 'module',
label: 'Module',
component: 'Input',
render: ({ model }) => h(Alert, { message: model.module, type: 'info' }),
- ifShow: ({ model }) => model.resourceFrom == 1,
+ ifShow: ({ model }) => model.resourceFrom == ResourceFromEnum.CICD,
},
{
field: 'jar',
@@ -94,7 +96,7 @@ export const useEditFlinkSchema = (jars: Ref) => {
},
};
},
- ifShow: ({ model }) => model.resourceFrom == 1,
+ ifShow: ({ model }) => model.resourceFrom == ResourceFromEnum.CICD,
rules: [{ required: true, message: 'Please select jar' }],
},
{
@@ -102,14 +104,14 @@ export const useEditFlinkSchema = (jars: Ref) => {
label: 'Upload Job Jar',
component: 'Select',
slot: 'uploadJobJar',
- ifShow: ({ model }) => model.resourceFrom != 1,
+ ifShow: ({ model }) => model.resourceFrom != ResourceFromEnum.CICD,
},
{
field: 'jar',
label: 'Program Jar',
component: 'Input',
dynamicDisabled: true,
- ifShow: ({ model }) => model.resourceFrom !== 1,
+ ifShow: ({ model }) => model.resourceFrom !== ResourceFromEnum.CICD,
},
{
field: 'mainClass',
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 8cf09b97f..ca3a52bfa 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
@@ -17,8 +17,7 @@
import { FormSchema } from '/@/components/Table';
import { computed, h, Ref, ref, unref } from 'vue';
import { executionModes } from '../data';
-import { ExecModeEnum } from '/@/enums/flinkEnum';
-
+import { ExecModeEnum, JobTypeEnum, StrategyEnum } from '/@/enums/flinkEnum';
import { useCreateAndEditSchema } from './useCreateAndEditSchema';
import { renderSqlHistory } from './useFlinkRender';
import { Alert } from 'ant-design-vue';
@@ -137,7 +136,7 @@ export const useEditStreamParkSchema = (
{ handleChangeSQL, handleCompareOk },
),
ifShow: ({ values }) => {
- return values.jobType == 2 && unref(flinkSqlHistory).length > 1;
+ return values.jobType == JobTypeEnum.SQL && unref(flinkSqlHistory).length > 1;
},
required: true,
},
@@ -147,7 +146,7 @@ export const useEditStreamParkSchema = (
label: 'Project',
component: 'Input',
render: ({ model }) => h(Alert, { message: model.projectName, type: 'info' }),
- ifShow: ({ values }) => values.jobType != 2,
+ ifShow: ({ values }) => values.jobType != JobTypeEnum.SQL,
},
{ field: 'project', label: 'ProjectId', component: 'Input', show: false },
{
@@ -155,7 +154,7 @@ export const useEditStreamParkSchema = (
label: 'Application',
component: 'Input',
render: ({ model }) => h(Alert, { message: model.module, type: 'info' }),
- ifShow: ({ values }) => values.jobType != 2,
+ ifShow: ({ values }) => values.jobType != JobTypeEnum.SQL,
},
{ field: 'configId', label: 'configId', component: 'Input', show: false },
{
@@ -163,7 +162,7 @@ export const useEditStreamParkSchema = (
label: 'Application conf',
component: 'Input',
slot: 'appConf',
- ifShow: ({ values }) => values.jobType != 2,
+ ifShow: ({ values }) => values.jobType != JobTypeEnum.SQL,
},
{
field: 'compareConf',
@@ -172,7 +171,11 @@ export const useEditStreamParkSchema = (
slot: 'compareConf',
defaultValue: [],
ifShow: ({ values }) => {
- return values.jobType != 2 && values.strategy == 1 && unref(configVersions).length > 1;
+ return (
+ values.jobType != 2 &&
+ values.strategy == StrategyEnum.USE_EXIST &&
+ unref(configVersions).length > 1
+ );
},
},
{
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 557d8e41e..a6925f69b 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,6 +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 } from '/@/enums/flinkEnum';
/* render input dropdown component */
export const renderInputDropdown = (
@@ -427,7 +428,7 @@ export const renderSqlHistory = (
</Tag>
)}
- {[1, 2].includes(ver.candidate) && (
+ {[CandidateTypeEnum.NEW, CandidateTypeEnum.HISTORY].includes(ver.candidate) && (
<Tag color="cyan" style=";margin-left: 5px;" size="small">
Candidate
</Tag>
@@ -466,7 +467,7 @@ export const renderCompareSelectTag = (ver: any) => {
</Tag>
)}
- {[1, 2].includes(ver.candidate) && (
+ {[CandidateTypeEnum.NEW, CandidateTypeEnum.HISTORY].includes(ver.candidate) && (
<Tag color="cyan" style=";margin-left: 5px;" size="small">
Candidate
</Tag>
diff --git a/streampark-console/streampark-console-webapp/src/views/flink/app/hooks/useFlinkSchema.ts b/streampark-console/streampark-console-webapp/src/views/flink/app/hooks/useFlinkSchema.ts
index aed2f7e7b..920e166e8 100644
--- a/streampark-console/streampark-console-webapp/src/views/flink/app/hooks/useFlinkSchema.ts
+++ b/streampark-console/streampark-console-webapp/src/views/flink/app/hooks/useFlinkSchema.ts
@@ -19,7 +19,7 @@ import { h, onMounted, reactive, ref, unref, toRaw } from 'vue';
import optionData from '../data/option';
import { fetchFlinkCluster } from '/@/api/flink/setting/flinkCluster';
import { FlinkCluster } from '/@/api/flink/setting/types/flinkCluster.type';
-import { ExecModeEnum } from '/@/enums/flinkEnum';
+import { ExecModeEnum, ClusterStateEnum } from '/@/enums/flinkEnum';
import {
fetchFlinkBaseImages,
@@ -45,13 +45,14 @@ import { Alert } from 'ant-design-vue';
import { useDrawer } from '/@/components/Drawer';
import { fetchSelect } from '/@/api/flink/project';
import { isK8sExecMode } from '../utils';
-
+import { useI18n } from '/@/hooks/web/useI18n';
+const { t } = useI18n();
export const useFlinkSchema = (editModel?: string) => {
const [registerConfDrawer, { openDrawer: openConfDrawer }] = useDrawer();
const getExecutionCluster = (executionMode) => {
if (editModel) {
return (toRaw(unref(flinkClusters)) || []).filter(
- (o) => o.executionMode == executionMode && o.clusterState === 1,
+ (o) => o.executionMode == executionMode && o.clusterState === ClusterStateEnum.STARTED,
);
} else {
return (toRaw(unref(flinkClusters)) || []).filter((o) => o.executionMode == executionMode);
@@ -62,17 +63,20 @@ export const useFlinkSchema = (editModel?: string) => {
return [
{
field: 'versionId',
- label: 'Flink Version',
+ label: t('flink.app.flinkVersion'),
component: 'Select',
+ componentProps: {
+ placeholder: t('flink.app.flinkVersion'),
+ },
rules: [{ required: true, message: 'Flink Version is required' }],
},
{
field: 'flinkClusterId',
- label: 'Flink Cluster',
+ label: t('flink.app.flinkCluster'),
component: 'Select',
componentProps: {
- placeholder: 'Flink Cluster',
- options: (getExecutionCluster(1) || []).map((i) => ({
+ placeholder: t('flink.app.flinkCluster'),
+ options: (getExecutionCluster(ExecModeEnum.REMOTE) || []).map((i) => ({
label: i.clusterName,
value: i.id,
})),
@@ -82,12 +86,12 @@ export const useFlinkSchema = (editModel?: string) => {
},
{
field: 'yarnSessionClusterId',
- label: 'Yarn Session ClusterId',
+ label: t('flink.app.yarnSessionClusterId'),
component: 'Select',
componentProps: () => {
- const options = getExecutionCluster(3);
+ const options = getExecutionCluster(ExecModeEnum.YARN_SESSION);
return {
- placeholder: 'Please Select Yarn Session clusterId',
+ placeholder: t('flink.app.addAppTips.yarnSessionClusterIdPlaceholder'),
options: options.map((i) => ({ label: i.clusterName, value: i.clusterId })),
};
},
@@ -96,62 +100,68 @@ export const useFlinkSchema = (editModel?: string) => {
},
{
field: 'k8sNamespace',
- label: 'Kubernetes Namespace',
+ label: t('flink.app.kubernetesNamespace'),
component: 'Input',
ifShow: ({ values }) => isK8sExecMode(values.executionMode),
render: ({ model, field }) =>
renderInputDropdown(model, field, {
- placeholder: 'default',
+ placeholder: t('flink.app.addAppTips.kubernetesNamespacePlaceholder'),
options: historyRecord.k8sNamespace,
}),
},
{
field: 'clusterId',
- label: 'Kubernetes ClusterId',
+ label: t('flink.app.kubernetesClusterId'),
component: 'Input',
componentProps: ({ formModel }) => {
return {
- placeholder: 'Please enter Kubernetes clusterId',
- onChange: (e) => (formModel.jobName = e.target.value),
+ placeholder: t('flink.app.addAppTips.kubernetesClusterIdPlaceholder'),
+ onChange: (e: ChangeEvent) => (formModel.jobName = e.target.value),
};
},
ifShow: ({ values }) => values.executionMode == ExecModeEnum.KUBERNETES_APPLICATION,
- rules: [{ required: true, message: 'Kubernetes clusterId is required' }],
+ rules: [
+ { required: true, message: t('flink.app.addAppTips.kubernetesClusterIdPlaceholder') },
+ ],
},
{
field: 'clusterId',
- label: 'Kubernetes ClusterId',
+ label: t('flink.app.kubernetesClusterId'),
component: 'Select',
ifShow: ({ values }) => values.executionMode == ExecModeEnum.KUBERNETES_SESSION,
componentProps: {
- placeholder: 'Please enter Kubernetes clusterId',
- options: (getExecutionCluster(5) || []).map((i) => ({
+ placeholder: t('flink.app.addAppTips.kubernetesClusterIdPlaceholder'),
+ options: (getExecutionCluster(ExecModeEnum.KUBERNETES_SESSION) || []).map((i) => ({
label: i.clusterName,
value: i.clusterId,
})),
},
- rules: [{ required: true, message: 'Kubernetes clusterId is required' }],
+ rules: [
+ {
+ required: true,
+ message: t('flink.app.addAppTips.kubernetesClusterIdIsRequiredMessage'),
+ },
+ ],
},
{
field: 'flinkImage',
- label: 'Flink Base Docker Image',
+ label: t('flink.app.flinkBaseDockerImage'),
component: 'Input',
ifShow: ({ values }) => values.executionMode == ExecModeEnum.KUBERNETES_APPLICATION,
render: ({ model, field }) =>
renderInputDropdown(model, field, {
- placeholder:
- 'Please enter the tag of Flink base docker image, such as: flink:1.13.0-scala_2.11-java8',
+ placeholder: t('flink.app.addAppTips.flinkImagePlaceholder'),
options: historyRecord.k8sSessionClusterId,
}),
- rules: [{ required: true, message: 'Flink Base Docker Image is required' }],
+ rules: [{ required: true, message: t('flink.app.addAppTips.flinkImageIsRequiredMessage') }],
},
{
field: 'k8sRestExposedType',
- label: 'Rest-Service Exposed Type',
+ label: t('flink.app.restServiceExposedType'),
ifShow: ({ values }) => values.executionMode == ExecModeEnum.KUBERNETES_APPLICATION,
component: 'Select',
componentProps: {
- placeholder: 'kubernetes.rest-service.exposed.type',
+ placeholder: t('flink.app.addAppTips.k8sRestExposedTypePlaceholder'),
options: k8sRestExposedType,
},
},
@@ -161,10 +171,10 @@ export const useFlinkSchema = (editModel?: string) => {
const getFlinkFormOtherSchemas = (appId?: string): FormSchema[] => [
{
field: 'jobName',
- label: 'Application Name',
+ label: t('flink.app.appName'),
component: 'Input',
componentProps: {
- placeholder: 'Please enter jobName',
+ placeholder: t('flink.app.addAppTips.appNamePlaceholder'),
},
dynamicRules: () => {
return [
@@ -173,7 +183,7 @@ export const useFlinkSchema = (editModel?: string) => {
trigger: 'blur',
validator: async (_rule, value) => {
if (value === null || value === undefined || value === '') {
- return Promise.reject('Application Name is required');
+ return Promise.reject(t('flink.app.addAppTips.appNameIsRequiredMessage'));
} else {
const params = { jobName: value };
if (appId) Object.assign(params, { id: appId });
@@ -182,21 +192,13 @@ export const useFlinkSchema = (editModel?: string) => {
case 0:
return Promise.resolve();
case 1:
- return Promise.reject(
- 'application name must be unique. The application name already exists',
- );
+ return Promise.reject(t('flink.app.addAppTips.appNameNotUniqueMessage'));
case 2:
- return Promise.reject(
- 'The application name is already running in yarn,cannot be repeated. Please check',
- );
+ return Promise.reject(t('flink.app.addAppTips.appNameExistsInYarnMessage'));
case 3:
- return Promise.reject(
- 'The application name is already running in k8s,cannot be repeated. Please check',
- );
+ return Promise.reject(t('flink.app.addAppTips.appNameExistsInK8sMessage'));
default:
- return Promise.reject(
- 'The application name is invalid.characters must be (Chinese|English|"-"|"_"),two consecutive spaces cannot appear.Please check',
- );
+ return Promise.reject(t('flink.app.addAppTips.appNameNotValid'));
}
}
},
@@ -206,15 +208,15 @@ export const useFlinkSchema = (editModel?: string) => {
},
{
field: 'tags',
- label: 'Tags',
+ label: t('flink.app.tags'),
component: 'Input',
componentProps: {
- placeholder: 'Please enter tags,if more than one, separate them with commas(,)',
+ placeholder: t('flink.app.addAppTips.tagsPlaceholder'),
},
},
{
field: 'resolveOrder',
- label: 'Resolve Order',
+ label: t('flink.app.resolveOrder'),
component: 'Select',
componentProps: {
placeholder: 'classloader.resolve-order',
@@ -224,10 +226,10 @@ export const useFlinkSchema = (editModel?: string) => {
},
{
field: 'parallelism',
- label: 'Parallelism',
+ label: t('flink.app.parallelism'),
component: 'InputNumber',
componentProps: {
- placeholder: 'The parallelism with which to run the program',
+ placeholder: t('flink.app.addAppTips.parallelismPlaceholder'),
min: 1,
step: 1,
class: '!w-full',
@@ -235,10 +237,10 @@ export const useFlinkSchema = (editModel?: string) => {
},
{
field: 'slot',
- label: 'Task Slots',
+ label: t('flink.app.dashboard.taskSlots'),
component: 'InputNumber',
componentProps: {
- placeholder: 'Number of slots per TaskManager',
+ placeholder: t('flink.app.addAppTips.slotsOfPerTaskManagerPlaceholder'),
min: 1,
step: 1,
class: '!w-full',
@@ -246,11 +248,11 @@ export const useFlinkSchema = (editModel?: string) => {
},
{
field: 'restartSize',
- label: 'Fault Restart Size',
+ label: t('flink.app.restartSize'),
ifShow: ({ values }) => (editModel == 'flink' ? true : !isK8sExecMode(values.executionMode)),
component: 'InputNumber',
componentProps: {
- placeholder: 'restart max size',
+ placeholder: t('flink.app.addAppTips.restartSizePlaceholder'),
min: 1,
step: 1,
class: '!w-full',
@@ -258,17 +260,17 @@ export const useFlinkSchema = (editModel?: string) => {
},
{
field: 'alertId',
- label: 'Fault Alert Template',
+ label: t('flink.app.faultAlertTemplate'),
component: 'Select',
componentProps: {
- placeholder: 'Alert Template',
+ placeholder: t('flink.app.addAppTips.alertTemplatePlaceholder'),
options: unref(alerts),
fieldNames: { label: 'alertName', value: 'id', options: 'options' },
},
},
{
field: 'checkPointFailure',
- label: 'CheckPoint Failure Options',
+ label: t('flink.app.checkPointFailureOptions'),
component: 'InputNumber',
renderColContent: renderInputGroup,
show: ({ values }) => (editModel == 'flink' ? true : !isK8sExecMode(values.executionMode)),
@@ -276,7 +278,7 @@ export const useFlinkSchema = (editModel?: string) => {
...getConfigSchemas(),
{
field: 'totalOptions',
- label: 'Total Memory Options',
+ label: t('flink.app.totalMemoryOptions'),
component: 'Select',
render: (renderCallbackParams) => renderTotalMemory(renderCallbackParams),
},
@@ -289,14 +291,14 @@ export const useFlinkSchema = (editModel?: string) => {
},
{
field: 'jmOptions',
- label: 'JM Memory Options',
+ label: t('flink.app.jmMemoryOptions'),
component: 'Select',
componentProps: {
showSearch: true,
allowClear: true,
mode: 'multiple',
maxTagCount: 2,
- placeholder: 'Please select the resource parameters to set',
+ placeholder: t('flink.app.addAppTips.totalMemoryOptionsPlaceholder'),
fieldNames: { label: 'name', value: 'key', options: 'options' },
options: optionData.filter((x) => x.group === 'jobmanager-memory'),
},
@@ -310,14 +312,14 @@ export const useFlinkSchema = (editModel?: string) => {
},
{
field: 'tmOptions',
- label: 'TM Memory Options',
+ label: t('flink.app.tmMemoryOptions'),
component: 'Select',
componentProps: {
showSearch: true,
allowClear: true,
mode: 'multiple',
maxTagCount: 2,
- placeholder: 'Please select the resource parameters to set',
+ placeholder: t('flink.app.addAppTips.tmPlaceholder'),
fieldNames: { label: 'name', value: 'key', options: 'options' },
options: optionData.filter((x) => x.group === 'taskmanager-memory'),
},
@@ -331,29 +333,27 @@ export const useFlinkSchema = (editModel?: string) => {
},
{
field: 'yarnQueue',
- label: 'Yarn Queue',
+ label: t('flink.app.yarnQueue'),
component: 'Input',
- componentProps: {
- placeholder: 'Please enter yarn queue',
- },
+ componentProps: { placeholder: t('flink.app.addAppTips.yarnQueuePlaceholder') },
ifShow: ({ values }) => values.executionMode == ExecModeEnum.YARN_APPLICATION,
},
{
field: 'podTemplate',
- label: 'Kubernetes Pod Template',
+ label: t('flink.app.podTemplate'),
component: 'Input',
slot: 'podTemplate',
ifShow: ({ values }) => values.executionMode == ExecModeEnum.KUBERNETES_APPLICATION,
},
{
field: 'dynamicProperties',
- label: 'Dynamic Properties',
+ label: t('flink.app.dynamicProperties'),
component: 'Input',
render: (renderCallbackParams) => renderDynamicProperties(renderCallbackParams),
},
{
field: 'args',
- label: 'Program Args',
+ label: t('flink.app.programArgs'),
component: 'InputTextArea',
defaultValue: '',
slot: 'args',
@@ -361,11 +361,11 @@ export const useFlinkSchema = (editModel?: string) => {
},
{
field: 'description',
- label: 'Description',
+ label: t('common.description'),
component: 'InputTextArea',
componentProps: {
rows: 4,
- placeholder: 'Please enter description for this application',
+ placeholder: t('flink.app.addAppTips.descriptionPlaceholder'),
},
},
];
@@ -375,7 +375,7 @@ export const useFlinkSchema = (editModel?: string) => {
return [
{
field: 'jobType',
- label: 'Development Mode',
+ label: t('flink.app.developmentMode'),
component: 'Input',
render: ({ model }) => {
if (model.jobType == 1) {
@@ -396,7 +396,7 @@ export const useFlinkSchema = (editModel?: string) => {
},
{
field: 'appType',
- label: 'Application Type',
+ label: t('flink.app.appType'),
component: 'Input',
render: () => getAlertSvgIcon('flink', 'StreamPark Flink'),
},
diff --git a/streampark-console/streampark-console-webapp/src/views/flink/app/utils/index.ts b/streampark-console/streampark-console-webapp/src/views/flink/app/utils/index.ts
index 0c11c04cb..9ee8e27e9 100644
--- a/streampark-console/streampark-console-webapp/src/views/flink/app/utils/index.ts
+++ b/streampark-console/streampark-console-webapp/src/views/flink/app/utils/index.ts
@@ -18,9 +18,15 @@ import { optionsKeyMapping } from '../data/option';
import { fetchYarn } from '/@/api/flink/app/app';
import { AppListRecord } from '/@/api/flink/app/app.type';
import { fetchActiveURL } from '/@/api/flink/setting/flinkCluster';
-import { ExecModeEnum, LaunchStateEnum } from '/@/enums/flinkEnum';
+import {
+ AppStateEnum,
+ ExecModeEnum,
+ LaunchStateEnum,
+ OptionStateEnum,
+ PipelineStepEnum,
+} from '/@/enums/flinkEnum';
-export function handleAppBuildStatusColor(statusCode) {
+export function handleAppBuildStatusColor(statusCode: number) {
switch (statusCode) {
case 0:
return '#99A3A4';
@@ -75,21 +81,16 @@ export function handleAppBuildStepTimelineColor(step) {
}
}
-export function handleAppBuildStepText(stepStatus) {
- switch (stepStatus) {
- case 0:
- return 'UNKNOWN';
- case 1:
- return 'WAITING';
- case 2:
- return 'RUNNING';
- case 3:
- return 'SUCCESS';
- case 4:
- return 'FAILURE';
- case 5:
- return 'SKIPPED';
- }
+export function handleAppBuildStepText(stepStatus: number) {
+ const buildStepMap = {
+ [PipelineStepEnum.UNKNOWN]: 'UNKNOWN',
+ [PipelineStepEnum.WAITING]: 'WAITING',
+ [PipelineStepEnum.RUNNING]: 'RUNNING',
+ [PipelineStepEnum.SUCCESS]: 'SUCCESS',
+ [PipelineStepEnum.FAILURE]: 'FAILURE',
+ [PipelineStepEnum.SKIPPED]: 'SKIPPED',
+ };
+ return buildStepMap[stepStatus];
}
// Field Description Filter
@@ -124,22 +125,20 @@ export async function handleView(app: AppListRecord, yarn: Nullable<string>) {
}
}
-export function handleIsStart(app, optionApps) {
- /**
- * FAILED(7),
- * CANCELED(9),
- * FINISHED(10),
- * SUSPENDED(11),
- * LOST(13),
- * OTHER(15),
- * REVOKED(16),
- * TERMINATED(18),
- * POS_TERMINATED(19),
- * SUCCEEDED(20),
- * KILLED(-9)
- * @type {boolean}
- */
- const status = [0, 7, 9, 10, 11, 13, 16, 18, 19, 20, -9].includes(app.state);
+export function handleIsStart(app: Recordable, optionApps: Recordable) {
+ const status = [
+ AppStateEnum.ADDED,
+ AppStateEnum.FAILED,
+ AppStateEnum.CANCELED,
+ AppStateEnum.FINISHED,
+ AppStateEnum.SUSPENDED,
+ AppStateEnum.LOST,
+ AppStateEnum.REVOKED,
+ AppStateEnum.TERMINATED,
+ AppStateEnum.POS_TERMINATED,
+ AppStateEnum.SUCCEEDED,
+ AppStateEnum.KILLED,
+ ].includes(app.state);
/**
* Deployment failed FAILED(-1),
@@ -154,12 +153,13 @@ export function handleIsStart(app, optionApps) {
const launch = [LaunchStateEnum.DONE, LaunchStateEnum.NEED_RESTART].includes(app.launch);
- const optionState = !optionApps.starting.get(app.id) || app['optionState'] === 0 || false;
+ const optionState =
+ !optionApps.starting.get(app.id) || app['optionState'] === OptionStateEnum.NONE || false;
return status && launch && optionState;
}
-export function handleYarnQueue(values) {
+export function handleYarnQueue(values: Recordable) {
if (values.executionMode == ExecModeEnum.YARN_APPLICATION) {
const queue = values['yarnQueue'];
if (queue != null && queue !== '' && queue !== undefined) {
diff --git a/streampark-console/streampark-console-webapp/src/views/flink/project/View.vue b/streampark-console/streampark-console-webapp/src/views/flink/project/View.vue
index 428e9fead..331d4280f 100644
--- a/streampark-console/streampark-console-webapp/src/views/flink/project/View.vue
+++ b/streampark-console/streampark-console-webapp/src/views/flink/project/View.vue
@@ -132,7 +132,7 @@
{ immediate: false },
);
/* View log */
- function handleViewLog(value) {
+ function handleViewLog(value: Recordable) {
openLogModal(true, { project: value });
}
// teamid update
diff --git a/streampark-console/streampark-console-webapp/src/views/flink/setting/components/AlertSetting.vue b/streampark-console/streampark-console-webapp/src/views/flink/setting/components/AlertSetting.vue
index b9d9fb81f..43a06074e 100644
--- a/streampark-console/streampark-console-webapp/src/views/flink/setting/components/AlertSetting.vue
+++ b/streampark-console/streampark-console-webapp/src/views/flink/setting/components/AlertSetting.vue
@@ -17,6 +17,7 @@
<script lang="ts">
import { defineComponent } from 'vue';
import { useI18n } from '/@/hooks/web/useI18n';
+ import { AlertTypeEnum } from '/@/enums/flinkEnum';
export default defineComponent({
name: 'AlertSetting',
@@ -55,11 +56,11 @@
alerts.value = res;
}
const alertTypeMap = {
- 1: 'mail',
- 2: 'dingtalk',
- 4: 'wecom',
- 8: 'message',
- 16: 'lark',
+ [AlertTypeEnum.MAIL]: 'mail',
+ [AlertTypeEnum.DINGTALK]: 'dingtalk',
+ [AlertTypeEnum.WECOM]: 'wecom',
+ [AlertTypeEnum.MESSAGE]: 'message',
+ [AlertTypeEnum.LARK]: 'lark',
};
/* compute type */
function computeAlertType(level: number) {
@@ -103,15 +104,15 @@
if (item.alertTypeTags?.includes('1')) {
emailParams = JSON.parse(item.emailParams);
}
- if (item.alertTypeTags?.includes('2')) {
+ if (item.alertTypeTags?.includes(String(AlertTypeEnum.DINGTALK))) {
dingTalkParams = JSON.parse(item.dingTalkParams);
// dingtalkIsAtAll = dingTalkParams.isAtAll;
// dingtalkSecretEnable = dingTalkParams.secretEnable;
}
- if (item.alertTypeTags?.includes('4')) {
+ if (item.alertTypeTags?.includes(String(AlertTypeEnum.WECOM))) {
weComParams = JSON.parse(item.weComParams) as Recordable;
}
- if (item.alertTypeTags?.includes('16')) {
+ if (item.alertTypeTags?.includes(String(AlertTypeEnum.LARK))) {
larkParams = JSON.parse(item.larkParams) as Recordable;
// larkIsAtAll = larkParams.isAtAll;
// larkSecretEnable = larkParams.secretEnable;
@@ -259,29 +260,29 @@
</template>
<AlertTypeInfo
- alertType="1"
+ :alertType="String(AlertTypeEnum.MAIL)"
:alertSource="item"
- v-if="item.alertTypeTags.includes('1')"
+ v-if="item.alertTypeTags.includes(String(AlertTypeEnum.MAIL))"
/>
<AlertTypeInfo
- alertType="2"
+ :alertType="String(AlertTypeEnum.WECOM)"
:alertSource="item"
- v-if="item.alertTypeTags.includes('2')"
+ v-if="item.alertTypeTags.includes(String(AlertTypeEnum.WECOM))"
/>
<AlertTypeInfo
- alertType="4"
+ :alertType="String(AlertTypeEnum.DINGTALK)"
:alertSource="item"
- v-if="item.alertTypeTags.includes('4')"
+ v-if="item.alertTypeTags.includes(String(AlertTypeEnum.DINGTALK))"
/>
<AlertTypeInfo
- alertType="8"
+ :alertType="String(AlertTypeEnum.MESSAGE)"
:alertSource="item"
- v-if="item.alertTypeTags.includes('8')"
+ v-if="item.alertTypeTags.includes(String(AlertTypeEnum.MESSAGE))"
/>
<AlertTypeInfo
- alertType="16"
+ :alertType="String(AlertTypeEnum.LARK)"
:alertSource="item"
- v-if="item.alertTypeTags.includes('16')"
+ v-if="item.alertTypeTags.includes(String(AlertTypeEnum.LARK))"
/>
</Card>
</ListItem>
diff --git a/streampark-console/streampark-console-webapp/src/views/flink/setting/components/FlinkClusterSetting.vue b/streampark-console/streampark-console-webapp/src/views/flink/setting/components/FlinkClusterSetting.vue
index f67b100b1..1ef52e6f4 100644
--- a/streampark-console/streampark-console-webapp/src/views/flink/setting/components/FlinkClusterSetting.vue
+++ b/streampark-console/streampark-console-webapp/src/views/flink/setting/components/FlinkClusterSetting.vue
@@ -17,7 +17,7 @@
<script lang="ts">
import { defineComponent } from 'vue';
import { exceptionPropWidth } from '/@/utils';
- import { executionMap } from '/@/enums/flinkEnum';
+ import { ClusterStateEnum, ExecModeEnum } from '/@/enums/flinkEnum';
export default defineComponent({
name: 'FlinkClusterSetting',
});
@@ -58,7 +58,7 @@
stoped: new Map(),
};
function isSessionMode(mode: number): boolean {
- return [executionMap.YARN_SESSION, executionMap.KUBERNETES_SESSION].includes(mode);
+ return [ExecModeEnum.YARN_SESSION, ExecModeEnum.KUBERNETES_SESSION].includes(mode);
}
/* Get flink environmental data*/
@@ -67,9 +67,9 @@
clusters.value = clusterList;
for (const key in clusterList) {
const cluster = clusterList[key];
- if (cluster.clusterState === 0) {
+ if (cluster.clusterState === ClusterStateEnum.CREATED) {
optionClusters.created.set(cluster.id, new Date().getTime());
- } else if (cluster.clusterState === 1) {
+ } else if (cluster.clusterState === ClusterStateEnum.STARTED) {
optionClusters.starting.set(cluster.id, new Date().getTime());
} else {
optionClusters.stoped.set(cluster.id, new Date().getTime());
@@ -217,7 +217,7 @@
<template #actions>
<Tooltip :title="t('flink.setting.cluster.edit')">
<a-button
- v-if="handleIsStart(item) && item.executionMode == executionMap.YARN_SESSION"
+ v-if="handleIsStart(item) && item.executionMode == ExecModeEnum.YARN_SESSION"
v-auth="'cluster:update'"
:disabled="true"
@click="handleEditCluster(item)"
@@ -228,7 +228,7 @@
<EditOutlined />
</a-button>
<a-button
- v-if="!handleIsStart(item) || item.executionMode == executionMap.REMOTE"
+ v-if="!handleIsStart(item) || item.executionMode == ExecModeEnum.REMOTE"
v-auth="'cluster:update'"
@click="handleEditCluster(item)"
shape="circle"