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}
|
component={tarComponent || Button}
|
||||||
className={classnames(className, actionDesignerCss)}
|
className={classnames(actionDesignerCss, className)}
|
||||||
>
|
>
|
||||||
{title || compile(fieldSchema.title)}
|
{title || compile(fieldSchema.title)}
|
||||||
<Designer {...designerProps} />
|
<Designer {...designerProps} />
|
||||||
|
@ -413,7 +413,7 @@ export default {
|
|||||||
value: { rejectOnFalse: false },
|
value: { rejectOnFalse: false },
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
render: function Renderer(data) {
|
component: function Component({ data }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { nodes } = useFlowContext();
|
const { nodes } = useFlowContext();
|
||||||
const {
|
const {
|
||||||
|
@ -51,7 +51,7 @@ export interface Instruction {
|
|||||||
view?: ISchema;
|
view?: ISchema;
|
||||||
scope?: { [key: string]: any };
|
scope?: { [key: string]: any };
|
||||||
components?: { [key: string]: any };
|
components?: { [key: string]: any };
|
||||||
render?(props): JSX.Element;
|
component?(props): JSX.Element;
|
||||||
endding?: boolean;
|
endding?: boolean;
|
||||||
useVariables?(node, options?): VariableOptions;
|
useVariables?(node, options?): VariableOptions;
|
||||||
useScopeVariables?(node, options?): VariableOptions;
|
useScopeVariables?(node, options?): VariableOptions;
|
||||||
@ -137,13 +137,13 @@ export function useUpstreamScopes(node) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function Node({ data }) {
|
export function Node({ data }) {
|
||||||
const instruction = instructions.get(data.type);
|
const { component: Component = NodeDefaultView, endding } = instructions.get(data.type);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<NodeContext.Provider value={data}>
|
<NodeContext.Provider value={data}>
|
||||||
<div className={cx(nodeBlockClass)}>
|
<div className={cx(nodeBlockClass)}>
|
||||||
{instruction.render ? instruction.render(data) : <NodeDefaultView data={data} />}
|
<Component data={data} />
|
||||||
{!instruction.endding ? (
|
{!endding ? (
|
||||||
<AddButton upstream={data} />
|
<AddButton upstream={data} />
|
||||||
) : (
|
) : (
|
||||||
<div
|
<div
|
||||||
|
@ -47,7 +47,7 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
view: {},
|
view: {},
|
||||||
render: function Renderer(data) {
|
component: function Component({ data }) {
|
||||||
const { nodes } = useFlowContext();
|
const { nodes } = useFlowContext();
|
||||||
const entry = nodes.find((node) => node.upstreamId === data.id && node.branchIndex != null);
|
const entry = nodes.find((node) => node.upstreamId === data.id && node.branchIndex != null);
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
view: {},
|
view: {},
|
||||||
render(data) {
|
component: function Component({ data }) {
|
||||||
const {
|
const {
|
||||||
id,
|
id,
|
||||||
config: { mode },
|
config: { mode },
|
||||||
|
@ -58,7 +58,6 @@ export interface Trigger {
|
|||||||
view?: ISchema;
|
view?: ISchema;
|
||||||
scope?: { [key: string]: any };
|
scope?: { [key: string]: any };
|
||||||
components?: { [key: string]: any };
|
components?: { [key: string]: any };
|
||||||
render?(props): React.ReactNode;
|
|
||||||
useInitializers?(config): SchemaInitializerItemOptions | null;
|
useInitializers?(config): SchemaInitializerItemOptions | null;
|
||||||
initializers?: any;
|
initializers?: any;
|
||||||
}
|
}
|
||||||
@ -86,7 +85,7 @@ function TriggerExecution() {
|
|||||||
'x-component-props': {
|
'x-component-props': {
|
||||||
title: <InfoOutlined />,
|
title: <InfoOutlined />,
|
||||||
shape: 'circle',
|
shape: 'circle',
|
||||||
className: cx(nodeJobButtonClass, 'workflow-node-job-button'),
|
className: nodeJobButtonClass,
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
},
|
},
|
||||||
properties: {
|
properties: {
|
||||||
@ -178,7 +177,7 @@ export const TriggerConfig = () => {
|
|||||||
}
|
}
|
||||||
const whiteSet = new Set(['workflow-node-meta', 'workflow-node-config-button', 'ant-input-disabled']);
|
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) {
|
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);
|
setEditingConfig(true);
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
return;
|
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...`);
|
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) {
|
async resume(node: FlowNodeModel, job, processor: Processor) {
|
||||||
|
Loading…
Reference in New Issue
Block a user