diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index f3abb9f..fb96599 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -17,19 +17,14 @@ import { TopologyView } from '@/components/k8s/TopologyView'; import { AlertManager } from '@/components/monitor/AlertManager'; import { AppReleaseManager } from '@/components/deploy/AppRelease'; import { ApprovalFlowManager } from '@/components/approval/ApprovalFlow'; -import { NavigationPage } from '@/components/navigation/NavigationPage'; import { ScriptManager } from '@/components/automation/ScriptManager'; import { SystemManager } from '@/components/system/SystemManager'; import { PipelineManager } from '@/components/deploy/PipelineManager'; import { ReleaseManager } from '@/components/deploy/ReleaseManager'; import { CronJobManager } from '@/components/automation/CronJobManager'; import AnsibleManager from '@/components/automation/AnsibleManager'; -import SQLAuditManager from '@/components/audit/SQLAuditManager'; import { AIOpsAssistant } from '@/components/aiops/AIOpsAssistant'; -import { AIOpsHub } from '@/components/aiops/AIOpsHub'; import { AIAlertAnalyzer } from '@/components/aiops/AIAlertAnalyzer'; -import { AIScriptGenerator } from '@/components/aiops/AIScriptGenerator'; -import { AIFaultDiagnosis } from '@/components/aiops/AIFaultDiagnosis'; import { AIPredictiveAnalytics } from '@/components/aiops/AIPredictiveAnalytics'; import AlertCenter from '@/components/monitor/alert-center/AlertCenter'; import TraceManager from '@/components/monitor/trace/TraceManager'; @@ -80,18 +75,13 @@ function App() { } /> } /> } /> - } /> {/* 自动化运维 */} } /> } /> } /> - } /> {/* AIOps智能 */} - } /> } /> } /> - } /> - } /> } /> } /> } /> diff --git a/frontend/src/components/layout/Sidebar.tsx b/frontend/src/components/layout/Sidebar.tsx index b77dcdc..0d9d94b 100644 --- a/frontend/src/components/layout/Sidebar.tsx +++ b/frontend/src/components/layout/Sidebar.tsx @@ -26,7 +26,6 @@ import { Globe, MapPin, Key, - Compass, Brain, FileTerminal, Activity, @@ -96,7 +95,6 @@ const menuItems: MenuItem[] = [ ], }, { id: 'approval', name: '资源申请', icon: CheckSquare, path: '/approval' }, - { id: 'navigation', name: '站内导航', icon: Compass, path: '/navigation' }, { id: 'automation', name: '自动化运维', @@ -105,7 +103,6 @@ const menuItems: MenuItem[] = [ { id: 'cronjobs', name: '定时任务', icon: PlayCircle, path: '/cronjobs' }, { id: 'scripts', name: '脚本库', icon: FileCode, path: '/scripts' }, { id: 'ansible', name: 'Ansible', icon: FileTerminal, path: '/ansible' }, - { id: 'sql-audit', name: 'SQL审计', icon: Shield, path: '/sql-audit' }, ], }, { @@ -113,12 +110,9 @@ const menuItems: MenuItem[] = [ name: 'AIOps智能', icon: Brain, children: [ - { id: 'ai-hub', name: '智能运维中心', icon: Brain, path: '/ai-hub' }, - { id: 'ai-assistant', name: 'AI智能助手', icon: Bot, path: '/ai-assistant' }, - { id: 'ai-alert-analyzer', name: '告警智能分析', icon: AlertTriangle, path: '/ai-alert-analyzer' }, - { id: 'ai-script-generator', name: 'AI脚本生成', icon: FileCode, path: '/ai-script-generator' }, - { id: 'ai-fault-diagnosis', name: '故障智能诊断', icon: Activity, path: '/ai-fault-diagnosis' }, - { id: 'ai-predictive', name: 'AI预测分析', icon: BarChart3, path: '/ai-predictive' }, + { id: 'ai-assistant', name: '智能助手', icon: Bot, path: '/ai-assistant' }, + { id: 'ai-alert-analyzer', name: '告警分析', icon: AlertTriangle, path: '/ai-alert-analyzer' }, + { id: 'ai-predictive', name: '容量预测', icon: BarChart3, path: '/ai-predictive' }, ], }, { diff --git a/frontend/src/components/server/ServerManager.tsx b/frontend/src/components/server/ServerManager.tsx index 73274cf..411b2cc 100644 --- a/frontend/src/components/server/ServerManager.tsx +++ b/frontend/src/components/server/ServerManager.tsx @@ -46,6 +46,8 @@ import { RefreshCw, } from 'lucide-react'; import { serverApi } from '@/services/api'; +import { useConfirm } from '@/components/ui/confirm-dialog'; +import { toast } from 'sonner'; import type { Server as ServerType } from '@/types'; import { CloudServerImport } from './CloudServerImport'; import { TerminalDialog } from './TerminalDialog'; @@ -53,6 +55,7 @@ import { ExcelServerImport } from './ExcelServerImport'; import { ServerForm, EMPTY_FORM, type ServerFormData } from './ServerForm'; export function ServerManager() { + const confirm = useConfirm(); const [servers, setServers] = useState([]); const [loading, setLoading] = useState(true); const [selectedServers, setSelectedServers] = useState([]); @@ -136,23 +139,42 @@ export function ServerManager() { }; const handleDelete = async (id: string) => { + const server = servers.find((s) => String(s.id) === String(id)); + const ok = await confirm({ + title: '删除服务器', + description: `确定删除「${server?.hostname || id}」吗?此操作不可撤销。`, + confirmText: '删除', + variant: 'destructive', + }); + if (!ok) return; try { await serverApi.deleteServer(id); + toast.success('服务器已删除'); loadData(); } catch (e) { console.error('删除服务器失败:', e); + toast.error('删除失败'); } }; // 批量删除 const handleBatchDelete = async () => { if (selectedServers.length === 0) return; + const ok = await confirm({ + title: '批量删除服务器', + description: `确定删除选中的 ${selectedServers.length} 台服务器吗?此操作不可撤销。`, + confirmText: '批量删除', + variant: 'destructive', + }); + if (!ok) return; try { await serverApi.batchDelete(selectedServers.map((id) => Number(id))); + toast.success(`已删除 ${selectedServers.length} 台服务器`); setSelectedServers([]); loadData(); } catch (e) { console.error('批量删除失败:', e); + toast.error('批量删除失败'); } };