"use client"
import { useState } from "react"
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
import { Button } from "@/components/ui/button"
import { Badge } from "@/components/ui/badge"
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"
import { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label"
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"
import { Switch } from "@/components/ui/switch"
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog"
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"
import {
Bell, Plus, Settings, CheckCircle2, AlertTriangle,
XCircle, Clock, Eye, Trash2, BellOff
} from "lucide-react"
const alerts = [
{
id: "1",
title: "磁盘使用率超过70%",
description: "服务器磁盘使用率达到72%,建议清理或扩容",
severity: "warning",
source: "系统监控",
time: "2024-01-15 14:30:00",
status: "active",
},
{
id: "2",
title: "AI推理服务延迟升高",
description: "AI推理服务平均延迟达到230ms,超过预设阈值200ms",
severity: "warning",
source: "AI Agent",
time: "2024-01-15 13:45:00",
status: "active",
},
{
id: "3",
title: "数据同步任务失败",
description: "用户行为数据同步任务执行失败,已自动重试",
severity: "error",
source: "数据接入",
time: "2024-01-15 10:20:00",
status: "resolved",
},
]
const alertRules = [
{ id: "1", name: "CPU使用率告警", condition: "CPU > 80%", severity: "critical", enabled: true },
{ id: "2", name: "内存使用率告警", condition: "内存 > 85%", severity: "critical", enabled: true },
{ id: "3", name: "磁盘使用率告警", condition: "磁盘 > 70%", severity: "warning", enabled: true },
{ id: "4", name: "API延迟告警", condition: "延迟 > 500ms", severity: "warning", enabled: true },
{ id: "5", name: "任务失败告警", condition: "失败次数 > 3", severity: "error", enabled: false },
]
export default function AlertsPage() {
const [activeTab, setActiveTab] = useState("active")
const [showCreateDialog, setShowCreateDialog] = useState(false)
const getSeverityBadge = (severity: string) => {
switch (severity) {
case "critical":
return
查看和管理系统告警
活跃告警
2
今日告警
5
已解决
3
告警规则
5
{alert.description}