feat(tasks): 漏洞列改为按严重度分档显示 严/高/中/低
- TaskListMetricsAll 用 COUNT(*) FILTER 按 severity 分四档统计(同一条查询)
- TaskListMetrics.Findings 及 TaskDTO.findings 由数字改为 {critical,high,medium,low}
- 列表页「漏洞」列渲染 x/x/x/x,配色沿用 severity 语义、为 0 的档位弱化
- severity 为空/白名单外的记录不计入任一档;mock 同步为对象结构
This commit is contained in:
1 parent
e65d3e5202
commit
87b3c3c770
7 files changed
+90
-48
No files matched your search
@@ -950,7 +950,9 @@ export default function TasksPage() {
|
||||
onSort={sortTasksBy}
|
||||
/>
|
||||
<TableHead className="text-center">目标进度</TableHead>
|
||||
<TableHead className="text-center">漏洞</TableHead>
|
||||
<TableHead className="text-center" title="严重 / 高 / 中 / 低">
|
||||
漏洞 <span className="text-muted-foreground font-normal">严/高/中/低</span>
|
||||
</TableHead>
|
||||
<TableHead className="text-center">运行中 Worker</TableHead>
|
||||
<SortableTaskHead
|
||||
field="created"
|
||||
@@ -1217,11 +1219,25 @@ const TaskRow = React.memo(function TaskRow({
|
||||
)}
|
||||
</TableCell>
|
||||
<TableCell className="text-center text-xs tabular-nums">
|
||||
{task.findings && task.findings > 0 ? (
|
||||
<span className="text-destructive font-medium">{task.findings}</span>
|
||||
) : (
|
||||
<span className="text-muted-foreground">0</span>
|
||||
)}
|
||||
{(() => {
|
||||
const f = task.findings;
|
||||
const total = f ? f.critical + f.high + f.medium + f.low : 0;
|
||||
if (!f || total === 0) return <span className="text-muted-foreground">0</span>;
|
||||
const seg = (n: number, cls: string) => (
|
||||
<span className={n > 0 ? cls : "text-muted-foreground"}>{n}</span>
|
||||
);
|
||||
return (
|
||||
<span className="font-medium whitespace-nowrap" title="严重 / 高 / 中 / 低">
|
||||
{seg(f.critical, "text-rose-600 dark:text-rose-400")}
|
||||
<span className="text-muted-foreground">/</span>
|
||||
{seg(f.high, "text-red-600 dark:text-red-400")}
|
||||
<span className="text-muted-foreground">/</span>
|
||||
{seg(f.medium, "text-amber-600 dark:text-amber-400")}
|
||||
<span className="text-muted-foreground">/</span>
|
||||
{seg(f.low, "text-slate-600 dark:text-slate-400")}
|
||||
</span>
|
||||
);
|
||||
})()}
|
||||
</TableCell>
|
||||
<TableCell className="text-center text-xs tabular-nums">
|
||||
{task.in_flight && task.in_flight > 0 ? (
|
||||
|
||||
@@ -65,7 +65,7 @@ export const tasks: Task[] = [
|
||||
paused: false,
|
||||
active: true,
|
||||
in_flight: 3,
|
||||
findings: 4,
|
||||
findings: { critical: 1, high: 2, medium: 1, low: 0 },
|
||||
stalled: false,
|
||||
goals_total: 5,
|
||||
goals_met: 2,
|
||||
@@ -91,7 +91,7 @@ export const tasks: Task[] = [
|
||||
paused: false,
|
||||
active: false,
|
||||
in_flight: 2,
|
||||
findings: 2,
|
||||
findings: { critical: 0, high: 1, medium: 1, low: 0 },
|
||||
stalled: false,
|
||||
goals_total: 4,
|
||||
goals_met: 1,
|
||||
|
||||
@@ -1192,7 +1192,7 @@ function route(m: string, path: string, seg: string[], q: URLSearchParams, b: Re
|
||||
paused: false,
|
||||
active: true,
|
||||
in_flight: 0,
|
||||
findings: 0,
|
||||
findings: { critical: 0, high: 0, medium: 0, low: 0 },
|
||||
stalled: false,
|
||||
goals_total: 0,
|
||||
goals_met: 0,
|
||||
|
||||
@@ -23,7 +23,7 @@ export interface Task {
|
||||
queued?: boolean;
|
||||
active?: boolean;
|
||||
in_flight?: number;
|
||||
findings?: number; // 该任务已登记的漏洞数
|
||||
findings?: { critical: number; high: number; medium: number; low: number }; // 已登记漏洞数(按严重度分档)
|
||||
last_activity?: string;
|
||||
stalled?: boolean;
|
||||
goals_total?: number;
|
||||
|
||||
Reference in new issue
Block a user