Skip to content

Commit 0ae147a

Browse files
committed
[DOP-25788] Make output.type a list
1 parent b264929 commit 0ae147a

File tree

3 files changed

+24
-18
lines changed

3 files changed

+24
-18
lines changed

src/components/lineage/converters/getGraphEdges.tsx

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,22 @@ const getMinimalEdge = (relation: BaseRelationLineageResponseV1): Edge => {
4444
};
4545
};
4646

47+
const getOutputEdgeColor = (
48+
relation: OutputRelationLineageResponseV1,
49+
): string => {
50+
for (const type of relation.types) {
51+
switch (type) {
52+
case "DROP":
53+
case "TRUNCATE":
54+
return "red";
55+
case "ALTER":
56+
case "RENAME":
57+
return "yellow";
58+
}
59+
}
60+
return "green";
61+
};
62+
4763
const getOutputEdge = (
4864
relation: OutputRelationLineageResponseV1,
4965
raw_response: LineageResponseV1,
@@ -79,19 +95,7 @@ const getOutputEdge = (
7995
}
8096
}
8197

82-
let color = "green";
83-
switch (relation.type) {
84-
case "DROP":
85-
case "TRUNCATE":
86-
color = "red";
87-
break;
88-
case "ALTER":
89-
case "RENAME":
90-
color = "yellow";
91-
break;
92-
default:
93-
color = "green";
94-
}
98+
const color = getOutputEdgeColor(relation);
9599

96100
// Too many animated edges is heavy load for browser
97101
const totalIOEdges =

src/components/lineage/edges/IOEdge.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ const IOEdge = ({
3939
return <ReactFlowBaseEdge id={id} path={edgePath} {...props} />;
4040
}
4141

42+
const types = ((data.types ?? []) as string[]).map((type) =>
43+
translate(`edges.ioTypes.${type}`, { _: type }),
44+
);
45+
4246
return (
4347
<>
4448
<ReactFlowBaseEdge id={id} path={edgePath} {...props} />
@@ -53,13 +57,11 @@ const IOEdge = ({
5357
}}
5458
className={`nodrag nopan ${selected ? "selected" : ""}`}
5559
>
56-
{data.type ? (
60+
{types.length ? (
5761
<Chip
5862
size="small"
5963
color="secondary"
60-
label={translate(`edges.ioTypes.${data.type}`, {
61-
_: data.type,
62-
})}
64+
label={types.join(", ")}
6365
style={props.labelStyle}
6466
/>
6567
) : null}

src/dataProvider/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ type OutputRelationTypeLineageResponseV1 =
190190
interface OutputRelationLineageResponseV1
191191
extends BaseRelationLineageResponseV1 {
192192
last_interaction_at: string;
193-
type: OutputRelationTypeLineageResponseV1 | null;
193+
types: OutputRelationTypeLineageResponseV1[];
194194
num_rows: number | null;
195195
num_bytes: number | null;
196196
num_files: number | null;

0 commit comments

Comments
 (0)