Commit d7fa2b1d authored by chenshouchao's avatar chenshouchao

Merge branch 'feat-20220705-customTemplate' of http://120.77.149.83/root/bkunyun…

Merge branch 'feat-20220705-customTemplate' of http://120.77.149.83/root/bkunyun into feat-20220705-customTemplate
parents f395b90d 1e2f1886
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com * @Author: 吴永生#A02208 yongsheng.wu@wholion.com
* @Date: 2022-07-12 11:20:29 * @Date: 2022-07-12 11:20:29
* @LastEditors: 吴永生#A02208 yongsheng.wu@wholion.com * @LastEditors: 吴永生#A02208 yongsheng.wu@wholion.com
* @LastEditTime: 2022-07-12 20:25:34 * @LastEditTime: 2022-07-14 10:14:15
* @FilePath: /bkunyun/src/views/Project/components/Flow/components/BatchNode.tsx * @FilePath: /bkunyun/src/views/Project/components/Flow/components/BatchNode.tsx
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/ */
...@@ -25,20 +25,29 @@ const BatchNode = (props: IBatchNode) => { ...@@ -25,20 +25,29 @@ const BatchNode = (props: IBatchNode) => {
isFlowNode, isFlowNode,
selectedStatus, selectedStatus,
info: { title, isCheck, executionStatus, parameters }, info: { title, isCheck, executionStatus, parameters },
flowType,
} = data; } = data;
/** 获取输入参数数组 */ /** 获取输入参数数组 */
const inParamsArr = useMemo(() => { const inParamsArr = useMemo(() => {
return parameters.filter((item) => { return (
return item.parameterGroup === "in"; (parameters?.length &&
}); parameters?.filter((item) => {
return item.parameterGroup === "in";
})) ||
[]
);
}, [parameters]); }, [parameters]);
/** 获取输出参数数组 */ /** 获取输出参数数组 */
const outParamsArr = useMemo(() => { const outParamsArr = useMemo(() => {
return parameters.filter((item) => { return (
return item.parameterGroup === "out"; (parameters?.length &&
}); parameters?.filter((item) => {
return item.parameterGroup === "out";
})) ||
[]
);
}, [parameters]); }, [parameters]);
return ( return (
...@@ -52,25 +61,26 @@ const BatchNode = (props: IBatchNode) => { ...@@ -52,25 +61,26 @@ const BatchNode = (props: IBatchNode) => {
})} })}
style={style} style={style}
> >
{inParamsArr?.length && {inParamsArr?.length && flowType === "edit"
inParamsArr.map((item, index) => { ? inParamsArr.map((item, index) => {
return ( return (
<Tooltip title={item.name} key={uuid()}> <Tooltip title={item.name} key={uuid()}>
<Handle <Handle
id={item.name} id={item.name}
style={{ style={{
background: "#fff ", background: "#fff ",
border: item.error border: item.error
? "1px solid #FF4E4E" ? "1px solid #FF4E4E"
: "1px solid #D1D6DE", : "1px solid #D1D6DE",
left: index * 20 + 20, left: index * 20 + 20,
}} }}
type="target" type="target"
position={Position.Top} position={Position.Top}
/> />
</Tooltip> </Tooltip>
); );
})} })
: null}
<div <div
className={classNames({ className={classNames({
[styles.batchRotate]: isFlowNode, [styles.batchRotate]: isFlowNode,
...@@ -79,23 +89,24 @@ const BatchNode = (props: IBatchNode) => { ...@@ -79,23 +89,24 @@ const BatchNode = (props: IBatchNode) => {
{title || ""} {title || ""}
{isCheck && <span className={styles.successDot}></span>} {isCheck && <span className={styles.successDot}></span>}
</div> </div>
{outParamsArr?.length && {outParamsArr?.length && flowType === "edit"
outParamsArr.map((item, index) => { ? outParamsArr.map((item, index) => {
return ( return (
<Tooltip title={item.name} key={uuid()}> <Tooltip title={item.name} key={uuid()}>
<Handle <Handle
id={item.name} id={item.name}
style={{ style={{
background: "#fff ", background: "#fff ",
border: "1px solid #D1D6DE", border: "1px solid #D1D6DE",
left: index * 20 + 20, left: index * 20 + 20,
}} }}
type="source" type="source"
position={Position.Bottom} position={Position.Bottom}
/> />
</Tooltip> </Tooltip>
); );
})} })
: null}
</div> </div>
); );
}; };
......
...@@ -210,6 +210,8 @@ const Flow = (props: IProps) => { ...@@ -210,6 +210,8 @@ const Flow = (props: IProps) => {
info: item, info: item,
...(item.type === "BATCH" ...(item.type === "BATCH"
? { ? {
/** flow组件类型 */
flowType,
/** 是否有流节点 */ /** 是否有流节点 */
isFlowNode: isFlowNode(item.id), isFlowNode: isFlowNode(item.id),
/** 选中状态 */ /** 选中状态 */
...@@ -473,16 +475,23 @@ const Flow = (props: IProps) => { ...@@ -473,16 +475,23 @@ const Flow = (props: IProps) => {
[setSelectedBatchNodeId] [setSelectedBatchNodeId]
); );
const reactFlowParams =
flowType === "edit"
? {
onNodesChange,
onEdgesChange,
onNodeDragStop,
onConnect,
onEdgeClick,
}
: {};
return ( return (
<ReactFlow <ReactFlow
nodes={nodes} nodes={nodes}
edges={edges} edges={edges}
fitView={flowType === "default" ? true : false} fitView={flowType === "default" ? true : false}
onNodesChange={onNodesChange} {...reactFlowParams}
onEdgesChange={onEdgesChange}
onNodeDragStop={onNodeDragStop}
onConnect={onConnect}
onEdgeClick={onEdgeClick}
// proOptions={{ hideAttribution: true, account: "" }} // proOptions={{ hideAttribution: true, account: "" }}
nodeTypes={nodeTypes} nodeTypes={nodeTypes}
onPaneClick={handlePaneClick} onPaneClick={handlePaneClick}
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com * @Author: 吴永生#A02208 yongsheng.wu@wholion.com
* @Date: 2022-06-23 11:00:29 * @Date: 2022-06-23 11:00:29
* @LastEditors: 吴永生#A02208 yongsheng.wu@wholion.com * @LastEditors: 吴永生#A02208 yongsheng.wu@wholion.com
* @LastEditTime: 2022-07-12 20:25:50 * @LastEditTime: 2022-07-14 10:11:50
* @FilePath: /bkunyun/src/views/Project/components/Flow/interface.ts * @FilePath: /bkunyun/src/views/Project/components/Flow/interface.ts
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/ */
...@@ -45,6 +45,8 @@ export interface IBatchNodeData { ...@@ -45,6 +45,8 @@ export interface IBatchNodeData {
executionStatus: string executionStatus: string
/** 每一项信息 */ /** 每一项信息 */
info: ITask info: ITask
/** flow组件类型 */
flowType: 'edit' | 'default'
} }
export interface IBatchNode { export interface IBatchNode {
......
...@@ -246,8 +246,10 @@ const OperatorList = observer((props: IOperatorListProps) => { ...@@ -246,8 +246,10 @@ const OperatorList = observer((props: IOperatorListProps) => {
<div className={styles.searchBox}> <div className={styles.searchBox}>
<OutlinedInput <OutlinedInput
onChange={(e) => { onChange={(e) => {
if (e.target.value?.length > 30) return;
setKeyword(e.target.value); setKeyword(e.target.value);
}} }}
value={keyword}
placeholder="输入关键词搜索" placeholder="输入关键词搜索"
onKeyUp={handleEnterCode} onKeyUp={handleEnterCode}
size="small" size="small"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment