Skip to content

Commit b62355d

Browse files
removed unused code (#803)
1 parent 6dca3bb commit b62355d

File tree

2 files changed

+3
-89
lines changed

2 files changed

+3
-89
lines changed

ui100/src/Visualizer.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import "@xyflow/react/dist/style.css";
22
import "./react-flow.css";
3-
import {Background, Controls, ReactFlow, ReactFlowProvider, useEdgesState, useNodesState} from "@xyflow/react";
3+
import {Background, Controls, MiniMap, ReactFlow, ReactFlowProvider, useEdgesState, useNodesState} from "@xyflow/react";
44
import {VisualOverview} from "./model/visualizer.ts";
55
import {useEffect} from "react";
66
import {stratify, tree} from "d3-hierarchy";
77
import ShareNode from "./ShareNode.tsx";
88
import EnvironmentNode from "./EnvironmentNode.tsx";
99
import AccountNode from "../AccountNode.tsx";
1010
import AccessNode from "./AccessNode.tsx";
11+
import {Minimize} from "@mui/icons-material";
1112

1213
interface VisualizerProps {
1314
vov: VisualOverview;
@@ -72,6 +73,7 @@ export default ({ vov }: VisualizerProps) => {
7273
<div style={{ height: "400px" }}>
7374
<ReactFlowProvider>
7475
<Visualizer vov={vov}/>
76+
<MiniMap />
7577
</ReactFlowProvider>
7678
</div>
7779
);

ui100/src/model/visualizer.ts

Lines changed: 0 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -151,91 +151,3 @@ export const nodesEqual = (a: Node[], b: Node[]) => {
151151
if(a.length !== b.length) return false;
152152
return a.every((e, i) => e.id === b[i].id && e.data.limited === b[i].data.limited && e.data.label === b[i].data.label);
153153
}
154-
155-
export const buildVisualOverview = (overview: Overview): VisualOverview => {
156-
let out = new VisualOverview();
157-
out.nodes = [
158-
{ id: "0", position: { x: 0, y: 0 }, data: { label: "[email protected]" }, type: "account" }
159-
];
160-
out.edges = [];
161-
162-
let ownedShares: { [key: string]: Node } = {};
163-
164-
overview.environments?.forEach(env => {
165-
if(env.environment && env.environment.zId) {
166-
let envNode = {
167-
id: env.environment.zId,
168-
position: { x: 0, y: 0 },
169-
data: { label: env.environment?.description!, empty: true },
170-
type: "environment",
171-
}
172-
out.nodes.push(envNode);
173-
out.edges.push({
174-
id: env.environment.zId + "-0",
175-
source: "0",
176-
target: env.environment.zId
177-
});
178-
179-
if(env.shares) {
180-
envNode.data.empty = false;
181-
env.shares.forEach(shr => {
182-
let shareNode = {
183-
id: shr.token!,
184-
position: { x: 0, y: 0 },
185-
data: { label: shr.token!, accessed: false },
186-
type: "share",
187-
};
188-
out.nodes.push(shareNode);
189-
ownedShares[shr.token!] = shareNode;
190-
out.edges.push({
191-
id: env.environment?.zId + "-" + shr.token!,
192-
source: env.environment?.zId!,
193-
target: shr.token!
194-
});
195-
});
196-
}
197-
if(env.frontends) {
198-
envNode.data.empty = false;
199-
env.frontends.forEach(acc => {
200-
let accNode = {
201-
id: acc.token!,
202-
position: { x: 0, y: 0 },
203-
data: { label: acc.token!, ownedShare: false, shrToken: acc.shrToken },
204-
type: "access",
205-
}
206-
out.nodes.push(accNode);
207-
out.edges.push({
208-
id: env.environment?.zId + "-" + acc.token!,
209-
source: env.environment?.zId!,
210-
target: acc.token!
211-
});
212-
let ownedShare = ownedShares[acc.shrToken];
213-
214-
});
215-
}
216-
}
217-
});
218-
out.nodes.forEach(n => {
219-
if(n.type == "access") {
220-
let ownedShare = ownedShares[n.data.shrToken];
221-
if(ownedShare) {
222-
console.log("linking owned share", n)
223-
n.data.ownedShare = true;
224-
ownedShare.data.accessed = true;
225-
out.edges.push({
226-
id: n.id + "-" + n.data.shrToken,
227-
source: n.id,
228-
target: n.data.shrToken as string,
229-
targetHandle: "access",
230-
animated: true
231-
});
232-
}
233-
}
234-
})
235-
236-
return out;
237-
}
238-
239-
export const visualOverviewsEqual = (a: VisualOverview, b: VisualOverview): boolean => {
240-
return false;
241-
}

0 commit comments

Comments
 (0)