From 9bac4f54f463329416c38438ad11c171a66bf142 Mon Sep 17 00:00:00 2001 From: Junyi Date: Mon, 9 Oct 2023 10:49:40 +0800 Subject: [PATCH] refactor(plugin-workflow): add new status for 'retry needed' scenarios (#2765) --- .../plugin-workflow/src/client/constants.tsx | 16 ++++++++++++++++ .../plugin-workflow/src/client/index.tsx | 1 + .../plugin-workflow/src/server/Processor.ts | 1 + .../plugin-workflow/src/server/constants.ts | 2 ++ 4 files changed, 20 insertions(+) diff --git a/packages/plugins/@nocobase/plugin-workflow/src/client/constants.tsx b/packages/plugins/@nocobase/plugin-workflow/src/client/constants.tsx index 81540129b..3300682bf 100644 --- a/packages/plugins/@nocobase/plugin-workflow/src/client/constants.tsx +++ b/packages/plugins/@nocobase/plugin-workflow/src/client/constants.tsx @@ -7,6 +7,7 @@ import { ExclamationOutlined, HourglassOutlined, LoadingOutlined, + RedoOutlined, } from '@ant-design/icons'; import { NAMESPACE } from './locale'; @@ -19,6 +20,7 @@ export const EXECUTION_STATUS = { ABORTED: -3, CANCELED: -4, REJECTED: -5, + RETRY_NEEDED: -6, }; export const ExecutionStatusOptions = [ @@ -78,6 +80,13 @@ export const ExecutionStatusOptions = [ icon: , description: `{{t("Rejected from a manual node.", { ns: "${NAMESPACE}" })}}`, }, + { + value: EXECUTION_STATUS.RETRY_NEEDED, + label: `{{t("Retry needed", { ns: "${NAMESPACE}" })}}`, + color: 'volcano', + icon: , + description: `{{t("General failed but should do another try.", { ns: "${NAMESPACE}" })}}`, + }, ]; export const ExecutionStatusOptionsMap = ExecutionStatusOptions.reduce( @@ -93,6 +102,7 @@ export const JOB_STATUS = { ABORTED: -3, CANCELED: -4, REJECTED: -5, + RETRY_NEEDED: -6, }; export const JobStatusOptions = [ @@ -133,6 +143,12 @@ export const JobStatusOptions = [ color: 'volcano', icon: , }, + { + value: JOB_STATUS.RETRY_NEEDED, + label: `{{t("Retry needed", { ns: "${NAMESPACE}" })}}`, + color: 'volcano', + icon: , + }, ]; export const JobStatusOptionsMap = JobStatusOptions.reduce( diff --git a/packages/plugins/@nocobase/plugin-workflow/src/client/index.tsx b/packages/plugins/@nocobase/plugin-workflow/src/client/index.tsx index 5279272be..4a23925f9 100644 --- a/packages/plugins/@nocobase/plugin-workflow/src/client/index.tsx +++ b/packages/plugins/@nocobase/plugin-workflow/src/client/index.tsx @@ -1,3 +1,4 @@ +export * from './constants'; export * from './Branch'; export * from './FlowContext'; export * from './nodes'; diff --git a/packages/plugins/@nocobase/plugin-workflow/src/server/Processor.ts b/packages/plugins/@nocobase/plugin-workflow/src/server/Processor.ts index 1fcde4a8d..ab953e27e 100644 --- a/packages/plugins/@nocobase/plugin-workflow/src/server/Processor.ts +++ b/packages/plugins/@nocobase/plugin-workflow/src/server/Processor.ts @@ -20,6 +20,7 @@ export default class Processor { [JOB_STATUS.ABORTED]: EXECUTION_STATUS.ABORTED, [JOB_STATUS.CANCELED]: EXECUTION_STATUS.CANCELED, [JOB_STATUS.REJECTED]: EXECUTION_STATUS.REJECTED, + [JOB_STATUS.RETRY_NEEDED]: EXECUTION_STATUS.RETRY_NEEDED, }; logger: Logger; diff --git a/packages/plugins/@nocobase/plugin-workflow/src/server/constants.ts b/packages/plugins/@nocobase/plugin-workflow/src/server/constants.ts index ef1b1733f..1d346f3bd 100644 --- a/packages/plugins/@nocobase/plugin-workflow/src/server/constants.ts +++ b/packages/plugins/@nocobase/plugin-workflow/src/server/constants.ts @@ -7,6 +7,7 @@ export const EXECUTION_STATUS = { ABORTED: -3, CANCELED: -4, REJECTED: -5, + RETRY_NEEDED: -6, }; export const JOB_STATUS = { @@ -17,6 +18,7 @@ export const JOB_STATUS = { ABORTED: -3, CANCELED: -4, REJECTED: -5, + RETRY_NEEDED: -6, }; export const BRANCH_INDEX = {