Skip to content

Commit ff50aa2

Browse files
committed
1 parent 3c8232c commit ff50aa2

46 files changed

Lines changed: 913 additions & 419 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

flow-engine-framework/src/main/java/com/codingapi/flow/script/node/ConditionScript.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@
99
@AllArgsConstructor
1010
public class ConditionScript {
1111

12-
public static final String SCRIPT_DEFAULT = "def run(request){return true}";
12+
public static final String SCRIPT_DEFAULT = """
13+
// @SCRIPT_TITLE 默认条件(允许执行)
14+
def run(request){
15+
return true;
16+
}
17+
""";
1318

1419
@Getter
1520
private final String script;

flow-engine-framework/src/main/java/com/codingapi/flow/script/node/ErrorTriggerScript.java

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,19 @@
1313
public class ErrorTriggerScript {
1414

1515

16-
public static final String SCRIPT_NODE_DEFAULT = "def run(request){ return $bind.createErrorThrow(request.getStartNode()); }";
17-
18-
public static final String SCRIPT_OPERATOR_DEFAULT = "def run(request){ return $bind.createErrorThrow(request.getCreatedOperator()); }";
16+
public static final String SCRIPT_NODE_DEFAULT = """
17+
// @SCRIPT_TITLE 回退至开始节点
18+
def run(request){
19+
return $bind.createErrorThrow(request.getStartNode());
20+
}
21+
""";
22+
23+
public static final String SCRIPT_OPERATOR_DEFAULT = """
24+
// @SCRIPT_TITLE 指定用户到流程发起者
25+
def run(request){
26+
return $bind.createErrorThrow(request.getCreatedOperator());
27+
}
28+
""";
1929

2030
@Getter
2131
private final String script;

flow-engine-framework/src/main/java/com/codingapi/flow/script/node/NodeTitleScript.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@
1212
@AllArgsConstructor
1313
public class NodeTitleScript {
1414

15-
public static final String SCRIPT_DEFAULT = "def run(request){return '你有一条待办'}";
15+
public static final String SCRIPT_DEFAULT = """
16+
// @SCRIPT_TITLE 你有一条待办
17+
def run(request){
18+
return '你有一条待办'
19+
}
20+
""";
1621

1722
@Getter
1823
private final String script;

flow-engine-framework/src/main/java/com/codingapi/flow/script/node/OperatorLoadScript.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,12 @@
1515
@AllArgsConstructor
1616
public class OperatorLoadScript {
1717

18-
public static final String SCRIPT_CREATOR = "def run(request){return [request.getCreatedOperator()]}";
18+
public static final String SCRIPT_CREATOR = """
19+
// @SCRIPT_TITLE 流程创建者
20+
def run(request){
21+
return [request.getCreatedOperator()]
22+
}
23+
""";
1924

2025
@Getter
2126
private final String script;

flow-engine-framework/src/main/java/com/codingapi/flow/script/node/OperatorMatchScript.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@
1111
@AllArgsConstructor
1212
public class OperatorMatchScript {
1313

14-
public static final String SCRIPT_ANY = "def run(operator){return true}";
14+
public static final String SCRIPT_ANY = """
15+
// @SCRIPT_TITLE 任意用户
16+
def run(operator){
17+
return true
18+
}
19+
""";
1520

1621
@Getter
1722
private final String script;

flow-engine-framework/src/main/java/com/codingapi/flow/script/node/RouterNodeScript.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
import lombok.Getter;
77

88
/**
9-
* 异常触发脚本
9+
* 路由触发脚本
1010
*/
1111
@AllArgsConstructor
1212
public class RouterNodeScript {
1313

14-
1514
public static final String SCRIPT_NODE_DEFAULT = """
15+
// @SCRIPT_TITLE 发起节点
1616
def run(request){
1717
return request.getStartNode().getId();
1818
}

flow-engine-framework/src/main/java/com/codingapi/flow/script/node/SubProcessScript.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@
1313
@AllArgsConstructor
1414
public class SubProcessScript {
1515

16-
public static final String SCRIPT_DEFAULT = "def run(session){ return session.toCreateRequest() }";
16+
public static final String SCRIPT_DEFAULT = """
17+
// @SCRIPT_TITLE 创建当前流程
18+
def run(session){
19+
return session.toCreateRequest()
20+
}
21+
""";
1722

1823
@Getter
1924
private final String script;

flow-engine-framework/src/main/java/com/codingapi/flow/script/node/TriggerScript.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@
1111
@AllArgsConstructor
1212
public class TriggerScript {
1313

14-
public static final String SCRIPT_DEFAULT = "def run(session){ print('hello trigger node.') }";
14+
public static final String SCRIPT_DEFAULT = """
15+
// @SCRIPT_TITLE 示例触发节点(打印触发日志)
16+
def run(session){
17+
print('hello trigger node.');
18+
}
19+
""";
1520

1621
@Getter
1722
private final String script;

frontend/packages/flow-pc/flow-pc-design/src/components/design-editor/components/branch-adder/index.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import {type FlowNodeEntity, useClientContext} from '@flowgram.ai/fixed-layout-editor';
22
import React, {useCallback, useContext} from "react";
33
import {NodeRenderContext} from "@/components/design-editor/context";
4-
import {NodePanel} from "@/components/design-editor/node-components/panel";
54
import {NodeHeader} from "@/components/design-editor/node-components/header";
65
import {Button} from "antd";
76
import {nodeFormPanelFactory} from "@/components/design-editor/components/sidebar";
@@ -54,13 +53,13 @@ export const BranchAdderRender: React.FC<BranchAdderProps> = (props) => {
5453
const canAddBranch = playground.config.readonlyOrDisabled;
5554

5655
return (
57-
<NodePanel>
56+
<div>
5857
<NodeHeader
5958
iconEnable={true}
6059
style={{
6160
width: 120
6261
}}/>
6362
<Button type={'link'} disabled={canAddBranch} onClick={handleAddBranch}>{props.buttonText}</Button>
64-
</NodePanel>
63+
</div>
6564
);
6665
};

frontend/packages/flow-pc/flow-pc-design/src/components/design-editor/node-components/condition/index.tsx

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
import { Field, FieldRenderProps } from "@flowgram.ai/fixed-layout-editor";
2-
import { Form,Input } from "antd";
1+
import {Field, FieldRenderProps} from "@flowgram.ai/fixed-layout-editor";
2+
import {Button, Form, Space} from "antd";
33
import React from "react";
4+
import {GroovyScriptPreview} from "@/components/script/components/groovy-script-preview";
5+
import {EditOutlined} from "@ant-design/icons";
46

57
/**
68
* 条件配置
@@ -25,9 +27,20 @@ export const ConditionScript = ()=>{
2527
<Field
2628
name={"script"}
2729
render={({ field: { value, onChange } }: FieldRenderProps<any>) => (
28-
<>
29-
<Input value={value} onChange={onChange} />
30-
</>
30+
<Space.Compact style={{width: '100%'}}>
31+
<GroovyScriptPreview
32+
script={value}
33+
/>
34+
35+
<Button
36+
icon={<EditOutlined/>}
37+
onClick={() => {
38+
}}
39+
style={{borderRadius: '0 6px 6px 0'}}
40+
>
41+
编辑
42+
</Button>
43+
</Space.Compact>
3144
)}
3245
/>
3346
</Form.Item>

0 commit comments

Comments
 (0)