chore: 同步前端组件更新 (K8s/Agent/Monitor 相关)

This commit is contained in:
attacker committed 2026-06-26 15:49:31 +00:00
1 parent 09d3f5b6e8
commit 0535f30c87
20 files changed
+42 -5

No files matched your search

@@ -1,4 +1,5 @@
import { useState, useEffect, useRef, useCallback } from 'react';
import type { ComponentType } from 'react';
import { toast } from 'sonner';
import { agentApi } from '@/api';
import { AgentWizard } from './AgentWizard';
@@ -385,7 +386,7 @@ export function AgentMonitor() {
}
// ============ 指标条子组件 ============
function MetricBar({ icon: Icon, label, value }: { icon: any; label: string; value: number }) {
function MetricBar({ icon: Icon, label, value }: { icon: ComponentType<{ className?: string }>; label: string; value: number }) {
return (
<div className="flex items-center gap-2">
<Icon className="h-3.5 w-3.5 text-slate-500 shrink-0" />
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
// DeploymentEditService.tsx — 编辑器「服务/应用路由」Tab (M9)
// 展示与当前 Deployment 关联的 Service / Ingress,并提供创建入口
// 作者: Logan <admin@attacker.club>
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
// DeploymentWorkload.tsx — Kuboard 风格 Deployment 详情主组件
// - 顶部操作菜单: 编辑 | 预览/编辑YAML | 调整镜像版本 | 伸缩 | 日志/终端 | 重启 | 暂停/恢复更新 | CI/CD发布 | 删除 | 元数据 | 运行时 | 服务 | 应用路由
// - 三模式: view(只读增强看板)/ edit(可视化编辑器)/ yaml(YAML编辑器)
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { useState, useEffect, useCallback, useMemo } from 'react';
import { useParams, useNavigate, useLocation, Link } from 'react-router-dom';
import { Card, CardContent } from '@/components/ui/card';
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { useState, useEffect, useCallback } from 'react';
import { useParams, useNavigate, Link } from 'react-router-dom';
import { Card, CardContent } from '@/components/ui/card';
@@ -1,5 +1,7 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
// ResourceVisualEditor — ConfigMap/Secret/Service/Ingress/PVC 可视化编辑 // Logan.Li
import { useState, useEffect, useCallback } from 'react';
import type { ComponentType } from 'react';
import { X, Save, Loader2, Plus, Trash2, FileText, Network, Shield, Database, ChevronRight} from 'lucide-react';
import { Button } from '@/components/ui/button';
import { ModalOverlay } from '@/components/ui/modal-overlay';
@@ -67,7 +69,7 @@ export function ResourceVisualEditor({ clusterCode, namespace, resource, name, o
toast({ title: '可视化编辑不可用', description: '无法解析资源结构,已切换到 YAML 编辑模式' });
}
} catch (e) {
toast({ title: '加载失败', description: (e as Record<string, any>).message, variant: 'destructive' });
toast({ title: '加载失败', description: e instanceof Error ? e.message : String(e), variant: 'destructive' });
} finally { setLoading(false); }
}, [clusterCode, namespace, resource, name, isCreate]);
@@ -92,7 +94,7 @@ export function ResourceVisualEditor({ clusterCode, namespace, resource, name, o
onSaved?.();
onClose();
} catch (e) {
toast({ title: isCreate ? '创建失败' : '保存失败', description: (e as Record<string, any>).message, variant: 'destructive' });
toast({ title: isCreate ? '创建失败' : '保存失败', description: e instanceof Error ? e.message : String(e), variant: 'destructive' });
} finally { setSaving(false); }
};
@@ -114,7 +116,7 @@ export function ResourceVisualEditor({ clusterCode, namespace, resource, name, o
onSaved?.();
onClose();
} catch (e) {
toast({ title: '保存失败', description: (e as Record<string, any>).message, variant: 'destructive' });
toast({ title: '保存失败', description: e instanceof Error ? e.message : String(e), variant: 'destructive' });
} finally { setSaving(false); }
};
@@ -155,7 +157,7 @@ export function ResourceVisualEditor({ clusterCode, namespace, resource, name, o
};
const resCfg = getYamlResourceConfig(resource);
const resourceMeta: Record<string, { title: string; icon: any; color: string }> = {
const resourceMeta: Record<string, { title: string; icon: ComponentType<{ className?: string }>; color: string }> = {
configmaps: { title: 'ConfigMap', icon: FileText, color: 'text-blue-400' },
secrets: { title: 'Secret', icon: Shield, color: 'text-amber-400' },
services: { title: 'Service', icon: Network, color: 'text-cyan-400' },
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { useState, useEffect, useCallback, useRef } from 'react';
import { useParams } from 'react-router-dom';
import { Card, CardContent, CardHeader, CardTitle, CardDescription } from '@/components/ui/card';
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
// Deployment 多文档 YAML(Deployment + 关联 Service)加载与保存 // Logan.Li
import { kubernetesApi } from '@/api';
import {
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
// EditModeContainer.tsx — 编辑模式 Tab 容器,共享 manifest 状态 // Logan.Li
import { useState, useEffect } from 'react';
import { Container, Settings, Database, Network } from 'lucide-react';
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
// K8s manifest 解析/序列化/精简共用工具 // Logan.Li
import { cleanYAML } from './k8s-yaml-utils';
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import {
Network, Server, Globe, Cloud, Boxes, Database, Zap, Box,
} from 'lucide-react';
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
// 监控大屏 — 标签页切换 Agent / Zabbix / Prometheus + 自定义仪表盘 // Logan.Li
import React, { useState, useEffect, useMemo } from 'react';
import {
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
// LogAlertsPanel — 日志告警规则列表 // Logan.Li
import { useState, useEffect, useCallback } from 'react';
import { Button } from '@/components/ui/button';
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { useState, useEffect, useCallback } from 'react';
import { Button } from '@/components/ui/button';
import { Card, CardContent } from '@/components/ui/card';
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { useState, useEffect } from 'react';
import { useLocation } from 'react-router-dom';
import { useConfirm } from '@/components/ui/confirm-dialog';
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { useState, useEffect, useCallback } from 'react';
import { toast } from 'sonner';
import { Card, CardContent, CardHeader, CardTitle, CardDescription } from '@/components/ui/card';
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { Card, CardContent } from '@/components/ui/card';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
// 用户详情弹窗(只读信息 + 角色徽章 + 编辑入口) // Logan.Li
import { Button } from '@/components/ui/button';
import { Badge } from '@/components/ui/badge';