From fbbfbda9ed83d8b35fc73022445938bd1ca3b003 Mon Sep 17 00:00:00 2001 From: calvin Date: Thu, 22 Dec 2022 09:21:54 +0800 Subject: [PATCH] [Fix-13144][UI] Worked out the issue with failing to query workflow instances by the incorrect workflow status. #13243 --- dolphinscheduler-ui/src/common/common.ts | 124 +++++++++++++++++- dolphinscheduler-ui/src/common/types.ts | 25 ++++ .../src/locales/en_US/project.ts | 4 +- .../src/locales/zh_CN/project.ts | 4 +- .../components/process-instance-condition.tsx | 4 +- 5 files changed, 156 insertions(+), 5 deletions(-) diff --git a/dolphinscheduler-ui/src/common/common.ts b/dolphinscheduler-ui/src/common/common.ts index 1c2fb478ff..e8701184a2 100644 --- a/dolphinscheduler-ui/src/common/common.ts +++ b/dolphinscheduler-ui/src/common/common.ts @@ -36,8 +36,8 @@ import { } from '@vicons/antd' import { format, parseISO } from 'date-fns' import _ from 'lodash' -import { ITaskStateConfig } from './types' +import { ITaskStateConfig, IWorkflowExecutionStateConfig } from './types' /** * Intelligent display kb m */ @@ -139,6 +139,21 @@ export const stateType = (t: any) => [ })) ] +/** + * State code table + */ +export const workflowExecutionStateType = (t: any) => [ + { + value: '', + label: `${t('project.workflow.all_status')}` + }, + ...Object.entries(workflowExecutionState(t)).map(([key, item]) => ({ + value: key, + label: item.desc + })) +] + + /** * Stream task state */ @@ -314,6 +329,113 @@ export const tasksState = (t: any): ITaskStateConfig => ({ } }) +/** + * Workflow execution status + * @id id + * @desc tooltip + * @color color + * @icon icon + * @isSpin is loading (Need to execute the code block to write if judgment) + */ +export const workflowExecutionState = (t: any): IWorkflowExecutionStateConfig => ({ + SUBMITTED_SUCCESS: { + id: 0, + desc: `${t('project.workflow.submit_success')}`, + color: '#A9A9A9', + icon: IssuesCloseOutlined, + isSpin: false, + classNames: 'submitted_success' + }, + RUNNING_EXECUTION: { + id: 1, + desc: `${t('project.workflow.executing')}`, + color: '#0097e0', + icon: SettingFilled, + isSpin: true, + classNames: 'running_execution' + }, + READY_PAUSE: { + id: 2, + desc: `${t('project.workflow.ready_to_pause')}`, + color: '#07b1a3', + icon: SettingOutlined, + isSpin: false, + classNames: 'ready_pause' + }, + PAUSE: { + id: 3, + desc: `${t('project.workflow.pause')}`, + color: '#057c72', + icon: PauseCircleOutlined, + isSpin: false, + classNames: 'pause' + }, + READY_STOP: { + id: 4, + desc: `${t('project.workflow.ready_to_stop')}`, + color: '#FE0402', + icon: StopFilled, + isSpin: false, + classNames: 'ready_stop' + }, + STOP: { + id: 5, + desc: `${t('project.workflow.stop')}`, + color: '#e90101', + icon: StopOutlined, + isSpin: false, + classNames: 'stop' + }, + FAILURE: { + id: 6, + desc: `${t('project.workflow.failed')}`, + color: '#000000', + icon: CloseCircleOutlined, + isSpin: false, + classNames: 'failed' + }, + SUCCESS: { + id: 7, + desc: `${t('project.workflow.success')}`, + color: '#95DF96', + icon: CheckCircleOutlined, + isSpin: false, + classNames: 'success' + }, + DELAY_EXECUTION: { + id: 12, + desc: `${t('project.workflow.delay_execution')}`, + color: '#5102ce', + icon: PauseCircleFilled, + isSpin: false, + classNames: 'delay_execution' + }, + SERIAL_WAIT: { + id: 14, + desc: `${t('project.workflow.serial_wait')}`, + color: '#5102ce', + icon: Loading3QuartersOutlined, + isSpin: true, + classNames: 'serial_wait' + }, + READY_BLOCK: { + id: 15, + desc: `${t('project.workflow.ready_to_block')}`, + color: '#5101be', + icon: SendOutlined, + isSpin: false, + classNames: 'pending' + }, + BLOCK: { + id: 16, + desc: `${t('project.workflow.block')}`, + color: '#5101be', + icon: HistoryOutlined, + isSpin: false, + classNames: 'pending' + } +}) + /** * A simple uuid generator, support prefix and template pattern. * diff --git a/dolphinscheduler-ui/src/common/types.ts b/dolphinscheduler-ui/src/common/types.ts index 20085cefc0..5f6688e618 100644 --- a/dolphinscheduler-ui/src/common/types.ts +++ b/dolphinscheduler-ui/src/common/types.ts @@ -35,6 +35,20 @@ export type ITaskState = | 'DISPATCH' | 'PENDING' +export type IWorkflowExecutionState = + | 'SUBMITTED_SUCCESS' + | 'RUNNING_EXECUTION' + | 'READY_PAUSE' + | 'PAUSE' + | 'READY_STOP' + | 'STOP' + | 'FAILURE' + | 'SUCCESS' + | 'DELAY_EXECUTION' + | 'SERIAL_WAIT' + | 'READY_BLOCK' + | 'BLOCK' + export type ITaskStateConfig = { [key in ITaskState]: { id: number @@ -45,3 +59,14 @@ export type ITaskStateConfig = { classNames?: string } } + +export type IWorkflowExecutionStateConfig = { + [key in IWorkflowExecutionState]: { + id: number + desc: string + color: string + icon: Component + isSpin: boolean + classNames?: string + } +} diff --git a/dolphinscheduler-ui/src/locales/en_US/project.ts b/dolphinscheduler-ui/src/locales/en_US/project.ts index 1242d17af4..07966228bb 100644 --- a/dolphinscheduler-ui/src/locales/en_US/project.ts +++ b/dolphinscheduler-ui/src/locales/en_US/project.ts @@ -200,7 +200,9 @@ export default { workflow_relation_no_data_result_title: 'Can not find any relations of workflows.', workflow_relation_no_data_result_desc: - 'There is not any workflows. Please create a workflow, and then visit this page again.' + 'There is not any workflows. Please create a workflow, and then visit this page again.', + ready_to_block: 'Ready to block', + block: 'Block', }, task: { cancel_full_screen: 'Cancel full screen', diff --git a/dolphinscheduler-ui/src/locales/zh_CN/project.ts b/dolphinscheduler-ui/src/locales/zh_CN/project.ts index 50873d8771..b9f935f965 100644 --- a/dolphinscheduler-ui/src/locales/zh_CN/project.ts +++ b/dolphinscheduler-ui/src/locales/zh_CN/project.ts @@ -200,7 +200,9 @@ export default { project_tips: '请选择项目', workflow_relation_no_data_result_title: '工作流关系不存在', workflow_relation_no_data_result_desc: - '目前没有任何工作流,请先创建工作流,再访问该页面' + '目前没有任何工作流,请先创建工作流,再访问该页面', + ready_to_block: '准备锁定', + block: '锁定', }, task: { cancel_full_screen: '取消全屏', diff --git a/dolphinscheduler-ui/src/views/projects/workflow/instance/components/process-instance-condition.tsx b/dolphinscheduler-ui/src/views/projects/workflow/instance/components/process-instance-condition.tsx index 7064fdb368..8d4da73630 100644 --- a/dolphinscheduler-ui/src/views/projects/workflow/instance/components/process-instance-condition.tsx +++ b/dolphinscheduler-ui/src/views/projects/workflow/instance/components/process-instance-condition.tsx @@ -20,7 +20,7 @@ import { NInput, NButton, NDatePicker, NSelect, NIcon, NSpace } from 'naive-ui' import { defineComponent, getCurrentInstance, ref } from 'vue' import { useI18n } from 'vue-i18n' import { format } from 'date-fns' -import { stateType } from '@/common/common' +import { workflowExecutionStateType } from '@/common/common' export default defineComponent({ name: 'ProcessInstanceCondition', @@ -88,7 +88,7 @@ export default defineComponent({ }, render() { const { t } = useI18n() - const options = stateType(t) + const options = workflowExecutionStateType(t) return (