From ef11e520538c2bec7f7060007bb8c9681ad87447 Mon Sep 17 00:00:00 2001 From: yusing Date: Fri, 11 Oct 2024 10:39:43 +0800 Subject: [PATCH] 'Proxies' page UI update, updated code to match latest API sepc --- app/proxies/page.tsx | 53 ++++++++++++++++++++++++++++++------ components/app_groups.tsx | 2 +- components/health_bubble.tsx | 3 ++ components/navbar.tsx | 4 +-- types/proxy.ts | 19 ++++++++++--- 5 files changed, 65 insertions(+), 16 deletions(-) create mode 100644 components/health_bubble.tsx diff --git a/app/proxies/page.tsx b/app/proxies/page.tsx index c680428..a31b00c 100644 --- a/app/proxies/page.tsx +++ b/app/proxies/page.tsx @@ -1,6 +1,10 @@ "use client"; -import { faRefresh } from "@fortawesome/free-solid-svg-icons"; +import { + faRefresh, + faServer, + faStream, +} from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { Spinner } from "@nextui-org/spinner"; import { @@ -65,13 +69,17 @@ export default function ProxiesPage() { return ( {(col) => ( - + {col.label} )} @@ -83,8 +91,13 @@ export default function ProxiesPage() { loadingContent={} > {(item) => ( - - {(colKey) => {item[colKey]}} + + {(colKey) => ( + {item[colKey]} + )} )} @@ -93,9 +106,10 @@ export default function ProxiesPage() { } return ( -
+
{ @@ -105,16 +119,37 @@ export default function ProxiesPage() { } }} > - + + + Reverse Proxies + + } + > {table("reverse_proxies", ReverseProxyColumns, rps)} - + + + Streams + + } + > {table("streams", StreamColumns, streams)} + } /> diff --git a/components/app_groups.tsx b/components/app_groups.tsx index fc4fc81..c0dfa35 100644 --- a/components/app_groups.tsx +++ b/components/app_groups.tsx @@ -32,7 +32,7 @@ export default function AppGroups() { {category} - + ; +} diff --git a/components/navbar.tsx b/components/navbar.tsx index 4de2436..91d552c 100644 --- a/components/navbar.tsx +++ b/components/navbar.tsx @@ -64,9 +64,9 @@ export const Navbar = () => { -

+ Go Proxy -

+
{ + return ( + a.provider.localeCompare(b.provider) || + a.container.localeCompare(b.container) + ); + }); + return reverseProxies; } @@ -53,12 +60,16 @@ export async function getStreams(signal: AbortSignal) { for (const entry of Object.values(model)) { streams.push({ - container: entry.raw.proxy_properties.container_name, + container: entry.raw.container.container_name, alias: entry.alias, provider: entry.provider, target: `${entry.scheme.listening}://${entry.host}:${entry.port.listening} => ${entry.scheme.proxy}://${entry.host}:${entry.port.proxy}`, }); } + streams.sort((a, b) => { + return a.provider.localeCompare(b.provider); + }); + return streams; }