From 3c4ae46f5067f14e1fa0891a21c8335a43e18aeb Mon Sep 17 00:00:00 2001 From: henrygd Date: Fri, 22 Aug 2025 20:27:12 -0400 Subject: [PATCH] remove usememo return in add system dialog - forgot to remove this before last commit. interferes with token display. --- beszel/site/src/components/add-system.tsx | 289 +++++++++++----------- 1 file changed, 142 insertions(+), 147 deletions(-) diff --git a/beszel/site/src/components/add-system.tsx b/beszel/site/src/components/add-system.tsx index a5efc68..c90ea62 100644 --- a/beszel/site/src/components/add-system.tsx +++ b/beszel/site/src/components/add-system.tsx @@ -17,7 +17,7 @@ import { $publicKey, pb } from "@/lib/stores" import { cn, generateToken, isReadOnlyUser, tokenMap, useLocalStorage } from "@/lib/utils" import { useStore } from "@nanostores/react" import { ChevronDownIcon, ExternalLinkIcon, PlusIcon } from "lucide-react" -import { memo, useEffect, useMemo, useRef, useState } from "react" +import { memo, useEffect, useRef, useState } from "react" import { $router, basePath, Link, navigate } from "./router" import { SystemRecord } from "@/types" import { AppleIcon, DockerIcon, TuxIcon, WindowsIcon } from "./ui/icons" @@ -122,154 +122,149 @@ export const SystemDialog = ({ setOpen, system }: { setOpen: (open: boolean) => } } - return useMemo( - () => ( - { - setHostValue(system?.host ?? "") - }} - > - - - - {system ? `${t`Edit`} ${system?.name}` : Add New System} - - - Docker - - Binary - - - - {/* Docker (set tab index to prevent auto focusing content in edit system dialog) */} - - - - Copy the - docker-compose.yml content for the agent - below, or register agents automatically with a{" "} - setOpen(false)} - href={getPagePath($router, "settings", { name: "tokens" })} - className="link" - > - universal token - - . - - - - {/* Binary */} - - - - Copy the installation command for the agent below, or register agents automatically with a{" "} - setOpen(false)} - href={getPagePath($router, "settings", { name: "tokens" })} - className="link" - > - universal token - - . - - - -
-
- - - - { - setHostValue(e.target.value) - }} + return ( + { + setHostValue(system?.host ?? "") + }} + > + + + + {system ? `${t`Edit`} ${system?.name}` : Add New System} + + + Docker + + Binary + + + + {/* Docker (set tab index to prevent auto focusing content in edit system dialog) */} + + + + Copy the + docker-compose.yml content for the agent + below, or register agents automatically with a{" "} + setOpen(false)} + href={getPagePath($router, "settings", { name: "tokens" })} + className="link" + > + universal token + + . + + + + {/* Binary */} + + + + Copy the installation command for the agent below, or register agents automatically with a{" "} + setOpen(false)} + href={getPagePath($router, "settings", { name: "tokens" })} + className="link" + > + universal token + + . + + + + +
+ + + + { + setHostValue(e.target.value) + }} + /> + + + + + + +
+ + {/* Docker */} + + + copyDockerCompose(isUnixSocket ? hostValue : port.current?.value, publicKey, token) + } + icon={} + dropdownItems={[ + { + text: t({ message: "Copy docker run", context: "Button to copy docker run command" }), + onClick: async () => + copyDockerRun(isUnixSocket ? hostValue : port.current?.value, publicKey, token), + icons: [DockerIcon], + }, + ]} /> - - + {/* Binary */} + + } + onClick={async () => copyLinuxCommand(isUnixSocket ? hostValue : port.current?.value, publicKey, token)} + dropdownItems={[ + { + text: t({ message: "Homebrew command", context: "Button to copy install command" }), + onClick: async () => + copyLinuxCommand(isUnixSocket ? hostValue : port.current?.value, publicKey, token, true), + icons: [AppleIcon, TuxIcon], + }, + { + text: t({ message: "Windows command", context: "Button to copy install command" }), + onClick: async () => + copyWindowsCommand(isUnixSocket ? hostValue : port.current?.value, publicKey, token), + icons: [WindowsIcon], + }, + { + text: t`Manual setup instructions`, + url: "https://beszel.dev/guide/agent-installation#binary", + icons: [ExternalLinkIcon], + }, + ]} /> - - - - -
- - {/* Docker */} - - - copyDockerCompose(isUnixSocket ? hostValue : port.current?.value, publicKey, token) - } - icon={} - dropdownItems={[ - { - text: t({ message: "Copy docker run", context: "Button to copy docker run command" }), - onClick: async () => - copyDockerRun(isUnixSocket ? hostValue : port.current?.value, publicKey, token), - icons: [DockerIcon], - }, - ]} - /> - - {/* Binary */} - - } - onClick={async () => - copyLinuxCommand(isUnixSocket ? hostValue : port.current?.value, publicKey, token) - } - dropdownItems={[ - { - text: t({ message: "Homebrew command", context: "Button to copy install command" }), - onClick: async () => - copyLinuxCommand(isUnixSocket ? hostValue : port.current?.value, publicKey, token, true), - icons: [AppleIcon, TuxIcon], - }, - { - text: t({ message: "Windows command", context: "Button to copy install command" }), - onClick: async () => - copyWindowsCommand(isUnixSocket ? hostValue : port.current?.value, publicKey, token), - icons: [WindowsIcon], - }, - { - text: t`Manual setup instructions`, - url: "https://beszel.dev/guide/agent-installation#binary", - icons: [ExternalLinkIcon], - }, - ]} - /> - - {/* Save */} - - -
-
-
- ), - [] + + {/* Save */} + + + + + ) }