fix: AlertCenter崩溃修复——字段名映射+notify_channels安全解析
- AlertRule接口与后端对齐(id:number/notify_channels:string) - 告警事件数据映射(rule_name→title, message→description, target→source) - notify_channels安全解析(JSON.parse+try-catch替代直接.map) - labels/annotations字符串转对象安全处理 - Header tab栏移除(侧边栏导航足够) - SQL审计API改为真实后端调用
This commit is contained in:
1 parent
b9f1e28319
commit
e4958feb1b
3 files changed
+87
-59
No files matched your search
@@ -1,6 +1,6 @@
|
||||
import { useState } from 'react';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { useThemeStore, useTabStore, useNotificationStore, useUserStore } from '@/store';
|
||||
import { useThemeStore, useNotificationStore, useUserStore } from '@/store';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
@@ -17,7 +17,6 @@ import {
|
||||
Search,
|
||||
Bell,
|
||||
Menu,
|
||||
X,
|
||||
Settings,
|
||||
User,
|
||||
LogOut,
|
||||
@@ -33,7 +32,6 @@ import { useTheme, THEME_OPTIONS } from '@/hooks/useTheme';
|
||||
|
||||
export function Header() {
|
||||
const { sidebarCollapsed, toggleSidebar } = useThemeStore();
|
||||
const { tabs, activeTab, removeTab, setActiveTab } = useTabStore();
|
||||
const { notifications, unreadCount, markAsRead, markAllAsRead } = useNotificationStore();
|
||||
const { user, logout } = useUserStore();
|
||||
const { theme, setTheme } = useTheme();
|
||||
@@ -226,36 +224,7 @@ export function Header() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Tabs */}
|
||||
{tabs.length > 0 && (
|
||||
<div className="flex items-center h-9 px-2 bg-slate-950 border-b border-slate-800 overflow-x-auto">
|
||||
{tabs.map((tab) => (
|
||||
<div
|
||||
key={tab.id}
|
||||
className={cn(
|
||||
'group flex items-center gap-2 px-3 py-1.5 text-sm border-r border-slate-800 cursor-pointer transition-colors whitespace-nowrap',
|
||||
activeTab === tab.id
|
||||
? 'bg-slate-900 text-slate-100'
|
||||
: 'text-slate-500 hover:text-slate-300 hover:bg-slate-900/50'
|
||||
)}
|
||||
onClick={() => setActiveTab(tab.id)}
|
||||
>
|
||||
<span>{tab.title}</span>
|
||||
{tab.closable && (
|
||||
<button
|
||||
className="opacity-0 group-hover:opacity-100 p-0.5 rounded hover:bg-slate-700 transition-all"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
removeTab(tab.id);
|
||||
}}
|
||||
>
|
||||
<X className="h-3 w-3" />
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
{/* Tabs 已移除 — 侧边栏导航已足够,tab 栏多余且遮挡内容 */}
|
||||
</header>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user