From 53340fc07b1e7b6d5f76aeb015fc36eb661e4a32 Mon Sep 17 00:00:00 2001
From: songjianet <1778651752@qq.com>
Date: Thu, 27 Oct 2022 14:13:00 +0800
Subject: [PATCH] [Feature][UI] Added the display and hide function of
dynamically created workflow buttons. (#12558)
---
dolphinscheduler-ui/src/locales/en_US/project.ts | 1 +
dolphinscheduler-ui/src/locales/zh_CN/project.ts | 1 +
dolphinscheduler-ui/src/store/ui-setting/types.ts | 1 +
.../src/store/ui-setting/ui-setting.ts | 7 +++++++
.../src/views/projects/workflow/definition/index.tsx | 11 +++++++++++
dolphinscheduler-ui/src/views/ui-setting/index.tsx | 7 +++----
6 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/dolphinscheduler-ui/src/locales/en_US/project.ts b/dolphinscheduler-ui/src/locales/en_US/project.ts
index 1d2416b7d7..115cb70967 100644
--- a/dolphinscheduler-ui/src/locales/en_US/project.ts
+++ b/dolphinscheduler-ui/src/locales/en_US/project.ts
@@ -44,6 +44,7 @@ export default {
operating_environment: 'Operating Environment',
workflow_relation: 'Workflow Relation',
create_workflow: 'Create Workflow',
+ create_workflow_dynamic: 'Create Workflow (Dynamic)',
import_workflow: 'Import Workflow',
workflow_name: 'Workflow Name',
workflow_instance_name: 'Workflow Instance Name',
diff --git a/dolphinscheduler-ui/src/locales/zh_CN/project.ts b/dolphinscheduler-ui/src/locales/zh_CN/project.ts
index 6476e06d67..31c5c64617 100644
--- a/dolphinscheduler-ui/src/locales/zh_CN/project.ts
+++ b/dolphinscheduler-ui/src/locales/zh_CN/project.ts
@@ -44,6 +44,7 @@ export default {
operating_environment: '运行环境',
workflow_relation: '工作流关系',
create_workflow: '创建工作流',
+ create_workflow_dynamic: '创建工作流 (动态)',
import_workflow: '导入工作流',
workflow_name: '工作流名称',
workflow_instance_name: '工作流实例名称',
diff --git a/dolphinscheduler-ui/src/store/ui-setting/types.ts b/dolphinscheduler-ui/src/store/ui-setting/types.ts
index d38d0c7e5e..175a0f115f 100644
--- a/dolphinscheduler-ui/src/store/ui-setting/types.ts
+++ b/dolphinscheduler-ui/src/store/ui-setting/types.ts
@@ -16,6 +16,7 @@
*/
interface UISettingStore {
logTimer: number
+ dynamicTask: boolean
}
export { UISettingStore }
\ No newline at end of file
diff --git a/dolphinscheduler-ui/src/store/ui-setting/ui-setting.ts b/dolphinscheduler-ui/src/store/ui-setting/ui-setting.ts
index bf392dacae..cfa2fb79a2 100644
--- a/dolphinscheduler-ui/src/store/ui-setting/ui-setting.ts
+++ b/dolphinscheduler-ui/src/store/ui-setting/ui-setting.ts
@@ -22,16 +22,23 @@ export const useUISettingStore = defineStore({
id: 'ui-setting',
state: (): UISettingStore => ({
logTimer: 0,
+ dynamicTask: false
}),
persist: true,
getters: {
getLogTimer(): number {
return this.logTimer
+ },
+ getDynamicTask(): boolean {
+ return this.dynamicTask
}
},
actions: {
setLogTimer(timer: number): void {
this.logTimer = timer
+ },
+ setDynamicTask(): void {
+ this.dynamicTask = !this.dynamicTask
}
}
})
diff --git a/dolphinscheduler-ui/src/views/projects/workflow/definition/index.tsx b/dolphinscheduler-ui/src/views/projects/workflow/definition/index.tsx
index 688c1610aa..8773ea7c8e 100644
--- a/dolphinscheduler-ui/src/views/projects/workflow/definition/index.tsx
+++ b/dolphinscheduler-ui/src/views/projects/workflow/definition/index.tsx
@@ -36,6 +36,7 @@ import {
import { useI18n } from 'vue-i18n'
import { useTable } from './use-table'
import { useRouter, useRoute } from 'vue-router'
+import { useUISettingStore } from '@/store/ui-setting/ui-setting'
import Card from '@/components/card'
import ImportModal from './components/import-modal'
import StartModal from './components/start-modal'
@@ -50,6 +51,7 @@ export default defineComponent({
const router: Router = useRouter()
const route = useRoute()
const projectCode = Number(route.params.projectCode)
+ const uiSettingStore = useUISettingStore()
const {
variables,
@@ -114,6 +116,7 @@ export default defineComponent({
batchCopyWorkflow,
handleCopyUpdateList,
...toRefs(variables),
+ uiSettingStore,
trim
}
},
@@ -142,6 +145,14 @@ export default defineComponent({
>
{t('project.workflow.import_workflow')}
+ {
+ this.uiSettingStore.getDynamicTask &&
+ {t('project.workflow.create_workflow_dynamic')}
+
+ }
{t('ui_setting.refresh_time')}
@@ -88,7 +87,7 @@ const setting = defineComponent({
{t('ui_setting.experimental_feature')}
{t('ui_setting.dynamic_task_component')}
-
+ this.uiSettingStore.setDynamicTask()}>
)