From d52b787de8897a8e084b13f1106f5be5a240c818 Mon Sep 17 00:00:00 2001 From: xlsea Date: Fri, 31 May 2024 10:59:31 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E5=B7=A5=E4=BD=9C?= =?UTF-8?q?=E6=B5=81=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../work-flow/src/components/detail-card.vue | 96 +++++++++------- packages/work-flow/src/constants/business.ts | 104 ++++++++++++++++-- packages/work-flow/src/detail/branch-desc.vue | 87 +++++++++++++++ .../work-flow/src/detail/branch-detail.vue | 71 +----------- .../work-flow/src/detail/callback-detail.vue | 2 +- .../work-flow/src/detail/start-detail.vue | 2 +- packages/work-flow/src/detail/task-detail.vue | 2 +- packages/work-flow/src/node/branch-node.vue | 60 +++++----- packages/work-flow/src/node/callback-node.vue | 45 ++++---- packages/work-flow/src/node/task-node.vue | 2 +- src/views/workflow/batch/index.vue | 6 +- 11 files changed, 298 insertions(+), 179 deletions(-) create mode 100644 packages/work-flow/src/detail/branch-desc.vue diff --git a/packages/work-flow/src/components/detail-card.vue b/packages/work-flow/src/components/detail-card.vue index 3d9db2a..27036ee 100644 --- a/packages/work-flow/src/components/detail-card.vue +++ b/packages/work-flow/src/components/detail-card.vue @@ -4,7 +4,13 @@ import type { DataTableColumn } from 'naive-ui'; import { NButton, NTag } from 'naive-ui'; import { useFlowStore } from '../stores'; import { fetchBatchDetail, fetchJobDetail, fetchTaskList, fetchWorkflowNodeRetry } from '../api'; -import { executorTypeRecord, operationReasonRecord, taskBatchStatusRecord } from '../constants/business'; +import { + jobExecutorEnum, + jobOperationReasonEnum, + jobStatusEnum, + taskBatchStatusEnum, + taskBatchStatusRecord +} from '../constants/business'; import { $t } from '../locales'; import { isNotNull } from '../utils/common'; import LogDrawer from './log-drawer.vue'; @@ -234,20 +240,12 @@ const columns = ref[]>([ } ]); -function tagColor(tagIndex: number) { - const tagMap: Record = { - 0: 'error', - 1: 'info', - 2: 'success', - 3: 'warning', - 4: 'primary' +function getTagColor(color: string) { + return { + color: `${color}18`, + textColor: color, + borderColor: `${color}58` }; - - if (tagIndex === null || tagIndex < 0) { - return tagMap[1]; - } - - return tagMap[tagIndex % 5]; } const onUpdatePage = (page: number) => { @@ -263,40 +261,54 @@ const onUpdatePage = (page: number) => { - - {{ jobData?.groupName }} + + + {{ jobData?.groupName }} - {{ jobData?.jobName }} + {{ jobData?.jobName }} - - - {{ $t(taskBatchStatusRecord[jobData.taskBatchStatus!]) }} - - + + + {{ taskBatchStatusEnum[jobData.taskBatchStatus!].title }} + + + {{ $t(jobStatusEnum[jobData.jobStatus!].name) }} + + - - {{ jobData?.executionAt }} - + + {{ jobData?.executionAt }} + - - - {{ $t(operationReasonRecord[jobData.operationReason!]) }} - - + + + {{ $t(jobOperationReasonEnum[jobData.operationReason!].name) }} + + - - - {{ $t(executorTypeRecord[jobData.executorType!]) }} - - + + + {{ $t(jobExecutorEnum[jobData.executorType!].name) }} + + - - {{ jobData?.executorInfo }} - - - {{ jobData?.createDt }} - - + + {{ jobData?.executorInfo }} + + + {{ jobData?.createDt }} + + + = { 1: { title: $t('snail.enum.taskBatchStatus.waiting'), @@ -103,19 +114,13 @@ export const taskBatchStatusEnum: Record = { - 1: 'snail.enum.taskBatchStatus.waiting', - 2: 'snail.enum.taskBatchStatus.running', - 3: 'snail.enum.taskBatchStatus.success', - 4: 'snail.enum.taskBatchStatus.fail', - 5: 'snail.enum.taskBatchStatus.stop', - 6: 'snail.enum.taskBatchStatus.cancel', - 98: 'snail.enum.taskBatchStatus.decisionFailed', - 99: 'snail.enum.taskBatchStatus.skip' +export const jobExecutorEnum: Flow.JobTagType = { + 1: { + name: 'snail.enum.executorType.java', + color: '#d06892' + } }; -export const taskBatchStatusOptions = transformRecordToOption(taskBatchStatusRecord); - export const operationReasonRecord: Record = { 0: 'snail.enum.jobOperationReason.none', 1: 'snail.enum.jobOperationReason.taskExecutionTimeout', @@ -133,8 +138,85 @@ export const operationReasonRecord: Record = { + 1: 'snail.enum.taskBatchStatus.waiting', + 2: 'snail.enum.taskBatchStatus.running', + 3: 'snail.enum.taskBatchStatus.success', + 4: 'snail.enum.taskBatchStatus.fail', + 5: 'snail.enum.taskBatchStatus.stop', + 6: 'snail.enum.taskBatchStatus.cancel', + 98: 'snail.enum.taskBatchStatus.decisionFailed', + 99: 'snail.enum.taskBatchStatus.skip' +}; + +export const taskBatchStatusOptions = transformRecordToOption(taskBatchStatusRecord); + export const executorTypeRecord: Record = { 1: 'snail.enum.executorType.java' }; diff --git a/packages/work-flow/src/detail/branch-desc.vue b/packages/work-flow/src/detail/branch-desc.vue new file mode 100644 index 0000000..db2ab54 --- /dev/null +++ b/packages/work-flow/src/detail/branch-desc.vue @@ -0,0 +1,87 @@ + + + diff --git a/packages/work-flow/src/detail/branch-detail.vue b/packages/work-flow/src/detail/branch-detail.vue index da8a9a4..fff515a 100644 --- a/packages/work-flow/src/detail/branch-detail.vue +++ b/packages/work-flow/src/detail/branch-detail.vue @@ -1,9 +1,6 @@