From 12239808fc17eece8dd8a0d20594d7586b21f1d9 Mon Sep 17 00:00:00 2001 From: Henry Dollman Date: Thu, 17 Oct 2024 15:46:09 -0400 Subject: [PATCH] small updates to alert display --- beszel/site/src/components/routes/home.tsx | 2 +- beszel/site/src/components/table-alerts.tsx | 4 +- beszel/site/src/components/ui/alert.tsx | 94 ++++++++++----------- beszel/site/src/lib/utils.ts | 8 +- 4 files changed, 54 insertions(+), 54 deletions(-) diff --git a/beszel/site/src/components/routes/home.tsx b/beszel/site/src/components/routes/home.tsx index 4e945df..0a0f646 100644 --- a/beszel/site/src/components/routes/home.tsx +++ b/beszel/site/src/components/routes/home.tsx @@ -72,7 +72,7 @@ export default function () { className="hover:-translate-y-[1px] duration-200 bg-transparent border-foreground/10 hover:shadow-md shadow-black" > - + {alert.sysname} {info.name} diff --git a/beszel/site/src/components/table-alerts.tsx b/beszel/site/src/components/table-alerts.tsx index 09bcef0..2a34278 100644 --- a/beszel/site/src/components/table-alerts.tsx +++ b/beszel/site/src/components/table-alerts.tsx @@ -104,7 +104,7 @@ function AlertStatus({ system, alerts }: { system: SystemRecord; alerts: AlertRe >

- System status + System Status

Triggers when status switches between up and down. @@ -189,7 +189,7 @@ function AlertWithSlider({ })} >
-

+

{title}

{!alert && {description}} diff --git a/beszel/site/src/components/ui/alert.tsx b/beszel/site/src/components/ui/alert.tsx index 41fa7e0..678aa08 100644 --- a/beszel/site/src/components/ui/alert.tsx +++ b/beszel/site/src/components/ui/alert.tsx @@ -1,59 +1,59 @@ -import * as React from "react" -import { cva, type VariantProps } from "class-variance-authority" +import * as React from 'react' +// import { cva, type VariantProps } from 'class-variance-authority' -import { cn } from "@/lib/utils" +import { cn } from '@/lib/utils' -const alertVariants = cva( - "relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground", - { - variants: { - variant: { - default: "bg-background text-foreground", - destructive: - "border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive", - }, - }, - defaultVariants: { - variant: "default", - }, - } -) +// const alertVariants = cva( +// "relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground", +// { +// variants: { +// variant: { +// default: "bg-background text-foreground", +// destructive: +// "border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive", +// }, +// }, +// defaultVariants: { +// variant: "default", +// }, +// } +// ) const Alert = React.forwardRef< - HTMLDivElement, - React.HTMLAttributes & VariantProps ->(({ className, variant, ...props }, ref) => ( -
-)) -Alert.displayName = "Alert" - -const AlertTitle = React.forwardRef< - HTMLParagraphElement, - React.HTMLAttributes + HTMLDivElement, + // React.HTMLAttributes & VariantProps + // >(({ className, variant, ...props }, ref) => ( + React.HTMLAttributes >(({ className, ...props }, ref) => ( -
+
svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground bg-background text-foreground', + className + )} + {...props} + /> )) -AlertTitle.displayName = "AlertTitle" +Alert.displayName = 'Alert' + +const AlertTitle = React.forwardRef>( + ({ className, ...props }, ref) => ( +
+ ) +) +AlertTitle.displayName = 'AlertTitle' const AlertDescription = React.forwardRef< - HTMLParagraphElement, - React.HTMLAttributes + HTMLParagraphElement, + React.HTMLAttributes >(({ className, ...props }, ref) => ( -
+
)) -AlertDescription.displayName = "AlertDescription" +AlertDescription.displayName = 'AlertDescription' export { Alert, AlertTitle, AlertDescription } diff --git a/beszel/site/src/lib/utils.ts b/beszel/site/src/lib/utils.ts index 3f00c44..8528585 100644 --- a/beszel/site/src/lib/utils.ts +++ b/beszel/site/src/lib/utils.ts @@ -306,25 +306,25 @@ export const alertInfo = { desc: 'Triggers when CPU usage exceeds a threshold.', }, Memory: { - name: 'Memory usage', + name: 'memory usage', unit: '%', icon: MemoryStickIcon, desc: 'Triggers when memory usage exceeds a threshold.', }, Disk: { - name: 'Disk usage', + name: 'disk usage', unit: '%', icon: HardDriveIcon, desc: 'Triggers when usage of any disk exceeds a threshold.', }, Bandwidth: { - name: 'Bandwidth', + name: 'bandwidth', unit: ' MB/s', icon: EthernetIcon, desc: 'Triggers when combined up/down exceeds a threshold.', }, Temperature: { - name: 'Temperature', + name: 'temperature', unit: '°C', icon: ThermometerIcon, desc: 'Triggers when any sensor exceeds a threshold.',