refactor: 移除SQL审计+站内导航,AIOps子菜单6→3精简,服务器批量删除加确认框
- 移除SQL审计菜单和路由 - 移除站内导航菜单和路由 - AIOps智能子菜单从6个精简为3个:智能助手、告警分析、容量预测 - 移除智能运维中心(空壳)、故障诊断(与告警分析重复)、脚本生成(并入助手) - 服务器删除/批量删除添加Dialog确认框 - 删除/批量删除添加toast成功反馈
This commit is contained in:
1 parent
3be53b89fa
commit
d1415561ef
3 files changed
+25
-19
No files matched your search
@@ -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() {
|
||||
<Route path="alerts" element={<AlertManager />} />
|
||||
<Route path="logs" element={<AlertManager />} />
|
||||
<Route path="approval" element={<ApprovalFlowManager />} />
|
||||
<Route path="navigation" element={<NavigationPage />} />
|
||||
{/* 自动化运维 */}
|
||||
<Route path="cronjobs" element={<CronJobManager />} />
|
||||
<Route path="scripts" element={<ScriptManager />} />
|
||||
<Route path="ansible" element={<AnsibleManager />} />
|
||||
<Route path="sql-audit" element={<SQLAuditManager />} />
|
||||
{/* AIOps智能 */}
|
||||
<Route path="ai-hub" element={<AIOpsHub />} />
|
||||
<Route path="ai-assistant" element={<AIOpsAssistant />} />
|
||||
<Route path="ai-alert-analyzer" element={<AIAlertAnalyzer />} />
|
||||
<Route path="ai-script-generator" element={<AIScriptGenerator />} />
|
||||
<Route path="ai-fault-diagnosis" element={<AIFaultDiagnosis />} />
|
||||
<Route path="ai-predictive" element={<AIPredictiveAnalytics />} />
|
||||
<Route path="users" element={<SystemManager />} />
|
||||
<Route path="roles" element={<SystemManager />} />
|
||||
|
||||
@@ -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' },
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
@@ -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<any[]>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [selectedServers, setSelectedServers] = useState<string[]>([]);
|
||||
@@ -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('批量删除失败');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user