mirror of
https://github.com/openziti/zrok.git
synced 2025-06-25 04:02:15 +02:00
add shares to VisualOverview (#799)
This commit is contained in:
parent
af5becb52e
commit
9f2a335ac5
@ -1,5 +1,6 @@
|
|||||||
import {Overview} from "../api";
|
import {Overview} from "../api";
|
||||||
import {Edge, Node} from "@xyflow/react";
|
import {Edge, Node} from "@xyflow/react";
|
||||||
|
import ShareIcon from "@mui/icons-material/Share";
|
||||||
|
|
||||||
export class VisualOverview {
|
export class VisualOverview {
|
||||||
nodes: Node[];
|
nodes: Node[];
|
||||||
@ -9,27 +10,42 @@ export class VisualOverview {
|
|||||||
const buildVisualizerGraph = (overview: Overview): VisualOverview => {
|
const buildVisualizerGraph = (overview: Overview): VisualOverview => {
|
||||||
let out = new VisualOverview();
|
let out = new VisualOverview();
|
||||||
out.nodes = [
|
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 = [];
|
out.edges = [];
|
||||||
|
|
||||||
overview.environments?.forEach((env, i) => {
|
overview.environments?.forEach(env => {
|
||||||
if(env.environment && env.environment.zId) {
|
if(env.environment && env.environment.zId) {
|
||||||
out.nodes.push({
|
let envNode = {
|
||||||
id: env.environment.zId,
|
id: env.environment.zId,
|
||||||
position: { x: 0, y: 0 },
|
position: { x: 0, y: 0 },
|
||||||
data: { label: env.environment?.description! },
|
data: { label: env.environment?.description! },
|
||||||
});
|
type: "output",
|
||||||
|
}
|
||||||
|
out.nodes.push(envNode);
|
||||||
out.edges.push({
|
out.edges.push({
|
||||||
id: env.environment.zId + "-0",
|
id: env.environment.zId + "-0",
|
||||||
source: "0",
|
source: "0",
|
||||||
target: env.environment.zId
|
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;
|
return out;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user