add shares to VisualOverview (#799)

This commit is contained in:
Michael Quigley 2024-12-05 14:57:11 -05:00
parent af5becb52e
commit 9f2a335ac5
No known key found for this signature in database
GPG Key ID: 9B60314A9DD20A62

View File

@ -1,5 +1,6 @@
import {Overview} from "../api";
import {Edge, Node} from "@xyflow/react";
import ShareIcon from "@mui/icons-material/Share";
export class VisualOverview {
nodes: Node[];
@ -9,27 +10,42 @@ export class VisualOverview {
const buildVisualizerGraph = (overview: Overview): VisualOverview => {
let out = new VisualOverview();
out.nodes = [
{ id: "0", position: { x: 0, y: 0 }, data: { label: "michael@quigley.com" } }
{ id: "0", position: { x: 0, y: 0 }, data: { label: "michael@quigley.com" }, type: "input" }
];
out.edges = [];
overview.environments?.forEach((env, i) => {
overview.environments?.forEach(env => {
if(env.environment && env.environment.zId) {
out.nodes.push({
let envNode = {
id: env.environment.zId,
position: { x: 0, y: 0 },
data: { label: env.environment?.description! },
});
type: "output",
}
out.nodes.push(envNode);
out.edges.push({
id: env.environment.zId + "-0",
source: "0",
target: env.environment.zId
});
if(env.shares) {
envNode.type = "default";
env.shares.forEach(shr => {
out.nodes.push({
id: shr.token!,
position: { x: 0, y: 0 },
data: { label: shr.token! },
type: "output",
});
out.edges.push({
id: env.environment?.zId + "-" + shr.token!,
source: env.environment?.zId!,
target: shr.token!
});
});
}
})
console.log(out);
}
});
return out;
}