diff --git a/ui100/AccountNode.tsx b/ui100/AccountNode.tsx new file mode 100644 index 00000000..a6658fb0 --- /dev/null +++ b/ui100/AccountNode.tsx @@ -0,0 +1,17 @@ +import {Handle, Position} from "@xyflow/react"; +import {Grid2} from "@mui/material"; +import AccountIcon from "@mui/icons-material/Person4"; + +const AccountNode = ({ data }) => { + return ( + <> + + + + {data.label} + + + ); +} + +export default AccountNode; \ No newline at end of file diff --git a/ui100/src/EnvironmentNode.tsx b/ui100/src/EnvironmentNode.tsx new file mode 100644 index 00000000..46414dd8 --- /dev/null +++ b/ui100/src/EnvironmentNode.tsx @@ -0,0 +1,22 @@ +import {Handle, Position} from "@xyflow/react"; +import {Grid2} from "@mui/material"; +import EnvironmentIcon from "@mui/icons-material/Computer"; + +const EnvironmentNode = ({ data }) => { + let shareHandle = ; + if(data.empty) { + shareHandle = <>; + } + return ( + <> + + {shareHandle} + + + {data.label} + + + ); +} + +export default EnvironmentNode; \ No newline at end of file diff --git a/ui100/src/ShareNode.tsx b/ui100/src/ShareNode.tsx new file mode 100644 index 00000000..d9ffe652 --- /dev/null +++ b/ui100/src/ShareNode.tsx @@ -0,0 +1,17 @@ +import {Handle, Position} from "@xyflow/react"; +import {Grid2} from "@mui/material"; +import ShareIcon from "@mui/icons-material/Share"; + +const ShareNode = ({ data }) => { + return ( + <> + + + + {data.label} + + + ); +} + +export default ShareNode; \ No newline at end of file diff --git a/ui100/src/Visualizer.tsx b/ui100/src/Visualizer.tsx index e1a8038e..ead70835 100644 --- a/ui100/src/Visualizer.tsx +++ b/ui100/src/Visualizer.tsx @@ -4,11 +4,16 @@ import {Background, Controls, ReactFlow, ReactFlowProvider, useEdgesState, useNo 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"; interface VisualizerProps { overview: VisualOverview; } +const nodeTypes = { account: AccountNode, environment: EnvironmentNode, share: ShareNode }; + const Visualizer = ({ overview }: VisualizerProps) => { const [nodes, setNodes, onNodesChange] = useNodesState([]); const [edges, setEdges, onEdgesChange] = useEdgesState([]); @@ -43,6 +48,7 @@ const Visualizer = ({ overview }: VisualizerProps) => { return ( { let out = new VisualOverview(); out.nodes = [ - { id: "0", position: { x: 0, y: 0 }, data: { label: "michael@quigley.com" }, type: "input" } + { id: "0", position: { x: 0, y: 0 }, data: { label: "michael@quigley.com" }, type: "account" } ]; out.edges = []; @@ -19,8 +18,8 @@ const buildVisualizerGraph = (overview: Overview): VisualOverview => { let envNode = { id: env.environment.zId, position: { x: 0, y: 0 }, - data: { label: env.environment?.description! }, - type: "output", + data: { label: env.environment?.description!, empty: true }, + type: "environment", } out.nodes.push(envNode); out.edges.push({ @@ -29,13 +28,13 @@ const buildVisualizerGraph = (overview: Overview): VisualOverview => { target: env.environment.zId }); if(env.shares) { - envNode.type = "default"; + envNode.data.empty = false; env.shares.forEach(shr => { out.nodes.push({ id: shr.token!, position: { x: 0, y: 0 }, data: { label: shr.token! }, - type: "output", + type: "share", }); out.edges.push({ id: env.environment?.zId + "-" + shr.token!,