|
@@ -6,11 +6,61 @@ export const DagToData = (graph: any, dagId: any) => {
|
|
|
if (item?.shape === 'dag-edge') {
|
|
|
const sourceNodeId = graph.getCellById(item.source.cell).data.nodeId
|
|
|
const targetNodeId = graph.getCellById(item.target.cell).data.nodeId
|
|
|
- edges.push([sourceNodeId, targetNodeId])
|
|
|
+ edges.push({
|
|
|
+ source: sourceNodeId,
|
|
|
+ target: targetNodeId
|
|
|
+ })
|
|
|
} else {
|
|
|
switch (item.data?.type) {
|
|
|
case "datasource":
|
|
|
nodes.push({
|
|
|
+ id: item.data.nodeId,
|
|
|
+ name: item.data.nodeName,
|
|
|
+ op: "datasource",
|
|
|
+ data: {
|
|
|
+ input_source: item.data.inputSource,
|
|
|
+ input_table: item.data.dataTableId,
|
|
|
+ }
|
|
|
+ })
|
|
|
+ break;
|
|
|
+ case "outputsource":
|
|
|
+ nodes.push({
|
|
|
+ id: item.data.nodeId,
|
|
|
+ name: item.data.nodeName,
|
|
|
+ op: "datasource",
|
|
|
+ data: {
|
|
|
+ output_source: item.data.outputSource,
|
|
|
+ }
|
|
|
+ })
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ nodes.push({
|
|
|
+ id: item.data.nodeId,
|
|
|
+ name: item.data.nodeName,
|
|
|
+ op: item.data.label,
|
|
|
+ data: {
|
|
|
+ input_number: item.data.inputNumber,
|
|
|
+ output: item.data.outputData,
|
|
|
+ script: item.data.scriptText,
|
|
|
+ param: item.data.paramText,
|
|
|
+ package: item.data.packageData
|
|
|
+ }
|
|
|
+ })
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ const script_nodes: any = []
|
|
|
+ const script_edges: any = []
|
|
|
+ dagData.cells.forEach((item: any) => {
|
|
|
+ if (item?.shape === 'dag-edge') {
|
|
|
+ const sourceNodeId = graph.getCellById(item.source.cell).data.nodeId
|
|
|
+ const targetNodeId = graph.getCellById(item.target.cell).data.nodeId
|
|
|
+ script_edges.push([sourceNodeId, targetNodeId])
|
|
|
+ } else {
|
|
|
+ switch (item.data?.type) {
|
|
|
+ case "datasource":
|
|
|
+ script_nodes.push({
|
|
|
id: item.data.nodeId,
|
|
|
name: item.data.nodeName,
|
|
|
type: 'datasource',
|
|
@@ -21,7 +71,7 @@ export const DagToData = (graph: any, dagId: any) => {
|
|
|
})
|
|
|
break;
|
|
|
case "outputsource":
|
|
|
- /* nodes.push({
|
|
|
+ /* script_nodes.push({
|
|
|
id: item.id,
|
|
|
name: item.data.nodeName,
|
|
|
op: "datasource",
|
|
@@ -31,7 +81,7 @@ export const DagToData = (graph: any, dagId: any) => {
|
|
|
}) */
|
|
|
break;
|
|
|
default:
|
|
|
- nodes.push({
|
|
|
+ script_nodes.push({
|
|
|
id: item.data.nodeId,
|
|
|
type: 'script',
|
|
|
name: item.data.nodeName,
|
|
@@ -52,6 +102,10 @@ export const DagToData = (graph: any, dagId: any) => {
|
|
|
itermidate_data: ["hdfs://host:port/uri"],
|
|
|
nodes,
|
|
|
edges,
|
|
|
+ dag_script: {
|
|
|
+ sub_nodes: script_nodes,
|
|
|
+ edges: script_edges,
|
|
|
+ },
|
|
|
graph: dagData
|
|
|
}
|
|
|
/* dagData.cells.forEach((item: any) => {
|
|
@@ -101,6 +155,7 @@ export const DagToData = (graph: any, dagId: any) => {
|
|
|
}
|
|
|
}
|
|
|
}); */
|
|
|
+
|
|
|
}
|
|
|
|
|
|
const datasourceToSql = (nodeData: any) => {
|