diff --git a/site/src/components/add-server.tsx b/site/src/components/add-server.tsx index fbede53..550defc 100644 --- a/site/src/components/add-server.tsx +++ b/site/src/components/add-server.tsx @@ -13,7 +13,7 @@ import { TooltipProvider, Tooltip, TooltipTrigger, TooltipContent } from '@/comp import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' import { $publicKey, pb } from '@/lib/stores' -import { ClipboardIcon, Plus } from 'lucide-react' +import { Copy, Plus } from 'lucide-react' import { useState, useRef, MutableRefObject, useEffect } from 'react' import { useStore } from '@nanostores/react' import { copyToClipboard } from '@/lib/utils' @@ -25,14 +25,16 @@ export function AddServerButton() { function copyDockerCompose(port: string) { copyToClipboard(`services: - agent: - image: 'henrygd/monitor-agent' - container_name: 'monitor-agent' - restart: unless-stopped - ports: - - '${port}:45876' - volumes: - - /var/run/docker.sock:/var/run/docker.sock`) + agent: + image: 'henrygd/monitor-agent' + container_name: 'monitor-agent' + restart: unless-stopped + ports: + - '${port}:45876' + volumes: + - /var/run/docker.sock:/var/run/docker.sock + environment: + - KEY="${publicKey}"`) } useEffect(() => { @@ -119,7 +121,7 @@ export function AddServerButton() {
@@ -131,7 +133,7 @@ export function AddServerButton() { className="absolute right-0" onClick={() => copyToClipboard(publicKey)} > - + diff --git a/site/src/components/command-dialog.tsx b/site/src/components/command-palette.tsx similarity index 87% rename from site/src/components/command-dialog.tsx rename to site/src/components/command-palette.tsx index 054c651..0513b2a 100644 --- a/site/src/components/command-dialog.tsx +++ b/site/src/components/command-palette.tsx @@ -38,7 +38,7 @@ export function CommandPalette() { No results found. - + { navigate('/') @@ -47,16 +47,16 @@ export function CommandPalette() { > Home - ⌘H + Page { - window.location.href = '/_/' + window.location.href = '/_/#/collections?collectionId=2hz5ncl8tizk5nx' }} > - PocketBase - ⌘P + Admin UI + PocketBase { @@ -65,7 +65,7 @@ export function CommandPalette() { > Documentation - ⌘D + GitHub diff --git a/site/src/components/server-table/data-table.tsx b/site/src/components/server-table/data-table.tsx index 38547a2..169bcd0 100644 --- a/site/src/components/server-table/data-table.tsx +++ b/site/src/components/server-table/data-table.tsx @@ -44,7 +44,16 @@ import { } from '@/components/ui/alert-dialog' import { SystemRecord } from '@/types' -import { MoreHorizontal, ArrowUpDown, Copy, RefreshCcw } from 'lucide-react' +import { + MoreHorizontal, + ArrowUpDown, + Copy, + RefreshCcw, + Server, + Cpu, + MemoryStick, + HardDrive, +} from 'lucide-react' import { useMemo, useState } from 'react' import { navigate } from 'wouter/use-browser-location' import { $servers, pb } from '@/lib/stores' @@ -74,13 +83,14 @@ function CellFormatter(info: CellContext) { ) } -function sortableHeader(column: Column, name: string) { +function sortableHeader(column: Column, name: string, Icon: any) { return ( @@ -89,7 +99,6 @@ function sortableHeader(column: Column, name: string) { export function DataTable() { const data = useStore($servers) - const [liveUpdates, setLiveUpdates] = useState(true) const [deleteServer, setDeleteServer] = useState({} as SystemRecord) const [sorting, setSorting] = useState([]) const [columnFilters, setColumnFilters] = useState([]) @@ -118,22 +127,22 @@ export function DataTable() { ), - header: ({ column }) => sortableHeader(column, 'Server'), + header: ({ column }) => sortableHeader(column, 'Server', Server), }, { accessorKey: 'stats.cpu', cell: CellFormatter, - header: ({ column }) => sortableHeader(column, 'CPU'), + header: ({ column }) => sortableHeader(column, 'CPU', Cpu), }, { accessorKey: 'stats.memPct', cell: CellFormatter, - header: ({ column }) => sortableHeader(column, 'Memory'), + header: ({ column }) => sortableHeader(column, 'Memory', MemoryStick), }, { accessorKey: 'stats.diskPct', cell: CellFormatter, - header: ({ column }) => sortableHeader(column, 'Disk'), + header: ({ column }) => sortableHeader(column, 'Disk', HardDrive), }, { id: 'actions', @@ -203,37 +212,10 @@ export function DataTable() { // @ts-ignore placeholder="Filter..." value={(table.getColumn('name')?.getFilterValue() as string) ?? ''} - onChange={(event: Event) => table.getColumn('name')?.setFilterValue(event.target.value)} + onChange={(event) => table.getColumn('name')?.setFilterValue(event.target.value)} className="max-w-sm" />
- {liveUpdates || ( - - )} - {/* */}
@@ -280,7 +262,7 @@ export function DataTable() { - + diff --git a/site/src/components/ui/alert-dialog.tsx b/site/src/components/ui/alert-dialog.tsx index 8722561..04c9bd1 100644 --- a/site/src/components/ui/alert-dialog.tsx +++ b/site/src/components/ui/alert-dialog.tsx @@ -1,8 +1,8 @@ -import * as React from "react" -import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog" +import * as React from 'react' +import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog' -import { cn } from "@/lib/utils" -import { buttonVariants } from "@/components/ui/button" +import { cn } from '@/lib/utils' +import { buttonVariants } from '@/components/ui/button' const AlertDialog = AlertDialogPrimitive.Root @@ -11,129 +11,105 @@ const AlertDialogTrigger = AlertDialogPrimitive.Trigger const AlertDialogPortal = AlertDialogPrimitive.Portal const AlertDialogOverlay = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef + React.ElementRef, + React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( - + )) AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName const AlertDialogContent = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef + React.ElementRef, + React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( - - - - + + + + )) AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName -const AlertDialogHeader = ({ - className, - ...props -}: React.HTMLAttributes) => ( -
+const AlertDialogHeader = ({ className, ...props }: React.HTMLAttributes) => ( +
) -AlertDialogHeader.displayName = "AlertDialogHeader" +AlertDialogHeader.displayName = 'AlertDialogHeader' -const AlertDialogFooter = ({ - className, - ...props -}: React.HTMLAttributes) => ( -
+const AlertDialogFooter = ({ className, ...props }: React.HTMLAttributes) => ( +
) -AlertDialogFooter.displayName = "AlertDialogFooter" +AlertDialogFooter.displayName = 'AlertDialogFooter' const AlertDialogTitle = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef + React.ElementRef, + React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( - + )) AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName const AlertDialogDescription = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef + React.ElementRef, + React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( - + )) -AlertDialogDescription.displayName = - AlertDialogPrimitive.Description.displayName +AlertDialogDescription.displayName = AlertDialogPrimitive.Description.displayName const AlertDialogAction = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef + React.ElementRef, + React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( - + )) AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName const AlertDialogCancel = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef + React.ElementRef, + React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( - + )) AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName export { - AlertDialog, - AlertDialogPortal, - AlertDialogOverlay, - AlertDialogTrigger, - AlertDialogContent, - AlertDialogHeader, - AlertDialogFooter, - AlertDialogTitle, - AlertDialogDescription, - AlertDialogAction, - AlertDialogCancel, + AlertDialog, + AlertDialogPortal, + AlertDialogOverlay, + AlertDialogTrigger, + AlertDialogContent, + AlertDialogHeader, + AlertDialogFooter, + AlertDialogTitle, + AlertDialogDescription, + AlertDialogAction, + AlertDialogCancel, } diff --git a/site/src/components/ui/command.tsx b/site/src/components/ui/command.tsx index d623ee0..97db253 100644 --- a/site/src/components/ui/command.tsx +++ b/site/src/components/ui/command.tsx @@ -1,153 +1,143 @@ -import * as React from "react" -import { type DialogProps } from "@radix-ui/react-dialog" -import { Command as CommandPrimitive } from "cmdk" -import { Search } from "lucide-react" +import * as React from 'react' +import { type DialogProps } from '@radix-ui/react-dialog' +import { Command as CommandPrimitive } from 'cmdk' +import { Search } from 'lucide-react' -import { cn } from "@/lib/utils" -import { Dialog, DialogContent } from "@/components/ui/dialog" +import { cn } from '@/lib/utils' +import { Dialog, DialogContent } from '@/components/ui/dialog' const Command = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef + React.ElementRef, + React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( - + )) Command.displayName = CommandPrimitive.displayName interface CommandDialogProps extends DialogProps {} const CommandDialog = ({ children, ...props }: CommandDialogProps) => { - return ( - - - - {children} - - - - ) + return ( + + + + {children} + + + + ) } const CommandInput = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef + React.ElementRef, + React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( -
- - -
+
+ + +
)) CommandInput.displayName = CommandPrimitive.Input.displayName const CommandList = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef + React.ElementRef, + React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( - + )) CommandList.displayName = CommandPrimitive.List.displayName const CommandEmpty = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef + React.ElementRef, + React.ComponentPropsWithoutRef >((props, ref) => ( - + )) CommandEmpty.displayName = CommandPrimitive.Empty.displayName const CommandGroup = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef + React.ElementRef, + React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( - + )) CommandGroup.displayName = CommandPrimitive.Group.displayName const CommandSeparator = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef + React.ElementRef, + React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( - + )) CommandSeparator.displayName = CommandPrimitive.Separator.displayName const CommandItem = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef + React.ElementRef, + React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( - + )) CommandItem.displayName = CommandPrimitive.Item.displayName -const CommandShortcut = ({ - className, - ...props -}: React.HTMLAttributes) => { - return ( - - ) +const CommandShortcut = ({ className, ...props }: React.HTMLAttributes) => { + return ( + + ) } -CommandShortcut.displayName = "CommandShortcut" +CommandShortcut.displayName = 'CommandShortcut' export { - Command, - CommandDialog, - CommandInput, - CommandList, - CommandEmpty, - CommandGroup, - CommandItem, - CommandShortcut, - CommandSeparator, + Command, + CommandDialog, + CommandInput, + CommandList, + CommandEmpty, + CommandGroup, + CommandItem, + CommandShortcut, + CommandSeparator, } diff --git a/site/src/index.css b/site/src/index.css index 228533d..7ce9a7a 100644 --- a/site/src/index.css +++ b/site/src/index.css @@ -17,8 +17,8 @@ --muted-foreground: 24 2.79% 35.1%; --accent: 20 23.08% 94%; --accent-foreground: 240 5.88% 10%; - --destructive: 30 67% 46%; - --destructive-foreground: 30 0% 98.04%; + --destructive: 0 66% 53%; + --destructive-foreground: 0 0% 98.04%; --border: 30 8.11% 85.49%; --input: 30 4.29% 72.55%; --ring: 30 3.97% 49.41%; diff --git a/site/src/main.tsx b/site/src/main.tsx index fbb8fad..9e217cd 100644 --- a/site/src/main.tsx +++ b/site/src/main.tsx @@ -8,7 +8,7 @@ import LoginPage from './components/login.tsx' import { $authenticated, $servers, pb } from './lib/stores.ts' import { ServerDetail } from './components/routes/server.tsx' import { ModeToggle } from './components/mode-toggle.tsx' -import { CommandPalette } from './components/command-dialog.tsx' +import { CommandPalette } from './components/command-palette.tsx' import { cn } from './lib/utils.ts' import { buttonVariants } from './components/ui/button.tsx' import { Github } from 'lucide-react'