Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
bkunyun
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
bkunyun
Commits
e7c84a3e
Commit
e7c84a3e
authored
Aug 10, 2022
by
chenshouchao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 新增算子联调60%
parent
f28c1e6c
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
107 additions
and
87 deletions
+107
-87
index.tsx
src/views/CustomOperator/components/OperatorList/index.tsx
+53
-48
index.tsx
src/views/CustomOperator/components/SaveOperator/index.tsx
+0
-0
index.tsx
src/views/CustomOperator/index.tsx
+20
-7
index.tsx
src/views/Project/ProjectSubmitWork/ConfigForm/index.tsx
+9
-8
index.tsx
src/views/Project/ProjectSubmitWork/index.tsx
+7
-7
index.tsx
...ct/components/Flow/components/BatchOperatorFlow/index.tsx
+4
-4
index.tsx
src/views/Project/components/Flow/index.tsx
+3
-2
index.tsx
src/views/WorkFlowEdit/components/OperatorList/index.tsx
+3
-3
index.tsx
src/views/WorkFlowEdit/components/ParameterSetting/index.tsx
+8
-8
No files found.
src/views/CustomOperator/components/OperatorList/index.tsx
View file @
e7c84a3e
...
...
@@ -47,56 +47,61 @@ const OperatorList = (props: IProps) => {
// 获取算子列表
const
{
run
:
getOperatorListRun
,
loading
}
=
useMyRequest
(
getOperatorList
,
{
onSuccess
:
(
res
)
=>
{
let
arr
=
res
?.
data
?.
content
;
let
arr
=
res
?.
data
?.
content
.
map
((
item
:
any
)
=>
{
return
{
...
item
,
edges
:
[],
};
});
setIsLastPage
(
res
?.
data
?.
last
);
// todo 去掉parameters添加
arr
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
item
.
edges
=
[];
item
.
parameters
.
push
({
choices
:
[],
classType
:
"STRING"
,
classTypeName
:
"String"
,
defaultValue
:
null
,
description
:
""
,
domType
:
"dataset"
,
hidden
:
false
,
isnull
:
false
,
level
:
null
,
linked
:
false
,
many
:
false
,
name
:
`in
${
index
+
1
}
`
,
order
:
0
,
parameterGroup
:
"in"
,
promoted
:
false
,
promotedName
:
null
,
required
:
false
,
title
:
null
,
validators
:
[],
});
});
arr
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
item
.
parameters
.
push
({
choices
:
[],
classType
:
"STRING"
,
classTypeName
:
"String"
,
defaultValue
:
null
,
description
:
""
,
domType
:
"dataset"
,
hidden
:
false
,
isnull
:
false
,
level
:
null
,
linked
:
false
,
many
:
false
,
name
:
`out
${
index
+
1
}
`
,
order
:
0
,
parameterGroup
:
"out"
,
promoted
:
false
,
promotedName
:
null
,
required
:
false
,
title
:
null
,
validators
:
[],
});
});
//
arr.forEach((item: any, index: number) => {
//
item.edges = [];
//
item.parameters.push({
//
choices: [],
//
classType: "STRING",
//
classTypeName: "String",
//
defaultValue: null,
//
description: "",
//
domType: "dataset",
//
hidden: false,
//
isnull: false,
//
level: null,
//
linked: false,
//
many: false,
//
name: `in${index + 1}`,
//
order: 0,
//
parameterGroup: "in",
//
promoted: false,
//
promotedName: null,
//
required: false,
//
title: null,
//
validators: [],
//
});
//
});
//
arr.forEach((item: any, index: number) => {
//
item.parameters.push({
//
choices: [],
//
classType: "STRING",
//
classTypeName: "String",
//
defaultValue: null,
//
description: "",
//
domType: "dataset",
//
hidden: false,
//
isnull: false,
//
level: null,
//
linked: false,
//
many: false,
//
name: `out${index + 1}`,
//
order: 0,
//
parameterGroup: "out",
//
promoted: false,
//
promotedName: null,
//
required: false,
//
title: null,
//
validators: [],
//
});
//
});
setList
([...
list
,
...
arr
]);
},
});
...
...
src/views/CustomOperator/components/SaveOperator/index.tsx
View file @
e7c84a3e
This diff is collapsed.
Click to expand it.
src/views/CustomOperator/index.tsx
View file @
e7c84a3e
...
...
@@ -31,10 +31,13 @@ const CustomOperator = observer((props: IProps) => {
// 判断 每个流算子必须至少有一条连接线。
const
checkHasOneLine
=
(
sourceArr
:
string
[],
targetArr
:
string
[])
=>
{
console
.
log
(
"checkHasOneLine"
);
const
all
=
_
.
uniq
([...
sourceArr
,
...
targetArr
]);
if
(
all
.
length
===
operatorList
.
length
)
{
console
.
log
(
"checkHasOneLine1"
);
return
true
;
}
else
{
console
.
log
(
"checkHasOneLine2"
);
return
false
;
}
// _.uniq([2, 1, 2]);
...
...
@@ -42,6 +45,7 @@ const CustomOperator = observer((props: IProps) => {
// 判断 每个起始算子(可以有多个起始点)的输入必须为文件的路径输入或数据集的路径输入。
const
checkIn
=
(
targetArr
:
string
[])
=>
{
console
.
log
(
"checkIn"
);
const
uniqTargetArr
=
_
.
uniq
(
targetArr
);
if
(
uniqTargetArr
.
length
===
operatorList
.
length
)
{
// 流节点连成一个圈了
...
...
@@ -57,7 +61,11 @@ const CustomOperator = observer((props: IProps) => {
if
(
inArr
.
length
>
0
)
{
if
(
!
inArr
.
some
((
inItem
)
=>
{
return
inItem
.
domType
===
"dataset"
||
inItem
.
domType
===
"path"
;
return
(
(
inItem
.
domType
||
""
).
toLowerCase
()
===
"dataset"
||
(
inItem
.
domType
||
""
).
toLowerCase
()
===
"path"
||
(
inItem
.
domType
||
""
).
toLowerCase
()
===
"file"
);
})
)
{
check
=
false
;
...
...
@@ -73,6 +81,7 @@ const CustomOperator = observer((props: IProps) => {
// 判断 起码有一个结尾算子(可以有多个结尾点)的输出必须为文件保存或数据集保存。
const
checkOut
=
(
sourceArr
:
string
[])
=>
{
console
.
log
(
"checkOut"
);
const
uniqSourceArr
=
_
.
uniq
(
sourceArr
);
if
(
uniqSourceArr
.
length
===
operatorList
.
length
)
{
// 流节点连成一个圈了
...
...
@@ -82,13 +91,17 @@ const CustomOperator = observer((props: IProps) => {
operatorList
.
forEach
((
flowNode
)
=>
{
if
(
uniqSourceArr
.
indexOf
(
flowNode
.
id
)
===
-
1
)
{
// 该节点的输入没有连线 也就是说这个节点是起点
const
in
Arr
=
flowNode
.
parameters
.
filter
(
(
parameter
)
=>
parameter
.
parameterGroup
===
"
in
"
const
out
Arr
=
flowNode
.
parameters
.
filter
(
(
parameter
)
=>
parameter
.
parameterGroup
===
"
out
"
);
if
(
in
Arr
.
length
>
0
)
{
if
(
out
Arr
.
length
>
0
)
{
if
(
!
inArr
.
some
((
inItem
)
=>
{
return
inItem
.
domType
===
"dataset"
||
inItem
.
domType
===
"file"
;
!
outArr
.
some
((
outItem
)
=>
{
return
(
(
outItem
.
domType
||
""
).
toLowerCase
()
===
"dataset"
||
(
outItem
.
domType
||
""
).
toLowerCase
()
===
"file"
||
(
outItem
.
domType
||
""
).
toLowerCase
()
===
"path"
);
})
)
{
check
=
false
;
...
...
@@ -168,7 +181,7 @@ const CustomOperator = observer((props: IProps) => {
type=
"edit"
onFlowNodeClick=
{
handleNodeClick
}
flowNodeDraggable=
{
true
}
//
ListenState={!saveFormDialog}
ListenState=
{
!
saveFormDialog
}
showVersion=
{
true
}
showControls=
{
false
}
/>
...
...
src/views/Project/ProjectSubmitWork/ConfigForm/index.tsx
View file @
e7c84a3e
...
...
@@ -215,7 +215,7 @@ const ConfigForm = (props: ConfigFormProps) => {
</
div
>
<
MyTooltip
title=
{
parameter
.
description
}
placement=
"right"
>
<
div
className=
{
styles
.
parameterContent
}
>
{
parameter
.
domType
.
toLowerCase
()
===
"file"
&&
(
{
(
parameter
.
domType
||
""
)
.
toLowerCase
()
===
"file"
&&
(
<
MyInput
onFocus=
{
()
=>
setSelectedBatchNodeId
(
batchId
||
""
)
}
onBlur=
{
()
=>
setSelectedBatchNodeId
(
""
)
}
...
...
@@ -239,7 +239,7 @@ const ConfigForm = (props: ConfigFormProps) => {
size=
"medium"
></
MyInput
>
)
}
{
parameter
.
domType
.
toLowerCase
()
===
"path"
&&
(
{
(
parameter
.
domType
||
""
)
.
toLowerCase
()
===
"path"
&&
(
<
MyInput
onFocus=
{
()
=>
setSelectedBatchNodeId
(
batchId
||
""
)
}
onBlur=
{
()
=>
setSelectedBatchNodeId
(
""
)
}
...
...
@@ -263,7 +263,7 @@ const ConfigForm = (props: ConfigFormProps) => {
size=
"medium"
></
MyInput
>
)
}
{
parameter
.
domType
.
toLowerCase
()
===
"dataset"
&&
(
{
(
parameter
.
domType
||
""
)
.
toLowerCase
()
===
"dataset"
&&
(
<
MyInput
onFocus=
{
()
=>
setSelectedBatchNodeId
(
taskId
)
}
onBlur=
{
()
=>
setSelectedBatchNodeId
(
""
)
}
...
...
@@ -287,7 +287,7 @@ const ConfigForm = (props: ConfigFormProps) => {
size=
"medium"
></
MyInput
>
)
}
{
parameter
.
domType
.
toLowerCase
()
===
"input"
&&
(
{
(
parameter
.
domType
||
""
)
.
toLowerCase
()
===
"input"
&&
(
<
MyInput
onFocus=
{
()
=>
{
setSelectedBatchNodeId
(
batchId
||
""
);
...
...
@@ -304,7 +304,7 @@ const ConfigForm = (props: ConfigFormProps) => {
size=
"medium"
></
MyInput
>
)
}
{
parameter
.
domType
.
toLowerCase
()
===
"select"
&&
(
{
(
parameter
.
domType
||
""
)
.
toLowerCase
()
===
"select"
&&
(
<
MySelect
onFocus=
{
()
=>
setSelectedBatchNodeId
(
batchId
||
""
)
}
onBlur=
{
()
=>
setSelectedBatchNodeId
(
""
)
}
...
...
@@ -326,7 +326,8 @@ const ConfigForm = (props: ConfigFormProps) => {
fullWidth
></
MySelect
>
)
}
{
parameter
.
domType
.
toLowerCase
()
===
"multipleselect"
&&
(
{
(
parameter
.
domType
||
""
).
toLowerCase
()
===
"multipleselect"
&&
(
<
MySelect
onFocus=
{
()
=>
setSelectedBatchNodeId
(
batchId
||
""
)
}
onBlur=
{
()
=>
setSelectedBatchNodeId
(
""
)
}
...
...
@@ -349,7 +350,7 @@ const ConfigForm = (props: ConfigFormProps) => {
fullWidth
></
MySelect
>
)
}
{
parameter
.
domType
.
toLowerCase
()
===
"radio"
&&
(
{
(
parameter
.
domType
||
""
)
.
toLowerCase
()
===
"radio"
&&
(
<
MyRadio
value=
{
parameter
.
value
}
onChange=
{
(
e
:
any
)
=>
...
...
@@ -362,7 +363,7 @@ const ConfigForm = (props: ConfigFormProps) => {
helperText=
{
parameter
.
helperText
}
></
MyRadio
>
)
}
{
parameter
.
domType
.
toLowerCase
()
===
"checkbox"
&&
(
{
(
parameter
.
domType
||
""
)
.
toLowerCase
()
===
"checkbox"
&&
(
<
MyCheckBox
value=
{
parameter
.
value
}
onChange=
{
(
e
:
any
)
=>
...
...
src/views/Project/ProjectSubmitWork/index.tsx
View file @
e7c84a3e
...
...
@@ -70,16 +70,16 @@ const ProjectSubmitWork = observer(() => {
let
value
:
any
=
undefined
;
if
(
parameter
.
defaultValue
)
{
if
(
parameter
.
domType
.
toLowerCase
()
===
"multipleselect"
||
parameter
.
domType
.
toLowerCase
()
===
"checkbox"
(
parameter
.
domType
||
""
)
.
toLowerCase
()
===
"multipleselect"
||
(
parameter
.
domType
||
""
)
.
toLowerCase
()
===
"checkbox"
)
{
value
=
parameter
.
defaultValue
.
split
(
","
);
}
else
{
value
=
parameter
.
defaultValue
;
}
}
else
if
(
parameter
.
domType
.
toLowerCase
()
===
"multipleselect"
||
parameter
.
domType
.
toLowerCase
()
===
"checkbox"
(
parameter
.
domType
||
""
)
.
toLowerCase
()
===
"multipleselect"
||
(
parameter
.
domType
||
""
)
.
toLowerCase
()
===
"checkbox"
)
{
value
=
[];
}
else
{
...
...
@@ -179,9 +179,9 @@ const ProjectSubmitWork = observer(() => {
value
=
parameter
.
value
;
}
if
(
parameter
.
domType
.
toLowerCase
()
===
"path"
||
parameter
.
domType
.
toLowerCase
()
===
"dataset"
||
parameter
.
domType
.
toLowerCase
()
===
"file"
(
parameter
.
domType
||
""
)
.
toLowerCase
()
===
"path"
||
(
parameter
.
domType
||
""
)
.
toLowerCase
()
===
"dataset"
||
(
parameter
.
domType
||
""
)
.
toLowerCase
()
===
"file"
)
{
value
=
`/
${
value
}
`
;
}
...
...
src/views/Project/components/Flow/components/BatchOperatorFlow/index.tsx
View file @
e7c84a3e
...
...
@@ -50,6 +50,7 @@ const BatchOperatorFlow = (props: IProps) => {
showVersion
=
false
,
...
other
}
=
props
;
console
.
log
(
tasks
);
/** 自定义的节点类型 */
const
nodeTypes
=
useMemo
(()
=>
{
return
{
batchNode
:
BatchNode
,
flowNode
:
FlowNode
};
...
...
@@ -62,7 +63,7 @@ const BatchOperatorFlow = (props: IProps) => {
/** 原始数据删除线 */
const
tasksDeleteLine
=
useCallback
(
(
connection
:
Connection
|
Edge
)
=>
{
(
connection
:
Connection
|
Edge
|
any
)
=>
{
const
result
=
(
tasks
?.
length
&&
tasks
.
map
((
item
)
=>
{
...
...
@@ -70,9 +71,7 @@ const BatchOperatorFlow = (props: IProps) => {
if
(
item
.
id
===
connection
.
source
)
{
const
newEdges
=
(
item
.
edges
?.
length
&&
item
.
edges
?.
filter
(
(
every
)
=>
every
.
sourceHandle
!==
connection
.
sourceHandle
))
||
item
.
edges
?.
filter
((
every
)
=>
every
.
id
!==
connection
.
id
))
||
[];
return
{
...
item
,
...
...
@@ -91,6 +90,7 @@ const BatchOperatorFlow = (props: IProps) => {
/** 删除流节点或者线 */
const
deleteSelectFlowNode
=
useCallback
(
(
e
:
any
)
=>
{
console
.
log
(
tasks
);
if
(
e
.
keyCode
===
8
&&
ListenState
)
{
/** 删除流节点逻辑 */
if
(
inSideFlowNodeId
)
{
...
...
src/views/Project/components/Flow/index.tsx
View file @
e7c84a3e
...
...
@@ -18,7 +18,7 @@ import FlowNode from "./components/FlowNode";
import
{
getCustomTemplateParameterCheckResult
}
from
"@/views/WorkFlowEdit/util"
;
import
{
useMessage
}
from
"@/components/MySnackbar"
;
import
styles
from
'./index.module.css'
import
styles
from
"./index.module.css"
;
/*
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com
...
...
@@ -61,6 +61,7 @@ const Flow = (props: IProps) => {
showControls
=
true
,
...
other
}
=
props
;
console
.
log
(
tasks
);
/** 自定义的节点类型 */
const
nodeTypes
=
useMemo
(()
=>
{
return
{
batchNode
:
BatchNode
,
flowNode
:
FlowNode
};
...
...
@@ -375,7 +376,7 @@ const Flow = (props: IProps) => {
setInSideFlowNodeId
(
""
);
onBatchClick
&&
onBatchClick
(
""
);
setSelectedEdge
(
undefined
);
onFlowNodeClick
&&
onFlowNodeClick
(
''
)
onFlowNodeClick
&&
onFlowNodeClick
(
""
);
};
/** node节点 */
...
...
src/views/WorkFlowEdit/components/OperatorList/index.tsx
View file @
e7c84a3e
...
...
@@ -29,7 +29,7 @@ let count = 1;
const
OperatorItem
=
(
props
:
IOperatorItemProps
)
=>
{
const
{
info
:
{
title
,
description
,
tags
,
version
},
info
:
{
title
,
description
,
tags
,
version
},
setTemplateConfigInfo
,
templateConfigInfo
,
operatorListData
,
...
...
@@ -75,7 +75,7 @@ const OperatorItem = (props: IOperatorItemProps) => {
x
:
item
.
type
===
"BATCH"
?
x
:
item
.
position
?.
x
,
y
:
item
.
type
===
"BATCH"
?
y
:
item
.
position
?.
y
,
},
edges
:
newEdges
.
length
?
newEdges
:
item
?.
edges
,
edges
:
newEdges
?
.
length
?
newEdges
:
item
?.
edges
,
};
});
return
newVal
;
...
...
@@ -133,7 +133,7 @@ const OperatorItem = (props: IOperatorItemProps) => {
<
h2
className=
{
styles
.
operatorItemTitle
}
>
{
title
}
</
h2
>
<
div
className=
{
styles
.
operatorItemText
}
>
{
description
}
</
div
>
<
div
className=
{
styles
.
footerBox
}
>
{
tags
?.
map
((
item
:
string
)
=>
{
{
tags
?.
map
((
item
:
string
)
=>
{
return
(
<
span
key=
{
item
}
...
...
src/views/WorkFlowEdit/components/ParameterSetting/index.tsx
View file @
e7c84a3e
...
...
@@ -395,7 +395,7 @@ const ParameterSetting = (props: IParameterSettingProps) => {
return
(
<
MyTooltip
title=
{
parameter
.
description
}
placement=
"right"
>
<
div
>
{
parameter
.
domType
.
toLowerCase
()
===
"file"
&&
(
{
(
parameter
.
domType
||
""
)
.
toLowerCase
()
===
"file"
&&
(
<
MyInput
value=
{
parameter
.
defaultValue
||
""
}
InputProps=
{
{
...
...
@@ -420,7 +420,7 @@ const ParameterSetting = (props: IParameterSettingProps) => {
disabled=
{
parameter
.
parameterGroup
===
"out"
}
></
MyInput
>
)
}
{
parameter
.
domType
.
toLowerCase
()
===
"path"
&&
(
{
(
parameter
.
domType
||
""
)
.
toLowerCase
()
===
"path"
&&
(
<
MyInput
value=
{
parameter
.
defaultValue
||
""
}
InputProps=
{
{
...
...
@@ -445,7 +445,7 @@ const ParameterSetting = (props: IParameterSettingProps) => {
disabled=
{
parameter
.
parameterGroup
===
"out"
}
></
MyInput
>
)
}
{
parameter
.
domType
.
toLowerCase
()
===
"dataset"
&&
(
{
(
parameter
.
domType
||
""
)
.
toLowerCase
()
===
"dataset"
&&
(
<
MyInput
value=
{
parameter
.
defaultValue
||
""
}
InputProps=
{
{
...
...
@@ -470,7 +470,7 @@ const ParameterSetting = (props: IParameterSettingProps) => {
disabled=
{
parameter
.
parameterGroup
===
"out"
}
></
MyInput
>
)
}
{
parameter
.
domType
.
toLowerCase
()
===
"input"
&&
(
{
(
parameter
.
domType
||
""
)
.
toLowerCase
()
===
"input"
&&
(
<
MyInput
value=
{
parameter
.
defaultValue
||
""
}
onChange=
{
(
e
:
any
)
=>
...
...
@@ -482,7 +482,7 @@ const ParameterSetting = (props: IParameterSettingProps) => {
disabled=
{
parameter
.
parameterGroup
===
"out"
}
></
MyInput
>
)
}
{
parameter
.
domType
.
toLowerCase
()
===
"select"
&&
(
{
(
parameter
.
domType
||
""
)
.
toLowerCase
()
===
"select"
&&
(
<
MySelect
value=
{
parameter
.
defaultValue
}
onChange=
{
(
e
:
any
)
=>
...
...
@@ -501,7 +501,7 @@ const ParameterSetting = (props: IParameterSettingProps) => {
disabled=
{
parameter
.
parameterGroup
===
"out"
}
></
MySelect
>
)
}
{
parameter
.
domType
.
toLowerCase
()
===
"multipleselect"
&&
(
{
(
parameter
.
domType
||
""
)
.
toLowerCase
()
===
"multipleselect"
&&
(
<
MySelect
value=
{
parameter
.
defaultValue
}
onChange=
{
(
e
:
any
)
=>
...
...
@@ -521,7 +521,7 @@ const ParameterSetting = (props: IParameterSettingProps) => {
disabled=
{
parameter
.
parameterGroup
===
"out"
}
></
MySelect
>
)
}
{
parameter
.
domType
.
toLowerCase
()
===
"radio"
&&
(
{
(
parameter
.
domType
||
""
)
.
toLowerCase
()
===
"radio"
&&
(
<
MyRadio
value=
{
parameter
.
defaultValue
}
onChange=
{
(
e
:
any
)
=>
...
...
@@ -532,7 +532,7 @@ const ParameterSetting = (props: IParameterSettingProps) => {
helperText=
{
parameter
.
helperText
}
></
MyRadio
>
)
}
{
parameter
.
domType
.
toLowerCase
()
===
"checkbox"
&&
(
{
(
parameter
.
domType
||
""
)
.
toLowerCase
()
===
"checkbox"
&&
(
<
MyCheckBox
value=
{
parameter
.
defaultValue
}
onChange=
{
(
e
:
any
)
=>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment