diff --git a/agent/agentUi/src/AccessCard.jsx b/agent/agentUi/src/AccessCard.jsx
new file mode 100644
index 00000000..150f5c0b
--- /dev/null
+++ b/agent/agentUi/src/AccessCard.jsx
@@ -0,0 +1,14 @@
+import LanIcon from "@mui/icons-material/Lan";
+
+const AccessCard = (props) => {
+ return (
+
+
{props.access.frontendToken} []
+
+ {props.access.token} → {props.access.bindAddress}
+
+
+ );
+}
+
+export default AccessCard;
\ No newline at end of file
diff --git a/agent/agentUi/src/AgentUi.jsx b/agent/agentUi/src/AgentUi.jsx
index 9eae241f..a19c5d4b 100644
--- a/agent/agentUi/src/AgentUi.jsx
+++ b/agent/agentUi/src/AgentUi.jsx
@@ -3,13 +3,34 @@ import Overview from "./Overview.jsx";
import ShareDetail from "./ShareDetail.jsx";
import {useEffect, useState} from "react";
import {AgentApi, ApiClient} from "./api/src/index.js";
+import buildOverview from "./model/overview.js";
+import NavBar from "./NavBar.jsx";
+import {Box, Modal} from "@mui/material";
-const AgentUi = (props) => {
+const AgentUi = () => {
const [version, setVersion] = useState("");
const [shares, setShares] = useState([]);
const [accesses, setAccesses] = useState([]);
+ const [overview, setOverview] = useState(new Map());
+ const [newShare, setNewShare] = useState(false);
let api = new AgentApi(new ApiClient(window.location.protocol+'//'+window.location.host));
+ const openNewShare = () => {
+ setNewShare(true);
+ }
+ const closeNewShare = () => {
+ setNewShare(false);
+ }
+ const shareStyle = {
+ position: 'absolute',
+ top: '25%',
+ left: '50%',
+ transform: 'translate(-50%, -50%)',
+ width: 600,
+ bgcolor: 'background.paper',
+ boxShadow: 24,
+ p: 4,
+ };
useEffect(() => {
let mounted = true;
@@ -27,6 +48,7 @@ const AgentUi = (props) => {
if(mounted) {
setShares(data.shares);
setAccesses(data.accesses);
+ setOverview(buildOverview(data));
}
});
}, 1000);
@@ -39,7 +61,7 @@ const AgentUi = (props) => {
const router = createBrowserRouter([
{
path: "/",
- element:
+ element:
},
{
path: "/share/:token",
@@ -47,7 +69,20 @@ const AgentUi = (props) => {
}
]);
- return
+ return (
+ <>
+
+
+
+
+ New Share
+
+
+ >
+ );
}
export default AgentUi;
\ No newline at end of file
diff --git a/agent/agentUi/src/NavBar.jsx b/agent/agentUi/src/NavBar.jsx
index f7d48fab..567c9433 100644
--- a/agent/agentUi/src/NavBar.jsx
+++ b/agent/agentUi/src/NavBar.jsx
@@ -1,7 +1,5 @@
import {AppBar, Button, IconButton, Toolbar, Typography} from "@mui/material";
import MenuIcon from "@mui/icons-material/Menu";
-import {Link} from "react-router-dom";
-import ListIcon from "@mui/icons-material/List";
import LanIcon from "@mui/icons-material/Lan";
import ShareIcon from "@mui/icons-material/Share";
@@ -21,8 +19,7 @@ const NavBar = (props) => {
zrok Agent { props.version !== "" ? " | " + props.version : ""}
-
-
+
diff --git a/agent/agentUi/src/Overview.jsx b/agent/agentUi/src/Overview.jsx
index 8ffe0c8a..e2352948 100644
--- a/agent/agentUi/src/Overview.jsx
+++ b/agent/agentUi/src/Overview.jsx
@@ -1,68 +1,25 @@
import "bootstrap/dist/css/bootstrap.min.css";
-import DataTable from "react-data-table-component";
-import NavBar from "./NavBar.jsx";
+import ShareCard from "./ShareCard.jsx";
+import AccessCard from "./AccessCard.jsx";
const Overview = (props) => {
- const shareColumns = [
- {
- name: 'Token',
- selector: row => {row.token}
- },
- {
- name: 'Share Mode',
- selector: row => row.shareMode
- },
- {
- name: 'Backend Mode',
- selector: row => row.backendMode
- },
- {
- name: 'Target',
- selector: row => row.backendEndpoint,
- },
- {
- name: 'Frontend Endpoints',
- selector: row => {row.shareMode === "public" ? row.frontendEndpoint.map((fe) =>
{fe}) : "---"}
,
- grow: 2
- }
- ];
+ let cards = [];
+ props.overview.forEach((row) => {
+ switch(row.type) {
+ case "share":
+ cards.push();
+ break;
- const accessColumns = [
- {
- name: 'Frontend Token',
- selector: row => row.frontendToken
- },
- {
- name: 'Token',
- selector: row => row.token
- },
- {
- name: 'Bind Address',
- selector: row => row.bindAddress
- },
- ];
+ case "access":
+ cards.push();
+ break;
+ }
+
+ });
return (
<>
-
-
-
-
Shares
- }
- />
-
-
-
-
Accesses
- }
- />
-
+ {cards}
>
)
}
diff --git a/agent/agentUi/src/ShareCard.jsx b/agent/agentUi/src/ShareCard.jsx
new file mode 100644
index 00000000..26f322da
--- /dev/null
+++ b/agent/agentUi/src/ShareCard.jsx
@@ -0,0 +1,20 @@
+import ShareIcon from "@mui/icons-material/Share";
+
+const ShareCard = (props) => {
+ let frontends = [];
+ props.share.frontendEndpoint.map((fe) => {
+ frontends.push({fe});
+ })
+
+ return (
+
+
{props.share.token} []
+
({props.share.shareMode}, {props.share.backendMode})
+
+ {props.share.backendEndpoint} → {frontends}
+
+
+ );
+}
+
+export default ShareCard;
\ No newline at end of file
diff --git a/agent/agentUi/src/ShareDetail.jsx b/agent/agentUi/src/ShareDetail.jsx
index 6b5d4910..dd0ac786 100644
--- a/agent/agentUi/src/ShareDetail.jsx
+++ b/agent/agentUi/src/ShareDetail.jsx
@@ -1,4 +1,3 @@
-import NavBar from "./NavBar.jsx";
import {useParams} from "react-router-dom";
const ShareDetail = (props) => {
@@ -6,8 +5,6 @@ const ShareDetail = (props) => {
return (
<>
-
-
Share {params.token}
>
)
diff --git a/agent/agentUi/src/index.css b/agent/agentUi/src/index.css
index decfbae1..60f65e87 100644
--- a/agent/agentUi/src/index.css
+++ b/agent/agentUi/src/index.css
@@ -53,4 +53,10 @@ button:focus-visible {
.info {
margin-top: 5em;
+}
+
+.card {
+ margin-top: 2em;
+ padding: 1em;
+ border: 0;
}
\ No newline at end of file
diff --git a/agent/agentUi/src/model/overview.js b/agent/agentUi/src/model/overview.js
new file mode 100644
index 00000000..9a396ec7
--- /dev/null
+++ b/agent/agentUi/src/model/overview.js
@@ -0,0 +1,18 @@
+const buildOverview = (status) => {
+ let overview = new Map();
+ status.accesses.map(acc => {
+ overview.set(acc.frontendToken, {
+ type: "access",
+ v: acc
+ });
+ });
+ status.shares.map(shr => {
+ overview.set(shr.token, {
+ type: "share",
+ v: shr
+ })
+ });
+ return overview;
+}
+
+export default buildOverview;
\ No newline at end of file