From aaf6718755dc31b139f351e9823359e578708a40 Mon Sep 17 00:00:00 2001 From: Junyi Date: Wed, 18 Jan 2023 00:32:24 +0800 Subject: [PATCH] fix(plugin-workflow): adjust executed alert position (#1381) --- .../workflow/src/client/nodes/index.tsx | 36 +++++++++-------- .../workflow/src/client/triggers/index.tsx | 40 ++++++++++--------- 2 files changed, 41 insertions(+), 35 deletions(-) diff --git a/packages/plugins/workflow/src/client/nodes/index.tsx b/packages/plugins/workflow/src/client/nodes/index.tsx index bb23a7bb9..6489e2c01 100644 --- a/packages/plugins/workflow/src/client/nodes/index.tsx +++ b/packages/plugins/workflow/src/client/nodes/index.tsx @@ -343,6 +343,21 @@ export function NodeDefaultView(props) { } }, properties: { + ...(workflow.executed ? { + alert: { + 'x-component': Alert, + 'x-component-props': { + type: 'warning', + showIcon: true, + message: `{{t("Node in executed workflow cannot be modified", { ns: "${NAMESPACE}" })}}`, + className: css` + width: 100%; + font-size: 85%; + margin-bottom: 2em; + ` + }, + } + } : {}), title: { type: 'string', name: 'title', @@ -368,25 +383,12 @@ export function NodeDefaultView(props) { }, properties: instruction.fieldset }, - actions: { + actions: workflow.executed + ? null + : { type: 'void', 'x-component': 'Action.Drawer.Footer', - properties: workflow.executed - ? { - alert: { - 'x-component': Alert, - 'x-component-props': { - type: 'warning', - showIcon: true, - message: `{{t("Node in executed workflow cannot be modified", { ns: "${NAMESPACE}" })}}`, - className: css` - width: 100%; - font-size: 85%; - ` - }, - } - } - : { + properties: { cancel: { title: '{{t("Cancel")}}', 'x-component': 'Action', diff --git a/packages/plugins/workflow/src/client/triggers/index.tsx b/packages/plugins/workflow/src/client/triggers/index.tsx index 428da8e82..442223737 100644 --- a/packages/plugins/workflow/src/client/triggers/index.tsx +++ b/packages/plugins/workflow/src/client/triggers/index.tsx @@ -179,27 +179,31 @@ export const TriggerConfig = () => { } ` }, - properties: fieldset + properties: { + ...(executed ? { + alert: { + 'x-component': Alert, + 'x-component-props': { + type: 'warning', + showIcon: true, + message: `{{t("Trigger in executed workflow cannot be modified", { ns: "${NAMESPACE}" })}}`, + className: css` + width: 100%; + font-size: 85%; + margin-bottom: 2em; + ` + }, + } + } : {}), + ...fieldset + } }, - actions: { + actions: executed + ? null + : { type: 'void', 'x-component': 'Action.Drawer.Footer', - properties: executed - ? { - alert: { - 'x-component': Alert, - 'x-component-props': { - type: 'warning', - showIcon: true, - message: `{{t("Trigger in executed workflow cannot be modified", { ns: "${NAMESPACE}" })}}`, - className: css` - width: 100%; - font-size: 85%; - ` - }, - } - } - : { + properties: { cancel: { title: '{{t("Cancel")}}', 'x-component': 'Action',