Skip to content

Commit

Permalink
feature: update seatunnel dag
Browse files Browse the repository at this point in the history
  • Loading branch information
wangqi committed Jan 18, 2024
1 parent 724bec7 commit bca773f
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,11 @@ const SeaTunnelConnectorDagNode = ({node}: { node: Node }) => {
setDrawerForm({visible: visible, data: node});
}}
onOK={(values) => {
const graph = node?.model?.graph;
node.setData({
...node.data,
label: values[STEP_ATTR_TYPE.stepTitle],
attrs: values
})
graph?.updateCellId(node, node.id)
setDrawerForm({visible: false, data: node});
}}
data={drawerForm.data}/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,19 @@ const InitShape: React.FC<Props<WsDiJob>> = ({data}) => {
nodes.push({
id: step.stepCode,
shape: DAG_NODE,
view: "react-shape-view",
position: {
x: step.positionX,
y: step.positionY
},
ports: createPorts(step.stepMeta.type as string, step.stepCode),
ports: {
items: createItems(step.stepMeta.type as string, step.stepCode)
},
data: {
label: step.stepTitle,
meta: step.stepMeta,
attrs: step.stepAttrs
}
},
});
});
addNodes(nodes)
Expand All @@ -62,7 +65,7 @@ const InitShape: React.FC<Props<WsDiJob>> = ({data}) => {
});
}, []);

const createPorts = (type: string, stepCode: string) => {
const createItems = (type: string, stepCode: string) => {
if (type === 'source') {
return [{
id: stepCode + '-bottom',
Expand All @@ -88,6 +91,93 @@ const InitShape: React.FC<Props<WsDiJob>> = ({data}) => {
return []
}
}

const createGroups = (type: string, name: string) => {
if (type === 'source') {
return {
top: {
position: "top",
attrs: {
circle: {
r: 4,
magnet: true,
stroke: '#C2C8D5',
strokeWidth: 1,
fill: "#fff"
}
}
},
bottom: {
position: "bottom",
attrs: {
circle: {
r: 4,
magnet: true,
stroke: '#C2C8D5',
strokeWidth: 1,
fill: "#fff"
}
}
}
}
} else if (type === 'sink') {
return {
top: {
position: "top",
attrs: {
circle: {
r: 4,
magnet: true,
stroke: '#C2C8D5',
strokeWidth: 1,
fill: "#fff"
}
}
},
bottom: {
position: "bottom",
attrs: {
circle: {
r: 4,
magnet: true,
stroke: '#C2C8D5',
strokeWidth: 1,
fill: "#fff"
}
}
}
}
} else if (type === 'transform') {
return {
top: {
position: "top",
attrs: {
circle: {
r: 4,
magnet: true,
stroke: '#C2C8D5',
strokeWidth: 1,
fill: "#fff"
}
}
},
bottom: {
position: "bottom",
attrs: {
circle: {
r: 4,
magnet: true,
stroke: '#C2C8D5',
strokeWidth: 1,
fill: "#fff"
}
}
}
}
} else {
return []
}
}
return null;
}
;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@ const SourceJdbcStepForm: React.FC<ModalFormProps<Node>> = ({data, visible, onCa
type="primary"
onClick={() => {
form.validateFields().then((values) => {
const attrs = Object.keys(values)
.filter((key) => values[key] != null && values[key] != undefined)
.reduce((acc, key) => ({...acc, [key]: values[key]}), {});
if (onOK) {
onOK(values);
onOK(attrs);
}
});
}}
Expand Down

0 comments on commit bca773f

Please sign in to comment.