Browse Source

[Feature][UI] Added the display and hide function of dynamically created workflow buttons. (#12558)

3.2.0-release
songjianet 2 years ago committed by GitHub
parent
commit
53340fc07b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      dolphinscheduler-ui/src/locales/en_US/project.ts
  2. 1
      dolphinscheduler-ui/src/locales/zh_CN/project.ts
  3. 1
      dolphinscheduler-ui/src/store/ui-setting/types.ts
  4. 7
      dolphinscheduler-ui/src/store/ui-setting/ui-setting.ts
  5. 11
      dolphinscheduler-ui/src/views/projects/workflow/definition/index.tsx
  6. 7
      dolphinscheduler-ui/src/views/ui-setting/index.tsx

1
dolphinscheduler-ui/src/locales/en_US/project.ts

@ -44,6 +44,7 @@ export default {
operating_environment: 'Operating Environment', operating_environment: 'Operating Environment',
workflow_relation: 'Workflow Relation', workflow_relation: 'Workflow Relation',
create_workflow: 'Create Workflow', create_workflow: 'Create Workflow',
create_workflow_dynamic: 'Create Workflow (Dynamic)',
import_workflow: 'Import Workflow', import_workflow: 'Import Workflow',
workflow_name: 'Workflow Name', workflow_name: 'Workflow Name',
workflow_instance_name: 'Workflow Instance Name', workflow_instance_name: 'Workflow Instance Name',

1
dolphinscheduler-ui/src/locales/zh_CN/project.ts

@ -44,6 +44,7 @@ export default {
operating_environment: '运行环境', operating_environment: '运行环境',
workflow_relation: '工作流关系', workflow_relation: '工作流关系',
create_workflow: '创建工作流', create_workflow: '创建工作流',
create_workflow_dynamic: '创建工作流 (动态)',
import_workflow: '导入工作流', import_workflow: '导入工作流',
workflow_name: '工作流名称', workflow_name: '工作流名称',
workflow_instance_name: '工作流实例名称', workflow_instance_name: '工作流实例名称',

1
dolphinscheduler-ui/src/store/ui-setting/types.ts

@ -16,6 +16,7 @@
*/ */
interface UISettingStore { interface UISettingStore {
logTimer: number logTimer: number
dynamicTask: boolean
} }
export { UISettingStore } export { UISettingStore }

7
dolphinscheduler-ui/src/store/ui-setting/ui-setting.ts

@ -22,16 +22,23 @@ export const useUISettingStore = defineStore({
id: 'ui-setting', id: 'ui-setting',
state: (): UISettingStore => ({ state: (): UISettingStore => ({
logTimer: 0, logTimer: 0,
dynamicTask: false
}), }),
persist: true, persist: true,
getters: { getters: {
getLogTimer(): number { getLogTimer(): number {
return this.logTimer return this.logTimer
},
getDynamicTask(): boolean {
return this.dynamicTask
} }
}, },
actions: { actions: {
setLogTimer(timer: number): void { setLogTimer(timer: number): void {
this.logTimer = timer this.logTimer = timer
},
setDynamicTask(): void {
this.dynamicTask = !this.dynamicTask
} }
} }
}) })

11
dolphinscheduler-ui/src/views/projects/workflow/definition/index.tsx

@ -36,6 +36,7 @@ import {
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { useTable } from './use-table' import { useTable } from './use-table'
import { useRouter, useRoute } from 'vue-router' import { useRouter, useRoute } from 'vue-router'
import { useUISettingStore } from '@/store/ui-setting/ui-setting'
import Card from '@/components/card' import Card from '@/components/card'
import ImportModal from './components/import-modal' import ImportModal from './components/import-modal'
import StartModal from './components/start-modal' import StartModal from './components/start-modal'
@ -50,6 +51,7 @@ export default defineComponent({
const router: Router = useRouter() const router: Router = useRouter()
const route = useRoute() const route = useRoute()
const projectCode = Number(route.params.projectCode) const projectCode = Number(route.params.projectCode)
const uiSettingStore = useUISettingStore()
const { const {
variables, variables,
@ -114,6 +116,7 @@ export default defineComponent({
batchCopyWorkflow, batchCopyWorkflow,
handleCopyUpdateList, handleCopyUpdateList,
...toRefs(variables), ...toRefs(variables),
uiSettingStore,
trim trim
} }
}, },
@ -142,6 +145,14 @@ export default defineComponent({
> >
{t('project.workflow.import_workflow')} {t('project.workflow.import_workflow')}
</NButton> </NButton>
{
this.uiSettingStore.getDynamicTask && <NButton
size='small'
type='warning'
>
{t('project.workflow.create_workflow_dynamic')}
</NButton>
}
</NSpace> </NSpace>
<NSpace> <NSpace>
<NInput <NInput

7
dolphinscheduler-ui/src/views/ui-setting/index.tsx

@ -31,7 +31,6 @@ const setting = defineComponent({
name: 'ui-setting', name: 'ui-setting',
setup() { setup() {
const uiSettingStore = useUISettingStore() const uiSettingStore = useUISettingStore()
const defaultLogTimer = uiSettingStore.getLogTimer
const logTimerMap = { const logTimerMap = {
0: 'Off', 0: 'Off',
@ -68,7 +67,7 @@ const setting = defineComponent({
value: 1800 value: 1800
} }
] ]
return { defaultLogTimer, logTimerMap, logTimerOptions } return { uiSettingStore, logTimerMap, logTimerOptions }
}, },
render() { render() {
const { t } = useI18n() const { t } = useI18n()
@ -80,7 +79,7 @@ const setting = defineComponent({
<span>{t('ui_setting.refresh_time')}</span> <span>{t('ui_setting.refresh_time')}</span>
<NSelect <NSelect
style={{ width: '200px' }} style={{ width: '200px' }}
default-value={this.logTimerMap[this.defaultLogTimer]} default-value={this.logTimerMap[this.uiSettingStore.getLogTimer]}
options={this.logTimerOptions} options={this.logTimerOptions}
onUpdateValue={handleUpdateValue} onUpdateValue={handleUpdateValue}
/> />
@ -88,7 +87,7 @@ const setting = defineComponent({
<h4>{t('ui_setting.experimental_feature')}</h4> <h4>{t('ui_setting.experimental_feature')}</h4>
<NSpace align='center' justify='space-between'> <NSpace align='center' justify='space-between'>
<span>{t('ui_setting.dynamic_task_component')}</span> <span>{t('ui_setting.dynamic_task_component')}</span>
<NSwitch round={false}></NSwitch> <NSwitch round={false} defaultValue={this.uiSettingStore.getDynamicTask} onUpdateValue={() => this.uiSettingStore.setDynamicTask()}></NSwitch>
</NSpace> </NSpace>
</Card> </Card>
) )

Loading…
Cancel
Save