Workflow PostFunction
The proxima:workflowPostFunction
module can create a workflow post-processing function.
Configure post function through functions
Manifest example
modules:
proxima:workflowPostFunction:
- key: test-workflow-post-function
title: Workflow Post Function
description: Workflow Post Function
function: workflow-post-function
function:
- key: workflow-post-function
handler: workflow.runPostFunction
Configure post function through a custom UI
You can configure the post function in the validator through a custom UI interface. The following three pages need to be configured:
- create: The page for when the workflow post function is being created
- edit: The page for when the workflow post function is being edited
- view: The page for displaying the workflow post function
On the create and edit pages, you need to save the configuration information through the handleWorkflowConfigChange
API.
manifest例子
modules:
proxima:workflowPostFunction:
- key: my-workflow-post-function
title: Configure Workflow Transition Validator
description: Custom workflow validator
create:
route: /workflow-post-function-create
edit:
route: /workflow-post-function-edit
view:
route: /workflow-post-function-view
resource: main
loadType: Micro
resources:
- key: main
path: /dist
Configure data
Through the handleWorkflowConfigChange
method, you can record configuration data in the workflow
import { Input } from 'antd';
const WorkflowValidatorCreatePage = (props: any) => {
const { context } = props;
const handleWorkflowConfigChange = context?.modal?.handleWorkflowConfigChange;
const onChange = (key, value) => {
handleWorkflowConfigChange({ [key]: value });
};
return (
<div>
<div>label1:</div>
<Input onChange={e => onChange('name1', e.target.value)} />
<div>label2:</div>
<Input onChange={e => onChange('name2', e.target.value)} />
</div>
);
};
export default WorkflowValidatorCreatePage;
Function script
workflow.ts
// The input parameters are as follows
export interface PostFunctionPayload {
workflowId: string; // Workflow ID
transition: string; // Transition action name
currentState: string; // Current state name
itemId: string; // Item ID
}
export const runPostFunction = ({ payload } : { payload: PostFunctionPayload }) => {
const { workflowId, transition, currentState, itemId } = payload;
// do something
};