fix: 清理 unused-vars 回归(32→0) + 修复 go:embed 编译阻塞
1. ESLint unused-vars 从 32 清零(回归修复) - 删除 14 个文件中未使用的 import(lucide 图标/shadcn 组件/JsonData 类型) - 移除未使用的变量/参数(categoryLabels/updateEntry/onSaved 等) - 涉及: AppRelease/PipelineEditor/KubernetesNodes/AlertCenter/SilenceRulesPanel 等 2. 修复 go:embed all:static 编译阻塞 - 新增 backend/static/.gitkeep 占位文件 - 全新 clone 后 go build ./... 可直接通过(不再依赖先 npm run build) 3. 安装缺失的 npm 依赖 - react-markdown/remark-gfm(AgentMarkdown 组件) - @codemirror/lang-python/@codemirror/legacy-modes(ScriptCodeEditor 组件) 验证: go build✅ | tsc -b✅ | npm build✅(21s) | ESLint any=41 unused=0 | 17/17 集成测试✅
This commit is contained in:
1 parent
471353e3d7
commit
cde7bbe540
23 files changed
+31
-35
No files matched your search
@@ -21,8 +21,6 @@ import {
|
||||
MemoryStick,
|
||||
Network,
|
||||
Activity,
|
||||
BarChart3,
|
||||
LineChart,
|
||||
Calendar,
|
||||
Sparkles,
|
||||
Zap,
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
@@ -24,14 +23,10 @@ import {
|
||||
Plus,
|
||||
Search,
|
||||
RotateCcw,
|
||||
CheckCircle,
|
||||
XCircle,
|
||||
GitBranch,
|
||||
GitCommit,
|
||||
Eye,
|
||||
Settings,
|
||||
History,
|
||||
Loader2,
|
||||
} from 'lucide-react';
|
||||
import { releaseApi } from '@/api';
|
||||
import { toast } from 'sonner';
|
||||
|
||||
@@ -35,7 +35,7 @@ import { Card, CardContent } from '@/components/ui/card';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
|
||||
import { Tabs, TabsContent } from '@/components/ui/tabs';
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
|
||||
import { Textarea } from '@/components/ui/textarea';
|
||||
import { Switch } from '@/components/ui/switch';
|
||||
|
||||
@@ -27,7 +27,6 @@ import {
|
||||
GitCommit,
|
||||
User,
|
||||
Eye,
|
||||
Loader2,
|
||||
Play,
|
||||
PackageOpen,
|
||||
} from 'lucide-react';
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { CheckCircle, XCircle, Loader2 } from 'lucide-react';
|
||||
import type { JsonData } from '@/types/common';
|
||||
|
||||
// 流水线阶段定义 // Logan.Li
|
||||
export interface PipelineStage {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// 发布相关共享工具函数与常量 // Logan.Li
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import type { JsonData } from '@/types/common';
|
||||
import {
|
||||
CheckCircle,
|
||||
XCircle,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
// 发布管理(审批流)共享工具函数与常量 // Logan.Li
|
||||
// 注意:本文件专用于 ReleaseManager(含审批流,状态标签与 AppRelease 的 releaseHelpers 不同)
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import type { JsonData } from '@/types/common';
|
||||
import {
|
||||
Clock,
|
||||
Check,
|
||||
|
||||
@@ -74,7 +74,7 @@ interface _SvcPortForm {
|
||||
|
||||
const toArray = ( v: any) => (Array.isArray(v) ? v : (v?.list || v?.items || v?.data || []));
|
||||
|
||||
export function DeploymentEditService({ clusterCode, namespace, deploymentName, manifest, onSaved, onCancel }: Props) {
|
||||
export function DeploymentEditService({ clusterCode, namespace, deploymentName, manifest, onCancel }: Props) {
|
||||
const { toast } = useToast();
|
||||
const confirm = useConfirm();
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
||||
@@ -96,9 +96,6 @@ export function DeploymentEditStorage({ clusterCode, namespace, deploymentName,
|
||||
|
||||
const defaultContainer = containers.find((c) => c !== '(unnamed)') || containers[0] || '';
|
||||
|
||||
const updateEntry = (i: number, patch: Partial<VolumeEntry>) =>
|
||||
setEntries((prev) => prev.map((e, idx) => (idx === i ? { ...e, ...patch } : e)));
|
||||
|
||||
const updateVolume = (i: number, patch: Partial<VolumeForm>) =>
|
||||
setEntries((prev) => prev.map((e, idx) => (idx === i ? { ...e, volume: { ...e.volume, ...patch } } : e)));
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ import {
|
||||
RotateCw,
|
||||
Trash2,
|
||||
RefreshCw,
|
||||
Loader2,
|
||||
XCircle,
|
||||
CheckCircle,
|
||||
AlertTriangle,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { useState, useEffect, useCallback } from 'react';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
|
||||
@@ -10,7 +10,6 @@ import {
|
||||
import {
|
||||
|
||||
RefreshCw,
|
||||
Loader2,
|
||||
Server,
|
||||
Activity,
|
||||
ArrowLeft,
|
||||
|
||||
@@ -32,7 +32,6 @@ import { NotifyPolicyTab } from './NotifyPolicyTab';
|
||||
|
||||
import type { UnifiedAlertRule } from '@/api';
|
||||
import type { Contact, ContactGroup } from './alert-center-helpers';
|
||||
import type { JsonData } from '@/types/common';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
const AlertCenter: React.FC = () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// 告警静默规则面板 — 嵌入通知策略 Tab // Logan.Li
|
||||
import { useState, useEffect, useCallback } from 'react';
|
||||
import { VolumeX, Plus, RefreshCw, Clock, Calendar, Repeat, Edit, Trash2 } from 'lucide-react';
|
||||
import { VolumeX, Plus, RefreshCw, Edit, Trash2 } from 'lucide-react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
|
||||
@@ -240,7 +240,7 @@ const AgentTab: React.FC = () => {
|
||||
|
||||
<AgentWizard open={wizardOpen} onOpenChange={setWizardOpen} server={wizardServer}
|
||||
onStart={(id) => { setOperating(prev => new Set(prev).add(id)); }}
|
||||
onInstalled={(id) => { toast.success('Agent 安装任务已提交,后台执行中…'); setWizardOpen(false); fetch(); }}
|
||||
onInstalled={() => { toast.success('Agent 安装任务已提交,后台执行中…'); setWizardOpen(false); fetch(); }}
|
||||
onFailed={(id) => { toast.error('安装失败'); setOperating(prev => { const next = new Set(prev); next.delete(id); return next; }); }} />
|
||||
|
||||
{/* ────────── 批量部署 Agent 对话框 ────────── */}
|
||||
|
||||
@@ -6,7 +6,6 @@ import {
|
||||
Edit,
|
||||
Trash2,
|
||||
Star,
|
||||
RefreshCw,
|
||||
Key,
|
||||
Plug,
|
||||
} from 'lucide-react';
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
Select, SelectContent, SelectItem, SelectTrigger, SelectValue,
|
||||
} from '@/components/ui/select';
|
||||
import {
|
||||
Play, Plus, Search, Clock, Trash2, History, RefreshCw, PackageOpen,
|
||||
Plus, Search, Clock, Trash2, History, RefreshCw, PackageOpen,
|
||||
} from 'lucide-react';
|
||||
import { toast } from 'sonner';
|
||||
import { cronJobApi, scriptApi, systemTaskApi } from '@/api';
|
||||
|
||||
@@ -210,12 +210,6 @@ function WorkflowEditorModal({ workflow, users, onClose, onSaved }: EditorProps)
|
||||
const [submitting, setSubmitting] = useState(false);
|
||||
const [error, setError] = useState('');
|
||||
|
||||
const categoryLabels: Record<string, string> = {
|
||||
resource: t('approval.category.resource'),
|
||||
app: t('approval.category.app'),
|
||||
permission: t('approval.category.permission'),
|
||||
};
|
||||
|
||||
const stepTypeLabels: Record<string, string> = {
|
||||
submit: t('approval.step.submit'),
|
||||
audit: t('approval.step.audit'),
|
||||
|
||||
@@ -4,7 +4,6 @@ import { useState, useEffect, useCallback, useMemo, useRef } from 'react';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useVirtualizer } from '@tanstack/react-virtual';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
|
||||
@@ -64,7 +64,6 @@ function ChartBody({
|
||||
unit,
|
||||
yDomain,
|
||||
gradPrefix,
|
||||
zoomRange,
|
||||
refLeft,
|
||||
refRight,
|
||||
onMouseDown,
|
||||
|
||||
@@ -168,7 +168,7 @@ export function buildMetricsFromHistory(history: JsonData[], timeConfig: TimeCon
|
||||
}
|
||||
|
||||
/** 从过滤后历史计算实际数据时间跨度(用于展示) // Logan.Li */
|
||||
export function getActualDataSpan(history: JsonData[], range: HostMonitorTimeRange): string | null {
|
||||
export function getActualDataSpan(history: JsonData[], _range: HostMonitorTimeRange): string | null {
|
||||
if (!history.length) return null;
|
||||
const ts = history.map(recordTimestamp).filter((t) => t > 0);
|
||||
if (!ts.length) return null;
|
||||
|
||||
Reference in new issue
Block a user