fix(plugin-workflow): client minor fixes (#3062)

This commit is contained in:
Junyi 2023-11-19 19:24:34 +08:00 committed by GitHub
parent eac8559104
commit fbe3d2d9a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 16 additions and 13 deletions

View File

@ -41,6 +41,7 @@ export const Action: ComposedAction = observer(
onClick, onClick,
style, style,
openSize, openSize,
disabled: propsDisabled,
...others ...others
} = useProps(props); } = useProps(props);
const { wrapSSR, componentCls, hashId } = useStyles(); const { wrapSSR, componentCls, hashId } = useStyles();
@ -56,7 +57,7 @@ export const Action: ComposedAction = observer(
const record = useRecord(); const record = useRecord();
const designerProps = fieldSchema['x-designer-props']; const designerProps = fieldSchema['x-designer-props'];
const openMode = fieldSchema?.['x-component-props']?.['openMode']; 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 linkageRules = fieldSchema?.['x-linkage-rules'] || [];
const { designable } = useDesignable(); const { designable } = useDesignable();
const tarComponent = useComponent(component) || component; const tarComponent = useComponent(component) || component;

View File

@ -2,7 +2,7 @@ import { CloseOutlined, LoadingOutlined } from '@ant-design/icons';
import { useFormLayout } from '@formily/antd-v5'; import { useFormLayout } from '@formily/antd-v5';
import { connect, mapProps, mapReadPretty } from '@formily/react'; import { connect, mapProps, mapReadPretty } from '@formily/react';
import { isValid } from '@formily/shared'; import { isValid } from '@formily/shared';
import { Button, Input } from 'antd'; import { Button, Input, Space } from 'antd';
import React, { useState } from 'react'; import React, { useState } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { Icon, hasIcon, icons } from '../../../icon'; import { Icon, hasIcon, icons } from '../../../icon';
@ -15,7 +15,7 @@ function IconField(props: any) {
const { t } = useTranslation(); const { t } = useTranslation();
return ( return (
<div> <div>
<Input.Group compact> <Space.Compact>
<PopoverWithStopPropagation <PopoverWithStopPropagation
placement={'bottom'} placement={'bottom'}
open={visible} open={visible}
@ -57,7 +57,7 @@ function IconField(props: any) {
}} }}
></Button> ></Button>
)} )}
</Input.Group> </Space.Compact>
</div> </div>
); );
} }

View File

@ -9,7 +9,7 @@ import {
useResourceActionContext, useResourceActionContext,
} from '@nocobase/client'; } from '@nocobase/client';
import { str2moment } from '@nocobase/utils/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 React, { useCallback, useEffect, useState } from 'react';
import { Link, useNavigate } from 'react-router-dom'; import { Link, useNavigate } from 'react-router-dom';
import { CanvasContent } from './CanvasContent'; import { CanvasContent } from './CanvasContent';
@ -58,7 +58,7 @@ function JobModal() {
schema={{ schema={{
type: 'void', type: 'void',
properties: { properties: {
[`${job?.id}-modal`]: { [`${job?.id}-${job?.updatedAt}-modal`]: {
type: 'void', type: 'void',
'x-decorator': 'Form', 'x-decorator': 'Form',
'x-decorator-props': { 'x-decorator-props': {
@ -218,10 +218,9 @@ export function ExecutionCanvas() {
if (!data?.data) { if (!data?.data) {
if (loading) { if (loading) {
return <div>{lang('Loading')}</div>; return <Spin />;
} else {
return <div>{lang('Load failed')}</div>;
} }
return <Result status="404" title="Not found" />;
} }
const { jobs = [], workflow: { nodes = [], revisions = [], ...workflow } = {}, ...execution } = data?.data ?? {}; const { jobs = [], workflow: { nodes = [], revisions = [], ...workflow } = {}, ...execution } = data?.data ?? {};

View File

@ -10,7 +10,7 @@ import {
useResourceContext, useResourceContext,
} from '@nocobase/client'; } from '@nocobase/client';
import { str2moment } from '@nocobase/utils/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 React, { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { Link, useNavigate } from 'react-router-dom'; import { Link, useNavigate } from 'react-router-dom';
@ -60,7 +60,10 @@ export function WorkflowCanvas() {
}, [data?.data]); }, [data?.data]);
if (!data?.data) { if (!data?.data) {
return <div>{loading ? lang('Loading') : lang('Load failed')}</div>; if (loading) {
return <Spin />;
}
return <Result status="404" title="Not found" />;
} }
const { nodes = [], revisions = [], ...workflow } = data?.data ?? {}; const { nodes = [], revisions = [], ...workflow } = data?.data ?? {};

View File

@ -522,7 +522,7 @@ export function SchemaConfigButton(props) {
const [visible, setVisible] = useState(false); const [visible, setVisible] = useState(false);
return ( return (
<> <>
<Button type="primary" onClick={() => setVisible(true)}> <Button type="primary" onClick={() => setVisible(true)} disabled={false}>
{workflow.executed ? lang('View user interface') : lang('Configure user interface')} {workflow.executed ? lang('View user interface') : lang('Configure user interface')}
</Button> </Button>
<ActionContextProvider value={{ visible, setVisible, formValueChanged: false }}> <ActionContextProvider value={{ visible, setVisible, formValueChanged: false }}>

View File

@ -25,4 +25,4 @@ export const WorkflowTodoBlockInitializer: FC<any> = ({ insert, ...rest }) => {
}} }}
/> />
); );
} };