refactor(ui): polish semi alert workspace

This commit is contained in:
lingniu
2026-07-19 18:21:44 +08:00
parent adc01f2fa4
commit 0f51e3d375
2 changed files with 336 additions and 1 deletions

View File

@@ -31,6 +31,15 @@ const EMPTY_FILTERS: Filters = { keyword: '', severity: '', status: '', ruleId:
const PROTOCOLS = ['GB32960', 'JT808', 'YUTONG_MQTT'];
const NUMERIC_OPERATORS = ['gt', 'gte', 'lt', 'lte', 'eq', 'neq', 'between', 'outside'];
const BOOLEAN_OPERATORS = ['eq', 'neq', 'changed'];
const COMPACT_ALERT_COLUMN_WIDTHS: Record<string, number> = {
selection: 40,
severity: 80,
plate: 132,
ruleName: 148,
protocol: 100,
triggeredAt: 120,
status: 78
};
type RuleTemplate = { id: string; title: string; summary: string; draft: AlertRuleInput };
const RULE_TEMPLATES: RuleTemplate[] = [
@@ -100,7 +109,11 @@ const AlertEventTable = memo(function AlertEventTable({ rows, selectedID, compac
},
{ title: '位置', dataIndex: 'location', width: 180, render: (value: string) => <span className="v2-alert-event-location" title={value}>{value || '—'}</span> },
];
return compact ? allColumns.filter((column) => column.dataIndex !== 'evidence' && column.dataIndex !== 'location') : allColumns;
return compact
? allColumns
.filter((column) => column.dataIndex !== 'evidence' && column.dataIndex !== 'location')
.map((column) => ({ ...column, width: COMPACT_ALERT_COLUMN_WIDTHS[column.dataIndex] ?? column.width }))
: allColumns;
}, [compact, onSelect, selectedID]);
return <Table