feat(platform): make source consistency actionable
This commit is contained in:
@@ -33,13 +33,26 @@ function sourceEvidenceText(row: VehicleCoverageRow) {
|
||||
return `${row.onlineSourceCount}/${row.sourceCount} 来源在线`;
|
||||
}
|
||||
|
||||
function sourceConsistencyTag(row: VehicleCoverageRow) {
|
||||
function sourceConsistencyAction(row: VehicleCoverageRow, onFilter: (filters: Record<string, string>) => void) {
|
||||
const consistency = row.sourceConsistency;
|
||||
if (!consistency) {
|
||||
return <Tag color="grey">未诊断</Tag>;
|
||||
}
|
||||
const color = consistency.severity === 'ok' ? 'green' as const : consistency.severity === 'error' ? 'red' as const : 'orange' as const;
|
||||
return <Tag color={color}>{consistency.title || consistency.status}</Tag>;
|
||||
const label = consistency.title || consistency.status;
|
||||
if ((consistency.missingProtocols ?? []).length > 0) {
|
||||
return (
|
||||
<Button
|
||||
size="small"
|
||||
theme="light"
|
||||
type={color === 'red' ? 'danger' : color === 'orange' ? 'warning' : 'primary'}
|
||||
onClick={() => onFilter({ serviceStatus: 'degraded', missingProtocol: consistency.missingProtocols[0] })}
|
||||
>
|
||||
{label}
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
return <Tag color={color}>{label}</Tag>;
|
||||
}
|
||||
|
||||
async function copyVehicleShareURL() {
|
||||
@@ -166,7 +179,7 @@ export function Vehicles({
|
||||
{
|
||||
title: '来源一致性',
|
||||
width: 140,
|
||||
render: (_: unknown, row: VehicleCoverageRow) => sourceConsistencyTag(row)
|
||||
render: (_: unknown, row: VehicleCoverageRow) => sourceConsistencyAction(row, (nextFilters) => applyFilters({ ...filters, ...nextFilters }))
|
||||
},
|
||||
{ title: '证据覆盖', width: 120, render: (_: unknown, row: VehicleCoverageRow) => sourceEvidenceText(row) },
|
||||
{ title: '在线', width: 90, render: (_: unknown, row: VehicleCoverageRow) => <StatusTag status={row.online ? 'ok' : 'offline'} /> },
|
||||
|
||||
Reference in New Issue
Block a user