mirror of
https://github.com/fankes/beszel.git
synced 2025-10-20 02:09:28 +08:00
small updates to alert display
This commit is contained in:
@@ -72,7 +72,7 @@ export default function () {
|
|||||||
className="hover:-translate-y-[1px] duration-200 bg-transparent border-foreground/10 hover:shadow-md shadow-black"
|
className="hover:-translate-y-[1px] duration-200 bg-transparent border-foreground/10 hover:shadow-md shadow-black"
|
||||||
>
|
>
|
||||||
<info.icon className="h-4 w-4" />
|
<info.icon className="h-4 w-4" />
|
||||||
<AlertTitle className="mb-2">
|
<AlertTitle>
|
||||||
{alert.sysname} {info.name}
|
{alert.sysname} {info.name}
|
||||||
</AlertTitle>
|
</AlertTitle>
|
||||||
<AlertDescription>
|
<AlertDescription>
|
||||||
|
@@ -104,7 +104,7 @@ function AlertStatus({ system, alerts }: { system: SystemRecord; alerts: AlertRe
|
|||||||
>
|
>
|
||||||
<div className="grid gap-1 select-none">
|
<div className="grid gap-1 select-none">
|
||||||
<p className="font-semibold flex gap-3 items-center">
|
<p className="font-semibold flex gap-3 items-center">
|
||||||
<ServerIcon className="h-4 w-4 opacity-85" /> System status
|
<ServerIcon className="h-4 w-4 opacity-85" /> System Status
|
||||||
</p>
|
</p>
|
||||||
<span className="block text-sm text-muted-foreground">
|
<span className="block text-sm text-muted-foreground">
|
||||||
Triggers when status switches between up and down.
|
Triggers when status switches between up and down.
|
||||||
@@ -189,7 +189,7 @@ function AlertWithSlider({
|
|||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
<div className="grid gap-1 select-none">
|
<div className="grid gap-1 select-none">
|
||||||
<p className="font-semibold flex gap-3 items-center">
|
<p className="font-semibold flex gap-3 items-center capitalize">
|
||||||
<Icon className="h-4 w-4 opacity-85" /> {title}
|
<Icon className="h-4 w-4 opacity-85" /> {title}
|
||||||
</p>
|
</p>
|
||||||
{!alert && <span className="block text-sm text-muted-foreground">{description}</span>}
|
{!alert && <span className="block text-sm text-muted-foreground">{description}</span>}
|
||||||
|
@@ -1,59 +1,59 @@
|
|||||||
import * as React from "react"
|
import * as React from 'react'
|
||||||
import { cva, type VariantProps } from "class-variance-authority"
|
// import { cva, type VariantProps } from 'class-variance-authority'
|
||||||
|
|
||||||
import { cn } from "@/lib/utils"
|
import { cn } from '@/lib/utils'
|
||||||
|
|
||||||
const alertVariants = cva(
|
// 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",
|
// "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: {
|
// variants: {
|
||||||
variant: {
|
// variant: {
|
||||||
default: "bg-background text-foreground",
|
// default: "bg-background text-foreground",
|
||||||
destructive:
|
// destructive:
|
||||||
"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",
|
// "border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
defaultVariants: {
|
// defaultVariants: {
|
||||||
variant: "default",
|
// variant: "default",
|
||||||
},
|
// },
|
||||||
}
|
// }
|
||||||
)
|
// )
|
||||||
|
|
||||||
const Alert = React.forwardRef<
|
const Alert = React.forwardRef<
|
||||||
HTMLDivElement,
|
HTMLDivElement,
|
||||||
React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof alertVariants>
|
// React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof alertVariants>
|
||||||
>(({ className, variant, ...props }, ref) => (
|
// >(({ className, variant, ...props }, ref) => (
|
||||||
|
React.HTMLAttributes<HTMLDivElement>
|
||||||
|
>(({ className, ...props }, ref) => (
|
||||||
<div
|
<div
|
||||||
ref={ref}
|
ref={ref}
|
||||||
role="alert"
|
role="alert"
|
||||||
className={cn(alertVariants({ variant }), className)}
|
className={cn(
|
||||||
|
'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 bg-background text-foreground',
|
||||||
|
className
|
||||||
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
))
|
))
|
||||||
Alert.displayName = "Alert"
|
Alert.displayName = 'Alert'
|
||||||
|
|
||||||
const AlertTitle = React.forwardRef<
|
const AlertTitle = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLHeadingElement>>(
|
||||||
HTMLParagraphElement,
|
({ className, ...props }, ref) => (
|
||||||
React.HTMLAttributes<HTMLHeadingElement>
|
|
||||||
>(({ className, ...props }, ref) => (
|
|
||||||
<h5
|
<h5
|
||||||
ref={ref}
|
ref={ref}
|
||||||
className={cn("mb-1 font-medium leading-none tracking-tight", className)}
|
className={cn('mb-1 font-medium leading-none tracking-tight', className)}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
))
|
)
|
||||||
AlertTitle.displayName = "AlertTitle"
|
)
|
||||||
|
AlertTitle.displayName = 'AlertTitle'
|
||||||
|
|
||||||
const AlertDescription = React.forwardRef<
|
const AlertDescription = React.forwardRef<
|
||||||
HTMLParagraphElement,
|
HTMLParagraphElement,
|
||||||
React.HTMLAttributes<HTMLParagraphElement>
|
React.HTMLAttributes<HTMLParagraphElement>
|
||||||
>(({ className, ...props }, ref) => (
|
>(({ className, ...props }, ref) => (
|
||||||
<div
|
<div ref={ref} className={cn('text-sm [&_p]:leading-relaxed', className)} {...props} />
|
||||||
ref={ref}
|
|
||||||
className={cn("text-sm [&_p]:leading-relaxed", className)}
|
|
||||||
{...props}
|
|
||||||
/>
|
|
||||||
))
|
))
|
||||||
AlertDescription.displayName = "AlertDescription"
|
AlertDescription.displayName = 'AlertDescription'
|
||||||
|
|
||||||
export { Alert, AlertTitle, AlertDescription }
|
export { Alert, AlertTitle, AlertDescription }
|
||||||
|
@@ -306,25 +306,25 @@ export const alertInfo = {
|
|||||||
desc: 'Triggers when CPU usage exceeds a threshold.',
|
desc: 'Triggers when CPU usage exceeds a threshold.',
|
||||||
},
|
},
|
||||||
Memory: {
|
Memory: {
|
||||||
name: 'Memory usage',
|
name: 'memory usage',
|
||||||
unit: '%',
|
unit: '%',
|
||||||
icon: MemoryStickIcon,
|
icon: MemoryStickIcon,
|
||||||
desc: 'Triggers when memory usage exceeds a threshold.',
|
desc: 'Triggers when memory usage exceeds a threshold.',
|
||||||
},
|
},
|
||||||
Disk: {
|
Disk: {
|
||||||
name: 'Disk usage',
|
name: 'disk usage',
|
||||||
unit: '%',
|
unit: '%',
|
||||||
icon: HardDriveIcon,
|
icon: HardDriveIcon,
|
||||||
desc: 'Triggers when usage of any disk exceeds a threshold.',
|
desc: 'Triggers when usage of any disk exceeds a threshold.',
|
||||||
},
|
},
|
||||||
Bandwidth: {
|
Bandwidth: {
|
||||||
name: 'Bandwidth',
|
name: 'bandwidth',
|
||||||
unit: ' MB/s',
|
unit: ' MB/s',
|
||||||
icon: EthernetIcon,
|
icon: EthernetIcon,
|
||||||
desc: 'Triggers when combined up/down exceeds a threshold.',
|
desc: 'Triggers when combined up/down exceeds a threshold.',
|
||||||
},
|
},
|
||||||
Temperature: {
|
Temperature: {
|
||||||
name: 'Temperature',
|
name: 'temperature',
|
||||||
unit: '°C',
|
unit: '°C',
|
||||||
icon: ThermometerIcon,
|
icon: ThermometerIcon,
|
||||||
desc: 'Triggers when any sensor exceeds a threshold.',
|
desc: 'Triggers when any sensor exceeds a threshold.',
|
||||||
|
Reference in New Issue
Block a user