Skip to content

Commit

Permalink
removed unused code (#803)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelquigley committed Dec 17, 2024
1 parent 6dca3bb commit b62355d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 89 deletions.
4 changes: 3 additions & 1 deletion ui100/src/Visualizer.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import "@xyflow/react/dist/style.css";
import "./react-flow.css";
import {Background, Controls, ReactFlow, ReactFlowProvider, useEdgesState, useNodesState} from "@xyflow/react";
import {Background, Controls, MiniMap, ReactFlow, ReactFlowProvider, useEdgesState, useNodesState} from "@xyflow/react";
import {VisualOverview} from "./model/visualizer.ts";
import {useEffect} from "react";
import {stratify, tree} from "d3-hierarchy";
import ShareNode from "./ShareNode.tsx";
import EnvironmentNode from "./EnvironmentNode.tsx";
import AccountNode from "../AccountNode.tsx";
import AccessNode from "./AccessNode.tsx";
import {Minimize} from "@mui/icons-material";

interface VisualizerProps {
vov: VisualOverview;
Expand Down Expand Up @@ -72,6 +73,7 @@ export default ({ vov }: VisualizerProps) => {
<div style={{ height: "400px" }}>
<ReactFlowProvider>
<Visualizer vov={vov}/>
<MiniMap />
</ReactFlowProvider>
</div>
);
Expand Down
88 changes: 0 additions & 88 deletions ui100/src/model/visualizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,91 +151,3 @@ export const nodesEqual = (a: Node[], b: Node[]) => {
if(a.length !== b.length) return false;
return a.every((e, i) => e.id === b[i].id && e.data.limited === b[i].data.limited && e.data.label === b[i].data.label);
}

export const buildVisualOverview = (overview: Overview): VisualOverview => {
let out = new VisualOverview();
out.nodes = [
{ id: "0", position: { x: 0, y: 0 }, data: { label: "[email protected]" }, type: "account" }
];
out.edges = [];

let ownedShares: { [key: string]: Node } = {};

overview.environments?.forEach(env => {
if(env.environment && env.environment.zId) {
let envNode = {
id: env.environment.zId,
position: { x: 0, y: 0 },
data: { label: env.environment?.description!, empty: true },
type: "environment",
}
out.nodes.push(envNode);
out.edges.push({
id: env.environment.zId + "-0",
source: "0",
target: env.environment.zId
});

if(env.shares) {
envNode.data.empty = false;
env.shares.forEach(shr => {
let shareNode = {
id: shr.token!,
position: { x: 0, y: 0 },
data: { label: shr.token!, accessed: false },
type: "share",
};
out.nodes.push(shareNode);
ownedShares[shr.token!] = shareNode;
out.edges.push({
id: env.environment?.zId + "-" + shr.token!,
source: env.environment?.zId!,
target: shr.token!
});
});
}
if(env.frontends) {
envNode.data.empty = false;
env.frontends.forEach(acc => {
let accNode = {
id: acc.token!,
position: { x: 0, y: 0 },
data: { label: acc.token!, ownedShare: false, shrToken: acc.shrToken },
type: "access",
}
out.nodes.push(accNode);
out.edges.push({
id: env.environment?.zId + "-" + acc.token!,
source: env.environment?.zId!,
target: acc.token!
});
let ownedShare = ownedShares[acc.shrToken];

});
}
}
});
out.nodes.forEach(n => {
if(n.type == "access") {
let ownedShare = ownedShares[n.data.shrToken];
if(ownedShare) {
console.log("linking owned share", n)
n.data.ownedShare = true;
ownedShare.data.accessed = true;
out.edges.push({
id: n.id + "-" + n.data.shrToken,
source: n.id,
target: n.data.shrToken as string,
targetHandle: "access",
animated: true
});
}
}
})

return out;
}

export const visualOverviewsEqual = (a: VisualOverview, b: VisualOverview): boolean => {
return false;
}

0 comments on commit b62355d

Please sign in to comment.