refactor(ui): polish semi alert workspace
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user