fix(web): align alert queue table

This commit is contained in:
lingniu
2026-07-20 09:00:38 +08:00
parent 6574b49ff9
commit ebf682d863
3 changed files with 32 additions and 12 deletions

View File

@@ -89,20 +89,20 @@ function AlertTime({ value, className = '' }: { value?: string; className?: stri
const AlertEventTable = memo(function AlertEventTable({ rows, selectedID, compact, onSelect }: { rows: AlertEvent[]; selectedID: string; compact: boolean; onSelect: (id: string) => void }) { const AlertEventTable = memo(function AlertEventTable({ rows, selectedID, compact, onSelect }: { rows: AlertEvent[]; selectedID: string; compact: boolean; onSelect: (id: string) => void }) {
const columns = useMemo(() => { const columns = useMemo(() => {
const allColumns = [ const allColumns = [
{ title: '级别', dataIndex: 'severity', width: 78, render: (_: AlertEvent['severity'], event: AlertEvent) => <SeverityTag severity={event.severity} /> }, { title: '级别', dataIndex: 'severity', className: 'is-severity', width: 78, render: (_: AlertEvent['severity'], event: AlertEvent) => <SeverityTag severity={event.severity} /> },
{ {
title: '车牌 / VIN', dataIndex: 'plate', width: 132, title: '车牌 / VIN', dataIndex: 'plate', className: 'is-vehicle', width: 132,
render: (_: string, event: AlertEvent) => <div className="v2-alert-event-vehicle"><strong>{event.plate || '未绑定车牌'}</strong><small>{event.vin}</small></div> render: (_: string, event: AlertEvent) => <div className="v2-alert-event-vehicle"><strong>{event.plate || '未绑定车牌'}</strong><small>{event.vin}</small></div>
}, },
{ title: '规则', dataIndex: 'ruleName', width: 146, render: (value: string) => <span className="v2-alert-event-rule" title={value}>{value}</span> }, { title: '规则', dataIndex: 'ruleName', className: 'is-rule', width: 146, render: (value: string) => <span className="v2-alert-event-rule" title={value}>{value}</span> },
{ title: '协议', dataIndex: 'protocol', width: 98, render: (value: string) => <ProtocolTag className="v2-alert-protocol-tag" protocol={value} compact /> }, { title: '协议', dataIndex: 'protocol', className: 'is-protocol', width: 98, render: (value: string) => <ProtocolTag className="v2-alert-protocol-tag" protocol={value} compact /> },
{ title: '触发时间', dataIndex: 'triggeredAt', width: 124, render: (value: string) => <AlertTime value={value} /> }, { title: '触发时间', dataIndex: 'triggeredAt', className: 'is-triggered-at', width: 124, render: (value: string) => <AlertTime value={value} /> },
{ title: '状态', dataIndex: 'status', width: 78, render: (_: AlertEvent['status'], event: AlertEvent) => <StatusTag status={event.status} /> }, { title: '状态', dataIndex: 'status', className: 'is-status', width: 78, render: (_: AlertEvent['status'], event: AlertEvent) => <StatusTag status={event.status} /> },
{ {
title: '触发证据', dataIndex: 'evidence', width: 150, title: '触发证据', dataIndex: 'evidence', className: 'is-evidence', width: 150,
render: (_: unknown, event: AlertEvent) => <div className="v2-alert-event-evidence"><strong>{alertValue(event)}</strong><small>{thresholdText(event)}</small></div> render: (_: unknown, event: AlertEvent) => <div className="v2-alert-event-evidence"><strong>{alertValue(event)}</strong><small>{thresholdText(event)}</small></div>
}, },
{ title: '位置', dataIndex: 'location', width: 164, render: (value: string) => <span className="v2-alert-event-location" title={value}>{value || '—'}</span> }, { title: '位置', dataIndex: 'location', className: 'is-location', width: 164, render: (value: string) => <span className="v2-alert-event-location" title={value}>{value || '—'}</span> },
]; ];
return compact return compact
? allColumns ? allColumns

View File

@@ -47,6 +47,8 @@ describe('V2 production entry', () => {
expect(mainSource).toContain("window.history.scrollRestoration = 'manual'"); expect(mainSource).toContain("window.history.scrollRestoration = 'manual'");
expect(workspaceStyles).toContain('.v2-navigation.semi-navigation .semi-navigation-item-icon-toggle-right:empty'); expect(workspaceStyles).toContain('.v2-navigation.semi-navigation .semi-navigation-item-icon-toggle-right:empty');
expect(workspaceStyles).toContain('.v2-mileage-source-trigger.semi-button .semi-button-content-right > b'); expect(workspaceStyles).toContain('.v2-mileage-source-trigger.semi-button .semi-button-content-right > b');
expect(workspaceStyles).toContain('.semi-table-row > .semi-table-row-cell:first-child::before');
expect(workspaceStyles).not.toContain('.semi-table-row::before');
}); });
test('renders a static boot shell and recovers when the React entry never becomes ready', () => { test('renders a static boot shell and recovers when the React entry never becomes ready', () => {

View File

@@ -8923,7 +8923,7 @@
transition: background-color .16s ease, box-shadow .16s ease; transition: background-color .16s ease, box-shadow .16s ease;
} }
.v2-alert-table-scroll .v2-alert-event-table .semi-table-tbody > .semi-table-row::before { .v2-alert-table-scroll .v2-alert-event-table .semi-table-tbody > .semi-table-row > .semi-table-row-cell:first-child::before {
position: absolute; position: absolute;
z-index: 2; z-index: 2;
top: 7px; top: 7px;
@@ -8936,15 +8936,15 @@
pointer-events: none; pointer-events: none;
} }
.v2-alert-table-scroll .v2-alert-event-table .semi-table-tbody > .semi-table-row.is-severity-critical::before { .v2-alert-table-scroll .v2-alert-event-table .semi-table-tbody > .semi-table-row.is-severity-critical > .semi-table-row-cell:first-child::before {
background: #e5484d; background: #e5484d;
} }
.v2-alert-table-scroll .v2-alert-event-table .semi-table-tbody > .semi-table-row.is-severity-major::before { .v2-alert-table-scroll .v2-alert-event-table .semi-table-tbody > .semi-table-row.is-severity-major > .semi-table-row-cell:first-child::before {
background: #ed8d32; background: #ed8d32;
} }
.v2-alert-table-scroll .v2-alert-event-table .semi-table-tbody > .semi-table-row.is-severity-minor::before { .v2-alert-table-scroll .v2-alert-event-table .semi-table-tbody > .semi-table-row.is-severity-minor > .semi-table-row-cell:first-child::before {
background: #d9a31d; background: #d9a31d;
} }
@@ -26143,6 +26143,24 @@
background: #edf5ff; background: #edf5ff;
} }
.v2-alert-event-table.semi-table-wrapper :is(.semi-table-row-head, .semi-table-row-cell):is(.is-severity, .is-protocol, .is-triggered-at, .is-status) {
text-align: center;
}
.v2-alert-event-table .semi-table-row-cell.is-rule {
color: #31465f;
font-weight: 620;
}
.v2-alert-event-table .semi-table-row-cell.is-triggered-at .v2-alert-time {
color: #53667d;
font-variant-numeric: tabular-nums;
}
.v2-alert-event-table .semi-table-row-cell.is-location {
color: #607187;
}
.v2-alert-event-evidence strong { .v2-alert-event-evidence strong {
font-size: 13px; font-size: 13px;
} }