Skip to content
Snippets Groups Projects
Commit 34b653c0 authored by Giannis Koumoutsos's avatar Giannis Koumoutsos
Browse files

allow generated type and connect it to basic node type

parent a0cd1a47
No related branches found
No related tags found
1 merge request!402generated type is correctly displayed on canvas
Pipeline #137832 failed
...@@ -55,6 +55,7 @@ const nodeTypes = { ...@@ -55,6 +55,7 @@ const nodeTypes = {
graph: GraphNode, graph: GraphNode,
method: DataNode, method: DataNode,
ppfmethod: DataNode, ppfmethod: DataNode,
generated: DataNode,
graphInput: GraphInOutNode, graphInput: GraphInOutNode,
graphOutput: GraphInOutNode, graphOutput: GraphInOutNode,
class: DataNode, class: DataNode,
...@@ -71,10 +72,10 @@ function Canvas() { ...@@ -71,10 +72,10 @@ function Canvas() {
}>(); }>();
const displayedWorkflowInfo = useStore( const displayedWorkflowInfo = useStore(
(state) => state.displayedWorkflowInfo, (state) => state.displayedWorkflowInfo
); );
const setDisplayedWorkflowInfo = useStore( const setDisplayedWorkflowInfo = useStore(
(state) => state.setDisplayedWorkflowInfo, (state) => state.setDisplayedWorkflowInfo
); );
const addLoadedGraph = useStore((state) => state.addLoadedGraph); const addLoadedGraph = useStore((state) => state.addLoadedGraph);
...@@ -88,8 +89,15 @@ function Canvas() { ...@@ -88,8 +89,15 @@ function Canvas() {
const setDataFromNodes = useNodeDataStore((state) => state.setDataFromNodes); const setDataFromNodes = useNodeDataStore((state) => state.setDataFromNodes);
const setEdgeData = useEdgeDataStore((state) => state.setEdgeData); const setEdgeData = useEdgeDataStore((state) => state.setEdgeData);
const setDataFromEdges = useEdgeDataStore((state) => state.setDataFromEdges); const setDataFromEdges = useEdgeDataStore((state) => state.setDataFromEdges);
const { fitView, setNodes, setEdges, getNodes, getEdges, addNodes, getNode } = const {
rfInstance; fitView,
setNodes,
setEdges,
getNodes,
getEdges,
addNodes,
getNode,
} = rfInstance;
useEffect(() => { useEffect(() => {
setTimeout(() => { setTimeout(() => {
...@@ -122,11 +130,10 @@ function Canvas() { ...@@ -122,11 +130,10 @@ function Canvas() {
} }
const stateRF = storeRF.getState(); const stateRF = storeRF.getState();
const reactFlowBounds = const reactFlowBounds = reactFlowWrapper.current?.getBoundingClientRect() || {
reactFlowWrapper.current?.getBoundingClientRect() || { left: 0,
left: 0, top: 0,
top: 0, };
};
const taskInfo = retrieveTaskInfo(event.dataTransfer); const taskInfo = retrieveTaskInfo(event.dataTransfer);
if (!taskInfo) { if (!taskInfo) {
...@@ -210,7 +217,7 @@ function Canvas() { ...@@ -210,7 +217,7 @@ function Canvas() {
getNodes(), getNodes(),
getEdges(), getEdges(),
getNodesData(), getNodesData(),
oldEdge, oldEdge
); );
if (!isValid) { if (!isValid) {
showWarningMsg(reason); showWarningMsg(reason);
...@@ -218,7 +225,7 @@ function Canvas() { ...@@ -218,7 +225,7 @@ function Canvas() {
const newEdges = addEdge( const newEdges = addEdge(
{ ...oldEdge, ...newConnection }, { ...oldEdge, ...newConnection },
getEdges().filter((edge) => edge.id !== oldEdge.id), getEdges().filter((edge) => edge.id !== oldEdge.id)
); );
setEdges(newEdges); setEdges(newEdges);
...@@ -283,7 +290,7 @@ function Canvas() { ...@@ -283,7 +290,7 @@ function Canvas() {
}, 300); }, 300);
} else { } else {
showErrorMsg( showErrorMsg(
`The subgraph ${nodeData.task_props.task_identifier} cannot be located!`, `The subgraph ${nodeData.task_props.task_identifier} cannot be located!`
); );
} }
} }
...@@ -331,7 +338,7 @@ function Canvas() { ...@@ -331,7 +338,7 @@ function Canvas() {
connection, connection,
getNodes(), getNodes(),
getEdges(), getEdges(),
getNodesData(), getNodesData()
); );
if (!isValid) { if (!isValid) {
showWarningMsg(reason); showWarningMsg(reason);
......
...@@ -104,7 +104,8 @@ export type TaskType = ...@@ -104,7 +104,8 @@ export type TaskType =
| 'class' | 'class'
| 'note' | 'note'
| 'script' | 'script'
| 'subworkflow'; | 'subworkflow'
| 'generated';
export interface Task { export interface Task {
task_type: TaskType; task_type: TaskType;
...@@ -298,7 +299,7 @@ export interface CustomTableCellProps { ...@@ -298,7 +299,7 @@ export interface CustomTableCellProps {
onChange( onChange(
e: { target: { name: string; value: string | number } }, e: { target: { name: string; value: string | number } },
row: EditableTableRow, row: EditableTableRow,
index: number, index: number
): void; ): void;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment