From 7777a6acfd6b60b69bbda2a4c27b2a3e1e466164 Mon Sep 17 00:00:00 2001 From: labbomb <739955946@qq.com> Date: Fri, 15 Apr 2022 18:50:52 +0800 Subject: [PATCH] [Fix][UI Next][V1.0.0-Beta] Added access to the child node function (#9518) * Added access to the child node function * Added access to the child node function --- .../src/components/modal/index.tsx | 2 +- .../src/locales/modules/en_US.ts | 2 +- .../src/locales/modules/zh_CN.ts | 3 +- .../modules/process-instances/index.ts | 2 +- .../modules/process-instances/types.ts | 4 +-- .../task/components/node/detail-modal.tsx | 33 +++++++++++++++++-- 6 files changed, 38 insertions(+), 8 deletions(-) diff --git a/dolphinscheduler-ui-next/src/components/modal/index.tsx b/dolphinscheduler-ui-next/src/components/modal/index.tsx index cc89283976..e4ba40ad8f 100644 --- a/dolphinscheduler-ui-next/src/components/modal/index.tsx +++ b/dolphinscheduler-ui-next/src/components/modal/index.tsx @@ -109,7 +109,7 @@ const Modal = defineComponent({ .filter((item: any) => item.show) .map((item: any) => { return ( - + {{ default: () => item.text, icon: () => item.icon() diff --git a/dolphinscheduler-ui-next/src/locales/modules/en_US.ts b/dolphinscheduler-ui-next/src/locales/modules/en_US.ts index dec8f5b1fb..bea83ba51c 100644 --- a/dolphinscheduler-ui-next/src/locales/modules/en_US.ts +++ b/dolphinscheduler-ui-next/src/locales/modules/en_US.ts @@ -615,6 +615,7 @@ const project = { online: 'Online' }, node: { + return_back: 'Return', current_node_settings: 'Current node settings', instructions: 'Instructions', view_history: 'View history', @@ -627,7 +628,6 @@ const project = { workflow_name: 'Workflow Name', workflow_name_tips: 'Please select a workflow (required)', child_node: 'Child Node', - enter_child_node: 'Enter child node', run_flag: 'Run flag', normal: 'Normal', prohibition_execution: 'Prohibition execution', diff --git a/dolphinscheduler-ui-next/src/locales/modules/zh_CN.ts b/dolphinscheduler-ui-next/src/locales/modules/zh_CN.ts index 77a356414b..4d96a4d10f 100644 --- a/dolphinscheduler-ui-next/src/locales/modules/zh_CN.ts +++ b/dolphinscheduler-ui-next/src/locales/modules/zh_CN.ts @@ -527,6 +527,7 @@ const project = { '目前没有任何工作流,请先创建工作流,再访问该页面' }, task: { + current_task_settings: '当前任务设置', online: '已上线', offline: '已下线', task_name: '任务名称', @@ -610,6 +611,7 @@ const project = { online: '已上线' }, node: { + return_back: '返回上一节点', current_node_settings: '当前节点设置', instructions: '使用说明', view_history: '查看历史', @@ -622,7 +624,6 @@ const project = { workflow_name: '工作流名称', workflow_name_tips: '请选择工作流(必选)', child_node: '子节点', - enter_child_node: '进入该子节点', run_flag: '运行标志', normal: '正常', prohibition_execution: '禁止执行', diff --git a/dolphinscheduler-ui-next/src/service/modules/process-instances/index.ts b/dolphinscheduler-ui-next/src/service/modules/process-instances/index.ts index 0e91bfbf57..be8c019600 100644 --- a/dolphinscheduler-ui-next/src/service/modules/process-instances/index.ts +++ b/dolphinscheduler-ui-next/src/service/modules/process-instances/index.ts @@ -64,7 +64,7 @@ export function querySubProcessInstanceByTaskCode( code: CodeReq ): any { return axios({ - url: `/projects/${code}/process-instances/query-sub-by-parent`, + url: `/projects/${code.projectCode}/process-instances/query-sub-by-parent`, method: 'get', params }) diff --git a/dolphinscheduler-ui-next/src/service/modules/process-instances/types.ts b/dolphinscheduler-ui-next/src/service/modules/process-instances/types.ts index 39b3568384..2b32b1501c 100644 --- a/dolphinscheduler-ui-next/src/service/modules/process-instances/types.ts +++ b/dolphinscheduler-ui-next/src/service/modules/process-instances/types.ts @@ -57,8 +57,8 @@ interface SubIdReq { } interface TaskReq { - taskCode: string - taskId: number + taskCode?: string + taskId?: number } interface LongestReq { diff --git a/dolphinscheduler-ui-next/src/views/projects/task/components/node/detail-modal.tsx b/dolphinscheduler-ui-next/src/views/projects/task/components/node/detail-modal.tsx index 3809415d27..b3e5241547 100644 --- a/dolphinscheduler-ui-next/src/views/projects/task/components/node/detail-modal.tsx +++ b/dolphinscheduler-ui-next/src/views/projects/task/components/node/detail-modal.tsx @@ -33,7 +33,8 @@ import { formatModel } from './format-data' import { HistoryOutlined, ProfileOutlined, - QuestionCircleTwotone + QuestionCircleTwotone, + BranchesOutlined } from '@vicons/antd' import { NIcon } from 'naive-ui' import { TASK_TYPES_MAP } from '../../constants/task-type' @@ -45,6 +46,9 @@ import type { IWorkflowTaskInstance, WorkflowInstance } from './types' +import { + querySubProcessInstanceByTaskCode +} from '@/service/modules/process-instances' const props = { show: { @@ -57,7 +61,8 @@ const props = { }, projectCode: { type: Number as PropType, - required: true + required: true, + default: 0 }, readonly: { type: Boolean as PropType, @@ -147,6 +152,30 @@ const NodeDetailModal = defineComponent({ handleViewLog() }, icon: renderIcon(ProfileOutlined) + }, + { + text: t('project.node.enter_this_child_node'), + show: props.data.taskType === 'SUB_PROCESS', + disabled: !props.data.id || (router.currentRoute.value.name === 'workflow-instance-detail' && !props.taskInstance), + action: () => { + if (router.currentRoute.value.name === 'workflow-instance-detail') { + querySubProcessInstanceByTaskCode({ taskId: props.taskInstance?.id }, { projectCode: props.projectCode }).then( + (res: any) => { + router.push({ + name: 'workflow-instance-detail', + params: { id: res.subProcessInstanceId }, + query: { code: props.data.taskParams?.processDefinitionCode } + }) + } + ) + } else { + router.push({ + name: 'workflow-definition-detail', + params: { code: props.data.taskParams?.processDefinitionCode } + }) + } + }, + icon: renderIcon(BranchesOutlined) } ] }