mirror of
https://gitee.com/nocobase/nocobase.git
synced 2024-12-02 04:07:50 +08:00
refactor(plugin-workflow): change node config api render to component (#2014)
* refactor(plugin-workflow): change node config api render to component * fix(plugin-workflow): fix trigger drawer error and remove unused api * fix(plugin-workflow): fix return value of request node run phase * fix(client): fix classname order in action button
This commit is contained in:
parent
b7cb9a45c2
commit
9a376e4116
@ -140,7 +140,7 @@ export const Action: ComposedAction = observer(
|
||||
}
|
||||
}}
|
||||
component={tarComponent || Button}
|
||||
className={classnames(className, actionDesignerCss)}
|
||||
className={classnames(actionDesignerCss, className)}
|
||||
>
|
||||
{title || compile(fieldSchema.title)}
|
||||
<Designer {...designerProps} />
|
||||
|
@ -413,7 +413,7 @@ export default {
|
||||
value: { rejectOnFalse: false },
|
||||
},
|
||||
],
|
||||
render: function Renderer(data) {
|
||||
component: function Component({ data }) {
|
||||
const { t } = useTranslation();
|
||||
const { nodes } = useFlowContext();
|
||||
const {
|
||||
|
@ -51,7 +51,7 @@ export interface Instruction {
|
||||
view?: ISchema;
|
||||
scope?: { [key: string]: any };
|
||||
components?: { [key: string]: any };
|
||||
render?(props): JSX.Element;
|
||||
component?(props): JSX.Element;
|
||||
endding?: boolean;
|
||||
useVariables?(node, options?): VariableOptions;
|
||||
useScopeVariables?(node, options?): VariableOptions;
|
||||
@ -137,13 +137,13 @@ export function useUpstreamScopes(node) {
|
||||
}
|
||||
|
||||
export function Node({ data }) {
|
||||
const instruction = instructions.get(data.type);
|
||||
const { component: Component = NodeDefaultView, endding } = instructions.get(data.type);
|
||||
|
||||
return (
|
||||
<NodeContext.Provider value={data}>
|
||||
<div className={cx(nodeBlockClass)}>
|
||||
{instruction.render ? instruction.render(data) : <NodeDefaultView data={data} />}
|
||||
{!instruction.endding ? (
|
||||
<Component data={data} />
|
||||
{!endding ? (
|
||||
<AddButton upstream={data} />
|
||||
) : (
|
||||
<div
|
||||
|
@ -47,7 +47,7 @@ export default {
|
||||
},
|
||||
},
|
||||
view: {},
|
||||
render: function Renderer(data) {
|
||||
component: function Component({ data }) {
|
||||
const { nodes } = useFlowContext();
|
||||
const entry = nodes.find((node) => node.upstreamId === data.id && node.branchIndex != null);
|
||||
|
||||
|
@ -44,7 +44,7 @@ export default {
|
||||
},
|
||||
},
|
||||
view: {},
|
||||
render(data) {
|
||||
component: function Component({ data }) {
|
||||
const {
|
||||
id,
|
||||
config: { mode },
|
||||
|
@ -58,7 +58,6 @@ export interface Trigger {
|
||||
view?: ISchema;
|
||||
scope?: { [key: string]: any };
|
||||
components?: { [key: string]: any };
|
||||
render?(props): React.ReactNode;
|
||||
useInitializers?(config): SchemaInitializerItemOptions | null;
|
||||
initializers?: any;
|
||||
}
|
||||
@ -86,7 +85,7 @@ function TriggerExecution() {
|
||||
'x-component-props': {
|
||||
title: <InfoOutlined />,
|
||||
shape: 'circle',
|
||||
className: cx(nodeJobButtonClass, 'workflow-node-job-button'),
|
||||
className: nodeJobButtonClass,
|
||||
type: 'primary',
|
||||
},
|
||||
properties: {
|
||||
@ -178,7 +177,7 @@ export const TriggerConfig = () => {
|
||||
}
|
||||
const whiteSet = new Set(['workflow-node-meta', 'workflow-node-config-button', 'ant-input-disabled']);
|
||||
for (let el = ev.target; el && el !== ev.currentTarget; el = el.parentNode) {
|
||||
if ((Array.from(el.classList) as string[]).some((name: string) => whiteSet.has(name))) {
|
||||
if ((Array.from(el.classList ?? []) as string[]).some((name: string) => whiteSet.has(name))) {
|
||||
setEditingConfig(true);
|
||||
ev.stopPropagation();
|
||||
return;
|
||||
|
@ -73,7 +73,7 @@ export default class implements Instruction {
|
||||
|
||||
this.plugin.app.logger.info(`[Workflow] request (#${node.id}) sent to "${config.url}", waiting for response...`);
|
||||
|
||||
return job;
|
||||
return null;
|
||||
}
|
||||
|
||||
async resume(node: FlowNodeModel, job, processor: Processor) {
|
||||
|
Loading…
Reference in New Issue
Block a user