feat(platform): link dashboard quality preview
This commit is contained in:
@@ -22,7 +22,7 @@ export default function App() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const pages: Record<PageKey, JSX.Element> = {
|
const pages: Record<PageKey, JSX.Element> = {
|
||||||
dashboard: <Dashboard onOpenVehicle={openVehicle} />,
|
dashboard: <Dashboard onOpenVehicle={openVehicle} onOpenQuality={() => setActivePage('quality')} />,
|
||||||
vehicles: <Vehicles onOpenVehicle={openVehicle} />,
|
vehicles: <Vehicles onOpenVehicle={openVehicle} />,
|
||||||
realtime: <Realtime />,
|
realtime: <Realtime />,
|
||||||
detail: <VehicleDetail vin={activeVin} />,
|
detail: <VehicleDetail vin={activeVin} />,
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ function formatLag(value?: number | null) {
|
|||||||
return value == null ? '未接入' : value.toLocaleString();
|
return value == null ? '未接入' : value.toLocaleString();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function Dashboard({ onOpenVehicle }: { onOpenVehicle: (vin: string) => void }) {
|
export function Dashboard({ onOpenVehicle, onOpenQuality }: { onOpenVehicle: (vin: string) => void; onOpenQuality: () => void }) {
|
||||||
const [summary, setSummary] = useState<DashboardSummary | null>(null);
|
const [summary, setSummary] = useState<DashboardSummary | null>(null);
|
||||||
const [vehicles, setVehicles] = useState<VehicleRow[]>([]);
|
const [vehicles, setVehicles] = useState<VehicleRow[]>([]);
|
||||||
const [coverage, setCoverage] = useState<VehicleCoverageRow[]>([]);
|
const [coverage, setCoverage] = useState<VehicleCoverageRow[]>([]);
|
||||||
@@ -113,7 +113,11 @@ export function Dashboard({ onOpenVehicle }: { onOpenVehicle: (vin: string) => v
|
|||||||
<Card title="实时积压" bordered style={{ marginTop: 16 }}>
|
<Card title="实时积压" bordered style={{ marginTop: 16 }}>
|
||||||
<Typography.Text>Kafka 当前消费积压:{formatLag(summary?.kafkaLag)}</Typography.Text>
|
<Typography.Text>Kafka 当前消费积压:{formatLag(summary?.kafkaLag)}</Typography.Text>
|
||||||
</Card>
|
</Card>
|
||||||
<Card title="质量问题预览" bordered style={{ marginTop: 16 }}>
|
<Card
|
||||||
|
title={<Space><span>质量问题预览</span><Button size="small" onClick={onOpenQuality}>查看全部</Button></Space>}
|
||||||
|
bordered
|
||||||
|
style={{ marginTop: 16 }}
|
||||||
|
>
|
||||||
<Table
|
<Table
|
||||||
pagination={false}
|
pagination={false}
|
||||||
rowKey={(row?: QualityIssueRow) => `${row?.protocol ?? ''}-${row?.issueType ?? ''}-${row?.lastSeen ?? ''}-${row?.detail ?? ''}`}
|
rowKey={(row?: QualityIssueRow) => `${row?.protocol ?? ''}-${row?.issueType ?? ''}-${row?.lastSeen ?? ''}-${row?.detail ?? ''}`}
|
||||||
|
|||||||
Reference in New Issue
Block a user