From fbe3d2d9a5993cf41d72c8dce478ece86528be37 Mon Sep 17 00:00:00 2001 From: Junyi Date: Sun, 19 Nov 2023 19:24:34 +0800 Subject: [PATCH] fix(plugin-workflow): client minor fixes (#3062) --- .../client/src/schema-component/antd/action/Action.tsx | 3 ++- .../src/schema-component/antd/icon-picker/IconPicker.tsx | 6 +++--- .../plugin-workflow/src/client/ExecutionCanvas.tsx | 9 ++++----- .../plugin-workflow/src/client/WorkflowCanvas.tsx | 7 +++++-- .../src/client/nodes/manual/SchemaConfig.tsx | 2 +- .../client/nodes/manual/WorkflowTodoBlockInitializer.tsx | 2 +- 6 files changed, 16 insertions(+), 13 deletions(-) diff --git a/packages/core/client/src/schema-component/antd/action/Action.tsx b/packages/core/client/src/schema-component/antd/action/Action.tsx index aa6540400..f8edeb1ea 100644 --- a/packages/core/client/src/schema-component/antd/action/Action.tsx +++ b/packages/core/client/src/schema-component/antd/action/Action.tsx @@ -41,6 +41,7 @@ export const Action: ComposedAction = observer( onClick, style, openSize, + disabled: propsDisabled, ...others } = useProps(props); const { wrapSSR, componentCls, hashId } = useStyles(); @@ -56,7 +57,7 @@ export const Action: ComposedAction = observer( const record = useRecord(); const designerProps = fieldSchema['x-designer-props']; const openMode = fieldSchema?.['x-component-props']?.['openMode']; - const disabled = form.disabled || field.disabled || field.data?.disabled || props.disabled; + const disabled = form.disabled || field.disabled || field.data?.disabled || propsDisabled; const linkageRules = fieldSchema?.['x-linkage-rules'] || []; const { designable } = useDesignable(); const tarComponent = useComponent(component) || component; diff --git a/packages/core/client/src/schema-component/antd/icon-picker/IconPicker.tsx b/packages/core/client/src/schema-component/antd/icon-picker/IconPicker.tsx index 0c2bd3bab..f7546135c 100644 --- a/packages/core/client/src/schema-component/antd/icon-picker/IconPicker.tsx +++ b/packages/core/client/src/schema-component/antd/icon-picker/IconPicker.tsx @@ -2,7 +2,7 @@ import { CloseOutlined, LoadingOutlined } from '@ant-design/icons'; import { useFormLayout } from '@formily/antd-v5'; import { connect, mapProps, mapReadPretty } from '@formily/react'; import { isValid } from '@formily/shared'; -import { Button, Input } from 'antd'; +import { Button, Input, Space } from 'antd'; import React, { useState } from 'react'; import { useTranslation } from 'react-i18next'; import { Icon, hasIcon, icons } from '../../../icon'; @@ -15,7 +15,7 @@ function IconField(props: any) { const { t } = useTranslation(); return (
- + )} - +
); } diff --git a/packages/plugins/@nocobase/plugin-workflow/src/client/ExecutionCanvas.tsx b/packages/plugins/@nocobase/plugin-workflow/src/client/ExecutionCanvas.tsx index 2f2d4d0ea..3148b4eb7 100644 --- a/packages/plugins/@nocobase/plugin-workflow/src/client/ExecutionCanvas.tsx +++ b/packages/plugins/@nocobase/plugin-workflow/src/client/ExecutionCanvas.tsx @@ -9,7 +9,7 @@ import { useResourceActionContext, } from '@nocobase/client'; import { str2moment } from '@nocobase/utils/client'; -import { Breadcrumb, Dropdown, Space, Tag } from 'antd'; +import { Breadcrumb, Dropdown, Result, Space, Spin, Tag } from 'antd'; import React, { useCallback, useEffect, useState } from 'react'; import { Link, useNavigate } from 'react-router-dom'; import { CanvasContent } from './CanvasContent'; @@ -58,7 +58,7 @@ function JobModal() { schema={{ type: 'void', properties: { - [`${job?.id}-modal`]: { + [`${job?.id}-${job?.updatedAt}-modal`]: { type: 'void', 'x-decorator': 'Form', 'x-decorator-props': { @@ -218,10 +218,9 @@ export function ExecutionCanvas() { if (!data?.data) { if (loading) { - return
{lang('Loading')}
; - } else { - return
{lang('Load failed')}
; + return ; } + return ; } const { jobs = [], workflow: { nodes = [], revisions = [], ...workflow } = {}, ...execution } = data?.data ?? {}; diff --git a/packages/plugins/@nocobase/plugin-workflow/src/client/WorkflowCanvas.tsx b/packages/plugins/@nocobase/plugin-workflow/src/client/WorkflowCanvas.tsx index 537d88495..243c9e4ee 100644 --- a/packages/plugins/@nocobase/plugin-workflow/src/client/WorkflowCanvas.tsx +++ b/packages/plugins/@nocobase/plugin-workflow/src/client/WorkflowCanvas.tsx @@ -10,7 +10,7 @@ import { useResourceContext, } from '@nocobase/client'; import { str2moment } from '@nocobase/utils/client'; -import { App, Breadcrumb, Button, Dropdown, Switch, message } from 'antd'; +import { App, Breadcrumb, Button, Dropdown, Result, Spin, Switch, message } from 'antd'; import React, { useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { Link, useNavigate } from 'react-router-dom'; @@ -60,7 +60,10 @@ export function WorkflowCanvas() { }, [data?.data]); if (!data?.data) { - return
{loading ? lang('Loading') : lang('Load failed')}
; + if (loading) { + return ; + } + return ; } const { nodes = [], revisions = [], ...workflow } = data?.data ?? {}; diff --git a/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/manual/SchemaConfig.tsx b/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/manual/SchemaConfig.tsx index b9ea4e8ef..d84dba51c 100644 --- a/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/manual/SchemaConfig.tsx +++ b/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/manual/SchemaConfig.tsx @@ -522,7 +522,7 @@ export function SchemaConfigButton(props) { const [visible, setVisible] = useState(false); return ( <> - diff --git a/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/manual/WorkflowTodoBlockInitializer.tsx b/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/manual/WorkflowTodoBlockInitializer.tsx index 24a51c425..09fa47cc8 100644 --- a/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/manual/WorkflowTodoBlockInitializer.tsx +++ b/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/manual/WorkflowTodoBlockInitializer.tsx @@ -25,4 +25,4 @@ export const WorkflowTodoBlockInitializer: FC = ({ insert, ...rest }) => { }} /> ); -} +};